public MenuConnector(CheckAction action, CheckMenuItem 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);
				this.action.CheckedChanged += new EventHandler<EventArgs>(action_CheckedChanged).MakeWeak(e => this.action.CheckedChanged -= e);
			}
Exemple #2
0
 public ToolBarConnector(CheckAction action, CheckToolItem 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);
     this.action.CheckedChanged += new EventHandler <EventArgs>(action_CheckedChanged).MakeWeak(e => this.action.CheckedChanged -= e);
 }
 public MenuConnector(CheckAction action, CheckMenuItem 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);
     this.action.CheckedChanged += new EventHandler <EventArgs>(action_CheckedChanged).MakeWeak(e => this.action.CheckedChanged -= e);
 }
Exemple #4
0
		public static CheckAction AddCheck(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);
			CheckAction action = new CheckAction(id, text, icon, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
		}
Exemple #5
0
        public static void Toggle(object sender, EventArgs args)
        {
            if (!(sender is CheckAction))
            {
                return;
            }
            CheckAction action = (CheckAction)sender;

            action.Checked = !action.Checked;
        }
Exemple #6
0
        public static bool RemoveCheckHandler(this ActionCollection actions, string actionID, EventHandler <EventArgs> checkChangedHandler)
        {
            CheckAction action = actions[actionID] as CheckAction;

            if (action != null)
            {
                action.CheckedChanged -= checkChangedHandler;
                return(true);
            }
            return(false);
        }
Exemple #7
0
		public static CheckAction AddCheck(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated, params Keys[] accelerators)
		{
#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 CheckAction(id, text, icon, activated);
			action.Accelerators = accelerators;
			actions.Add(action);
			return action;
#endif
		}
Exemple #8
0
        public static CheckAction AddCheck(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);
            }
            CheckAction action = new CheckAction(id, text, icon, activated);

            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
        }
Exemple #9
0
        public static CheckAction AddCheck(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated, params Keys[] accelerators)
        {
#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 CheckAction(id, text, icon, activated);
            action.Accelerators = accelerators;
            actions.Add(action);
            return(action);
#endif
        }
Exemple #10
0
			public ToolBarConnector(CheckAction action, CheckToolItem 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);
				this.action.CheckedChanged += new EventHandler<EventArgs>(action_CheckedChanged).MakeWeak(e => this.action.CheckedChanged -= e);
			}