Esempio n. 1
0
        protected override void Dispose(bool disposing)
        {
            _uiThread.MustBeCalledFromUIThreadOrThrow();
            try {
                if (_componentID != 0)
                {
                    _compMgr.FRevokeComponent(_componentID);
                    _componentID = 0;
                }

                if (_libraryManager != null)
                {
                    _libraryManager.Dispose();
                    _libraryManager = null;
                }
            } finally {
                base.Dispose(disposing);
            }
        }
Esempio n. 2
0
 internal void RegisterCommands(Guid cmdSet, params Command[] commands)
 {
     _uiThread.MustBeCalledFromUIThreadOrThrow();
     if (GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
     {
         lock (_commandsLock) {
             foreach (var command in commands)
             {
                 var            beforeQueryStatus = command.BeforeQueryStatus;
                 CommandID      toolwndCommandID  = new CommandID(cmdSet, command.CommandId);
                 OleMenuCommand menuToolWin       = new OleMenuCommand(command.DoCommand, toolwndCommandID);
                 if (beforeQueryStatus != null)
                 {
                     menuToolWin.BeforeQueryStatus += beforeQueryStatus;
                 }
                 mcs.AddCommand(menuToolWin);
                 _commands[command] = menuToolWin;
             }
         }
     }
 }