private void ListenForUIEvents() { _address.TextChanged += delegate(object sender, EventArgs e) { _component.Url = _address.Text; }; _address.KeyDown += delegate(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { _component.Go(); } }; _back.Click += delegate(object sender, EventArgs e) { _component.Back(); }; _forward.Click += delegate(object sender, EventArgs e) { _component.Forward(); }; _refresh.Click += delegate(object sender, EventArgs e) { _component.Refresh(); }; _stop.Click += delegate(object sender, EventArgs e) { _component.Cancel(); }; _go.Click += delegate(object sender, EventArgs e) { _component.Go(); }; }
private static IAction CreateAction( string actionID, string path, WebBrowserComponent webBrowser) { string url = ExtractUrlFromFavourite(path); string menuPath = CreateMenuPath(path); // Create the menu action ActionPath actionPath = new ActionPath(menuPath, null); MenuAction action = new MenuAction(actionID, actionPath, ClickActionFlags.None, null); action.Label = actionPath.LastSegment.LocalizedText; // Set what we're supposed to do when the menu item is clicked action.SetClickHandler( delegate { // Navigate to the URL webBrowser.Url = url; webBrowser.Go(); }); return action; }