コード例 #1
0
		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);
		}
コード例 #2
0
        /// <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();
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
0
		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;
		}
コード例 #5
0
 public void SetComponent(IApplicationComponent component)
 {
     _component = (WebBrowserComponent)component;
 }
コード例 #6
0
 public void SetComponent(IApplicationComponent component)
 {
     _component = (WebBrowserComponent)component;
 }