Пример #1
0
        public ToolBarCheckBox(Codon codon, object caller)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            try {
                menuCommand = (ICheckableMenuCommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            } catch (Exception) {
            }
            if (menuCommand == null)
            {
                MessageService.ShowError("Can't create toolbar checkbox : " + codon.Id);
            }
            menuCommand.Owner = this;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            UpdateText();
            UpdateStatus();
        }
Пример #2
0
        public ToolBarDropDownButton(Codon codon, object caller, ArrayList subItems, IEnumerable <ICondition> conditions)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            this.subItems    = subItems;
            this.conditions  = conditions;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            if (menuBuilder == null && codon.Properties.Contains("class"))
            {
                menuBuilder       = codon.AddIn.CreateObject(StringParser.Parse(codon.Properties["class"])) as ICommand;
                menuBuilder.Owner = this;
            }

            UpdateStatus();
            UpdateText();
        }
Пример #3
0
        public ToolBarSplitButton(Codon codon, object caller, ArrayList subItems)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            this.subItems    = subItems;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (imgButtonEnabled == null && codon.Properties.Contains("icon"))
            {
                imgButtonEnabled = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            if (imgButtonDisabled == null && codon.Properties.Contains("disabledIcon"))
            {
                imgButtonDisabled = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["disabledIcon"]));
            }
            if (imgButtonDisabled == null)
            {
                imgButtonDisabled = imgButtonEnabled;
            }
            menuCommand       = codon.AddIn.CreateObject(codon.Properties["class"]) as ICommand;
            menuCommand.Owner = this;
            UpdateStatus();
            UpdateText();
        }
Пример #4
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = codon.GetFailedAction(caller);
                bool isVisible = failedAction != ConditionFailedAction.Exclude;
                if (isVisible != Visible)
                {
                    Visible = isVisible;
                }
                if (menuCommand != null)
                {
                    bool isChecked = menuCommand.IsChecked;
                    if (isChecked != Checked)
                    {
                        Checked = isChecked;
                    }
                }

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Пример #5
0
 public virtual void UpdateStatus()
 {
     if (codon != null)
     {
         if (Image == null && codon.Properties.Contains("icon"))
         {
             try {
                 Image = WinFormsResourceService.GetBitmap(codon.Properties["icon"]);
             } catch (ResourceNotFoundException) {}
         }
         Visible = GetVisible();
     }
 }
Пример #6
0
 public virtual void UpdateStatus()
 {
     if (codon != null)
     {
         if (Image == null && codon.Properties.Contains("icon"))
         {
             try {
                 Image = WinFormsResourceService.GetBitmap(codon.Properties["icon"]);
             } catch (ResourceNotFoundException) {}
         }
         Visible = GetVisible();
         command = CommandWrapper.Unwrap(command);
         Enabled = command != null && MenuService.CanExecuteCommand(command, caller);
     }
 }
Пример #7
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = Condition.GetFailedAction(conditions, caller);
                bool isVisible = failedAction != ConditionFailedAction.Exclude;
                if (base.Visible != isVisible)
                {
                    base.Visible = isVisible;
                }

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Пример #8
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = Condition.GetFailedAction(conditions, caller);
                this.Visible = failedAction != ConditionFailedAction.Exclude;
                bool isEnabled = failedAction != ConditionFailedAction.Disable;
                if (isEnabled && menuCommand != null && menuCommand is IMenuCommand)
                {
                    isEnabled = ((IMenuCommand)menuCommand).IsEnabled;
                }
                this.Enabled = isEnabled;

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Пример #9
0
        public ToolBarCommand(Codon codon, object caller, bool createCommand)
        {
            //this.RightToLeft = RightToLeft.Inherit;
            this.caller = caller;
            this.codon  = codon;

            if (createCommand)
            {
                menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            }

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = WinFormsResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }

            UpdateStatus();
            UpdateText();
        }