Example #1
0
 private void OnVerbStatusChanged(object sender, EventArgs args)
 {
     if (!this.reEntrantCode)
     {
         try
         {
             this.reEntrantCode = true;
             IComponent primarySelection = this.selSvc.PrimarySelection as IComponent;
             if (primarySelection != null)
             {
                 IServiceContainer site = primarySelection.Site as IServiceContainer;
                 if (site != null)
                 {
                     DesignerCommandSet set = (DesignerCommandSet)site.GetService(typeof(DesignerCommandSet));
                     foreach (DesignerVerb verb in set.Verbs)
                     {
                         if (verb == sender)
                         {
                             DesignerActionUIService service = (DesignerActionUIService)site.GetService(typeof(DesignerActionUIService));
                             if (service != null)
                             {
                                 service.Refresh(primarySelection);
                             }
                         }
                     }
                 }
             }
         }
         finally
         {
             this.reEntrantCode = false;
         }
     }
 }
 private void OnVerbStatusChanged(object sender, EventArgs args)
 {
     if (!_reEntrantCode)
     {
         try
         {
             _reEntrantCode = true;
             if (_selSvc.PrimarySelection is IComponent comp)
             {
                 if (comp.Site is IServiceContainer sc)
                 {
                     DesignerCommandSet dcs = (DesignerCommandSet)sc.GetService(typeof(DesignerCommandSet));
                     foreach (DesignerVerb verb in dcs.Verbs)
                     {
                         if (verb == sender)
                         {
                             DesignerActionUIService dapUISvc = (DesignerActionUIService)sc.GetService(typeof(DesignerActionUIService));
                             if (dapUISvc != null)
                             {
                                 //Debug.WriteLine("Calling refresh on component  " + comp.Site.Name);
                                 dapUISvc.Refresh(comp); // we need to refresh, a verb on the current panel has changed its state
                             }
                         }
                     }
                 }
             }
         }
         finally
         {
             _reEntrantCode = false;
         }
     }
 }