Change browsing history for a ChromiumWebBrowser control - c#

I've got a WinForms app that uses a ChromiumWebBrowser control. The control will display content for a specific web page depending on what the application is being used for at the time, and after the user is finished with the site, it should close.
However, the user could currently use the back/forward buttons (or the context menu) to go back to a page in the browser that they shouldn't have access to any more. I need a way of wiping the history from the browser to prevent this.
I can't find any methods or properties within the control itself that can edit the history, and the best solution I've found so far is the OnLoadingStateChanged event (in which the back/forward buttons can be enabled or disabled). I can't figure out a sensible way of using this to track whether the user can go back or not though.
Is there a simple way to access the browsing history of the control?

Related

My question is about WPF button controls rendering on click of check box in UI

We have an existing application source code which is developed using WPF and WCF. It's working fine for every user except for one particular user.
There is a functionality in application like on click of check box the button should be enabled on UI. only this specific functionality is not working for the specific user.
Please help me if anybody have an idea regarding WPF controls behaviour or something
We verified about the roles he has to access the application and everything looks good as others but still there is an issue.
Actually on click of checkbox the button should be enabled for the user to access it.

How to get tab order of wpf application

I am working on some UI automation for verify tab order of our WPF application. I was wondering if there was a Windows API or UIA API for getting the current tab order of the application under test. My UI automation is written in C# but I am more then willing to do some pinvokes to make this work.
Here is some clarification based off of #CodyGray's comment. My company's has certain tab orders that we want to rarely change if ever because our users are so used to these tab orders as part of their workflow (they operate the user interface faster than it can update via these tab orders...). The current way I am doing this is through keeping a list of the tab orders then using SendKey to tab and check which control has focus. I then double check if the focused control is the control I expect it to be from a hard coded list. I would prefer to actually ask the application what it's tab order is going to be instead of using SendKey which could send tabs to the incorrect window based on what has focus.

Storing all the events that happened inside a Windows Forms application

Is there a way to store all the window form events inside a list, so all of those events can be reapplied when the user opens the form next time?
Example: Let's say the user clicks a button inside a form and types in a string and then closes the form. After a while the user reopens the application again, and the form is re-initialized so that the click action and the string the user input is restored. (Kind of like an auto-save function.)
Purpose for this:
Recover after suspension.
Allow user to undo their work (Undo Button).
I am still not sure I understand you, but you say you want to get a list of events, okay, that can be done using Reflection. Here is a good link: http://www.switchonthecode.com/tutorials/csharp-tutorial-using-reflection-to-get-object-information
Your example:
Let's say the user clicks a button inside a form and type in a string,
he then closes the form, after a while he open the application again,
and form can re-initialize the form and apply the click action and the
string he inputted(kind of like an auto-save function).
-You can do this without getting a list of events. So I don't see why you have to do it this way. There are multiple ways to do this. If you are using a winform, one basic solution is to define properties using the settings page. Check this out:
http://msdn.microsoft.com/en-us/library/cftf714c(VS.90).aspx
Use the Settings page of the Project Designer to specify a project's application settings. Application settings enable you to store and retrieve property settings and other information for your application dynamically. They also enable you to maintain custom application and user preferences on a client computer. For more information, see Application Settings.
To access the Settings page, select a project node in Solution
Explorer, and then, on the Project menu, click Properties. When the
Project Designer appears, click the Settings tab.
You can establish waypoints (to borrow a term from aviation) and save values to your settings collection periodically without the user having to do anything, like they would have to do if you provided a save button. But that just brings up the point, what's wrong will the lowly save button. It's a well known convention. People know that if they don't want to lose data, they should save every now and then.

c# User Control Navigation

I am making a c# windows app that has one MainForm and many User Controls (LoginPage, HomePage, MyListPage, etc.) embedded inside it. I am using Visual Studio 2005 to design the GUI.
In MainForm's constructor I do:
Controls.Add(new LoginPage());
Controls.Add(new HomePage());
Controls.Add(new MyListPage());
...
LoginPage.show();
But I have over 30 pages that I add to MainForm's constructor and I think this is the culprit of my app's lag at its runtime. Does anybody know a more standardized way of using User Controls for a one-form navigation app?
I'm assuming you have a way of navigating between pages - your user controls aren't all shown at once?
If that's the case, you should be able to do the following:
Create one of the user controls on construction to use as the initial page.
When the user performs an action which means your app should move to another page, remove the current user control from the form, dispose of it, create a new one of the required type, and add it to the form.
If you only want to create each user control once, you can use a caching mechanism so that each one is only created once (and don't dispose of the controls as you remove them).
If you use this approach, it should get rid of some of the initial lag, and trade it for multiple smaller lags as the user navigates to each user control for the first time.

Drag and Drop to a hosted Browser control

I have a WinForms program written on .NET 2 which hosts a webbrowser control and renders asp.net pages from a known server.
I would like to be able to drag, say, a tree node from a treeview in my winforms app into a specific location in the hosted web page and have it trigger a javascript event there.
Currently, I can implement the IDocHostUIHandler interface and getting drag\drop events on the browser control, then call Navigate("javascript:fire_event(...)") on the control to execute a script on the page. However, I want this to work only when I drop data on a specific part of the page.
One solution, I suppose, would be to bite the bullet and write a custom browser plugin in the form of an activex control, embed that in the location I want to drop to and let that implement the needed drag\drop interfaces.
Would that work?
Is there a cleaner approach? Can I take advantage of the fact that the browser control is hosted in my app and provide some further level of interaction?
Take a look at the BrowserPlus project at Yahoo.
It looks like they have built a toolkit so that you don't have to do the gritty work of writing the browser plugin yourself.
If you can find out the on screen position of the part of the page you are interested in, you could compare this with the position of the mouse when you receive the drop event. I'm not sure how practical this is if you can get the info out of the DOM or whatnot.
As an alternative could you implement the mouse events on the bit of the page using javascript?

Categories

Resources