Ejemplo n.º 1
0
 public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton)
 {
     this.toolBarButton        = toolBarButton;
     this.toolBarButton.Click += toolBarButton_Click;
     this.action = action;
     this.action.EnabledChanged += new EventHandler <EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e);
 }
Ejemplo n.º 2
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated)
        {
            ButtonAction action = new ButtonAction(id, text, activated);

            actions.Add(action);
            return(action);
        }
Ejemplo n.º 3
0
 public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton)
 {
     this.toolBarButton = toolBarButton;
     this.toolBarButton.Click += toolBarButton_Click;
     this.action = action;
     this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e);
 }
Ejemplo n.º 4
0
 public MenuConnector(ButtonAction action, ImageMenuItem menuItem)
 {
     this.action = action;
     this.menuItem = menuItem;
     this.menuItem.Click += menuItem_Clicked;
     this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak((e) => this.action.EnabledChanged -= e);
 }
Ejemplo n.º 5
0
 public MenuConnector(ButtonAction action, ButtonMenuItem menuItem)
 {
     this.action             = action;
     this.menuItem           = menuItem;
     this.menuItem.Click    += HandleClick;
     this.menuItem.Validate += HandleValidate;
 }
Ejemplo n.º 6
0
        public void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
        {
            // map new commands/menus back to actions for backwards compatibility
            var commands = GetSystemCommands().ToArray();

            foreach (var command in commands)
            {
                var currentCommand = command;
                var action         = new ButtonAction
                {
                    ID          = currentCommand.ID,
                    MenuText    = currentCommand.MenuText,
                    ToolBarText = currentCommand.ToolBarText,
                    TooltipText = currentCommand.ToolTip,
                    Accelerator = currentCommand.Shortcut,
                    command     = currentCommand
                };
                currentCommand.Executed += (sender, e) => action.Activate();
                action.EnabledChanged   += (sender, e) => currentCommand.Enabled = action.Enabled;
                args.Actions.Add(action);
            }
                        #if DESKTOP
            if (addStandardItems)
            {
                var menu = new MenuBar(Generator);
                CreateStandardMenu(menu.Items, commands);
                args.Menu.ExtractMenu(menu);
            }
                        #endif
        }
Ejemplo n.º 7
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated, params Key[] accelerators)
		{
			ButtonAction action = new ButtonAction(id, text, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
		}
Ejemplo n.º 8
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text)
        {
            ButtonAction action = new ButtonAction(id, text);

            actions.Add(action);
            return(action);
        }
Ejemplo n.º 9
0
			public MenuConnector(ButtonAction action, ImageMenuItem menuItem)
			{
				this.action = action;
				this.menuItem = menuItem;
				this.menuItem.Click += HandleClick;
				this.menuItem.Validate += HandleValidate;
			}
Ejemplo n.º 10
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated, params Key[] accelerators)
        {
            ButtonAction action = new ButtonAction(id, text, activated);

            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
        }
Ejemplo n.º 11
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated)
		{
			Icon icon = null;
			if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			ButtonAction action = new ButtonAction(id, text, icon, activated);
			actions.Add(action);
			return action;
		}
Ejemplo n.º 12
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated, params Key[] accelerators)
		{
			Icon icon = null;
			if (iconResource != string.Empty) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			ButtonAction action = new ButtonAction(id, text, icon, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
		}
Ejemplo n.º 13
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated)
		{
#if WINRT
			throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly");
#else
			Icon icon = null;
			if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource);
			var action = new ButtonAction(id, text, icon, activated);
			actions.Add(action);
			return action;
#endif
		}
Ejemplo n.º 14
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated)
        {
            Icon icon = null;

            if (!string.IsNullOrEmpty(iconResource))
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            ButtonAction action = new ButtonAction(id, text, icon, activated);

            actions.Add(action);
            return(action);
        }
Ejemplo n.º 15
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated, params Key[] accelerators)
        {
            Icon icon = null;

            if (iconResource != string.Empty)
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            ButtonAction action = new ButtonAction(id, text, icon, activated);

            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
        }
Ejemplo n.º 16
0
        public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated)
        {
#if WINRT
            throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly");
#else
            Icon icon = null;
            if (!string.IsNullOrEmpty(iconResource))
            {
                icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource);
            }
            var action = new ButtonAction(id, text, icon, activated);
            actions.Add(action);
            return(action);
#endif
        }
Ejemplo n.º 17
0
		void GenerateActions()
		{
			var actions = new GenerateActionArgs(this);
			Application.Instance.GetSystemActions(actions, true);

			var quitAction = new ButtonAction { Text = "Quit", Accelerator = Application.Instance.CommonModifier | Key.Q };
			quitAction.Activated += (sender, e) => Application.Instance.Quit();
				
			// add action to file sub-menu
			var file = actions.Menu.FindAddSubMenu("&File");
			file.Actions.Add(quitAction);

			// generate menu
			this.Menu = actions.Menu.GenerateMenuBar();
		}
Ejemplo n.º 18
0
		public void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false)
		{
			// map new commands/menus back to actions for backwards compatibility
			var commands = GetSystemCommands().ToArray();
			foreach (var command in commands)
			{
				var currentCommand = command;
				var action = new ButtonAction
				{
					ID = currentCommand.ID,
					MenuText = currentCommand.MenuText,
					ToolBarText = currentCommand.ToolBarText,
					TooltipText = currentCommand.ToolTip,
					Accelerator = currentCommand.Shortcut,
					command = currentCommand
				};
				currentCommand.Executed += (sender, e) => action.Activate();
				action.EnabledChanged += (sender, e) => currentCommand.Enabled = action.Enabled;
				args.Actions.Add(action);
			}
			#if DESKTOP
			if (addStandardItems)
			{
				var menu = new MenuBar(Generator);
				CreateStandardMenu(menu.Items, commands);
				args.Menu.ExtractMenu(menu);
			}
			#endif
		}
Ejemplo n.º 19
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated)
		{
			ButtonAction action = new ButtonAction(id, text, activated);
			actions.Add(action);
			return action;
		}
Ejemplo n.º 20
0
		public static ButtonAction AddButton(this ActionCollection actions, string id, string text)
		{
			ButtonAction action = new ButtonAction(id, text);
			actions.Add(action);
			return action;
		}