예제 #1
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"]));
                }
            }
        }
예제 #2
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();
        }
예제 #3
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();
     }
 }
예제 #4
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = codon.GetFailedAction(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"]));
                }
            }
        }
예제 #5
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();
        }
예제 #6
0
        public ToolBarDropDownButton(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 (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();
        }