コード例 #1
0
        public void Execute(string actionName)
        {
            if (string.IsNullOrWhiteSpace(actionName))
            {
                throw new ArgumentNullException("actionName");
            }

            MessageDialog.IsSilent = true;
            ActionManager.Execute(ActionManager.GetActionId(actionName));
            MessageDialog.IsSilent = false;
        }
コード例 #2
0
            public void Bind(ActionId actionId, object control)
            {
                ToolStripSplitButton nativeControl = (ToolStripSplitButton)control;

                nativeControl.ButtonClick += (sender, e) =>
                {
                    ActionManager.Execute(actionId);
                };

                ActionManager.Updating += (s, e) =>
                {
                    nativeControl.Enabled = ActionManager.CanExecute(actionId);
                };
            }
コード例 #3
0
            public void Bind(ActionId actionId, object control)
            {
                ToolStripMenuItem nativeControl = (ToolStripMenuItem)control;

                nativeControl.Click += (sender, e) =>
                {
                    ActionManager.Execute(actionId);
                };

                ActionManager.Updating += (s, e) =>
                {
                    IAction action = ActionManager.GetAction(actionId);
                    nativeControl.Enabled = ActionManager.CanExecute(actionId);
                    nativeControl.Checked = action.IsChecked;
                };
            }
コード例 #4
0
            public void Bind(ActionId actionId, object control)
            {
                RibbonToggleButton nativeControl = (RibbonToggleButton)control;

                nativeControl.Click += (sender, e) =>
                {
                    ActionManager.Execute(actionId);
                };

                ActionManager.Updating += (s, e) =>
                {
                    IAction action = ActionManager.GetAction(actionId);
                    nativeControl.Enabled = ActionManager.CanExecute(actionId);
                    nativeControl.Checked = nativeControl.Enabled ? action.IsChecked : false;
                };
            }
コード例 #5
0
            public void Bind(ActionId actionId, object control)
            {
                if (null == control)
                {
                    throw new ArgumentNullException("control");
                }

                RibbonButton nativeControl = (RibbonButton)control;

                nativeControl.Click += (sender, e) =>
                {
                    ActionManager.Execute(actionId);
                };

                ActionManager.Updating += (s, e) =>
                {
                    nativeControl.Enabled = ActionManager.CanExecute(actionId);
                };
            }