예제 #1
0
파일: Connect.cs 프로젝트: zy26/tytannet
 /// <summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
 /// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
 /// <param term='custom'>Array of parameters that are host application specific.</param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
 {
     manager.ApplicationExit(false /* true */);
     customizator.Destroy();
     manager      = null;
     customizator = null;
 }
예제 #2
0
        public void AddInManager_CallInitializeOnceForAction()
        {
            var a1    = CreatePackageActionForManager();
            var a2    = CreatePackageActionForManager();
            var dte   = CreateDTE();
            var addIn = CreateAddIn();

            mock.ReplayAll();

            var manager = new CustomAddInManager(dte, addIn, null, Assembly.GetExecutingAssembly());

            Trace.WriteLine("Addin two actions.");
            manager.Add(a1);
            manager.Add(a2);

            // initialize actions - only the first one should be executed
            // the rest should be discarded by the manager itself:
            Trace.WriteLine("Calling application init of AddIn manager for the first time.");
            manager.ApplicationInit(true);
            Trace.WriteLine("Calling for the second time.");
            manager.ApplicationInit(true);

            // release manager's resources:
            Trace.WriteLine("Calling application exit.");
            manager.ApplicationExit(true);

            // check if the initialization has been called at most 2-times:
            Trace.WriteLine("Validating number of calls.");
            ThrowCounterException(2);
        }