public static ActionSet Build(WebBrowserComponent webBrowser) { List<IAction> actions = new List<IAction>(); string favouritesFolder = Environment.GetFolderPath(Environment.SpecialFolder.Favorites); string[] favourites = Directory.GetFiles(favouritesFolder, "*.*", SearchOption.AllDirectories); // The action ID is arbitrary--it's just an identifier--as long as all the // action IDs of all the actions in a given ActionModel are unqiue. // So, we'll just generate a new action ID for each action here // simply by incrementing an integer. int actionID = 0; foreach (string favouritePath in favourites) { IAction action = CreateAction( actionID.ToString(), favouritePath, webBrowser); actions.Add(action); actionID++; } return new ActionSet(actions); }
/// <summary> /// Constructor /// </summary> public WebBrowserComponentControl(WebBrowserComponent component) :base(component) { InitializeComponent(); _component = component; // Build the shortcut toolbar this.ToolbarModel = _component.ToolbarModel; _back.Enabled = _browser.CanGoBack; _forward.Enabled = _browser.CanGoForward; ListenForComponentEvents(); ListenForUIEvents(); ListenForBrowserEvents(); }
/// <summary> /// Constructor /// </summary> public WebBrowserComponentControl(WebBrowserComponent component) : base(component) { InitializeComponent(); _component = component; // Build the shortcut toolbar this.ToolbarModel = _component.ToolbarModel; _back.Enabled = _browser.CanGoBack; _forward.Enabled = _browser.CanGoForward; ListenForComponentEvents(); ListenForUIEvents(); ListenForBrowserEvents(); }
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; }
public void SetComponent(IApplicationComponent component) { _component = (WebBrowserComponent)component; }