Exemple #1
0
 protected override void Dispose(bool disposing)
 {
     if (lastInfo != null)
     {
         lastInfo.CancelAsyncUpdate();
         lastInfo.Changed -= OnLastInfoChanged;
         lastInfo          = null;
     }
     initialCommandTarget = null;
     base.Dispose(disposing);
 }
Exemple #2
0
        public void Update(MDMenu parent, ref int index)
        {
            var info = manager.GetCommandInfo(ce.CommandId, new CommandTargetRoute(initialCommandTarget));

            if (lastInfo != info)
            {
                if (lastInfo != null)
                {
                    lastInfo.CancelAsyncUpdate();
                }
                lastInfo = info;
                if (lastInfo.IsUpdatingAsynchronously)
                {
                    lastInfo.Changed += delegate {
                        var ind = FindMeInParent(parent);
                        if (info == lastInfo)
                        {
                            Update(parent, ref ind, info);
                            parent.UpdateSeparators();
                        }
                    };
                }
            }
            Update(parent, ref index, info);
        }
            public void Update()
            {
                if (IsSeparator)
                    return;

                if (lastCmdInfo != null) {
                    lastCmdInfo.CancelAsyncUpdate ();
                    lastCmdInfo.Changed -= LastCmdInfoChanged;
                }

                lastCmdInfo = IdeApp.CommandService.GetCommandInfo (CommandId, new CommandTargetRoute (Controller.lastCommandTarget));

                if (lastCmdInfo != null) {
                    lastCmdInfo.Changed += LastCmdInfoChanged;
                    Update (lastCmdInfo);
                }
            }