Exemplo n.º 1
0
 void IPackage.Initialize(IServiceProvider serviceProvider)
 {
     this._serviceProvider = serviceProvider;
     IServiceContainer service = this._serviceProvider.GetService(typeof(IServiceContainer)) as IServiceContainer;
     IApplicationIdentity identity = (IApplicationIdentity) this._serviceProvider.GetService(typeof(IApplicationIdentity));
     if ((identity.ApplicationType & ApplicationType.Workspace) != ApplicationType.Generic)
     {
         this._textManager = new MxTextManager(serviceProvider);
         service.AddService(typeof(TextManager), this._textManager);
     }
     ICommandManager manager = (ICommandManager) this._serviceProvider.GetService(typeof(ICommandManager));
     if (manager != null)
     {
         manager.AddGlobalCommandHandler(this);
     }
 }
Exemplo n.º 2
0
 void IDisposable.Dispose()
 {
     Microsoft.Matrix.Core.Services.PreferencesStore preferencesStore = this.PreferencesStore;
     if (this._findMruList != null)
     {
         preferencesStore.SetValue("FindMruCount", this._findMruList.Count, 0);
         if (this._findMruList.Count != 0)
         {
             string[] strArray = this._findMruList.Save();
             for (int i = 0; i < strArray.Length; i++)
             {
                 preferencesStore.SetValue("FindMru" + i, strArray[i], string.Empty);
             }
         }
     }
     if (this._replaceMruList != null)
     {
         preferencesStore.SetValue("ReplaceMruCount", this._replaceMruList.Count, 0);
         if (this._replaceMruList.Count != 0)
         {
             string[] strArray2 = this._replaceMruList.Save();
             for (int j = 0; j < strArray2.Length; j++)
             {
                 preferencesStore.SetValue("ReplaceMru" + j, strArray2[j], string.Empty);
             }
         }
     }
     if (this._askQuestionMruList != null)
     {
         preferencesStore.SetValue("AskQMruCount", this._askQuestionMruList.Count, 0);
         if (this._askQuestionMruList.Count != 0)
         {
             string[] strArray3 = this._askQuestionMruList.Save();
             for (int k = 0; k < strArray3.Length; k++)
             {
                 preferencesStore.SetValue("AskQMru" + k, strArray3[k], string.Empty);
             }
         }
     }
     IServiceContainer service = this._serviceProvider.GetService(typeof(IServiceContainer)) as IServiceContainer;
     if ((service != null) && (this._textManager != null))
     {
         service.RemoveService(typeof(TextManager));
         ((IDisposable) this._textManager).Dispose();
         this._textManager = null;
     }
     if (this._addInManager != null)
     {
         ((IDisposable) this._addInManager).Dispose();
         this._addInManager = null;
     }
     this._serviceProvider = null;
 }