示例#1
0
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
			applicationObject = (_DTE)application;
			addInInstance = (AddIn)addInInst;
			//if(connectMode == Extensibility.ext_ConnectMode.ext_cm_UISetup)
			{
				object []contextGUIDS = new object[] { };
				Commands commands = applicationObject.Commands;
				_CommandBars commandBars = applicationObject.CommandBars;

				// When run, the Add-in wizard prepared the registry for the Add-in.
				// At a later time, the Add-in or its commands may become unavailable for reasons such as:
				//   1) You moved this project to a computer other than which is was originally created on.
				//   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
				//   3) You add new commands or modify commands already defined.
				// You will need to re-register the Add-in by building the SmellFinderSetup project,
				// right-clicking the project in the Solution Explorer, and then choosing install.
				// Alternatively, you could execute the ReCreateCommands.reg file the Add-in Wizard generated in
				// the project directory, or run 'devenv /setup' from a command prompt.
				try
				{
					Command command = Find( commands );
					if( command == null )
					{
						command = commands.AddNamedCommand(addInInstance, "SmellFinder", "SmellFinder", "Executes the command for SmellFinder", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled);
						CommandBar commandBar = (CommandBar)commandBars["Tools"];
						CommandBarControl commandBarControl = command.AddControl(commandBar, 1);
					}
				}
				catch(System.Exception /*e*/)
				{
				}
			}
		}
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode,
            object addInInst, ref System.Array custom)
        {
            try
            {
                m_dte = (EnvDTE.DTE)application;
                m_addIn = (EnvDTE.AddIn)addInInst;

                switch (connectMode)
                {
                    case ext_ConnectMode.ext_cm_UISetup:

                        // Create commands in the UI Setup phase. This phase is called only once when the add-in is deployed.
                        CreateCommands();
                        break;

                    case ext_ConnectMode.ext_cm_AfterStartup:

                        InitializeAddIn();
                        break;

                    case ext_ConnectMode.ext_cm_Startup:

                        // Do nothing yet, wait until the IDE is fully initialized (OnStartupComplete will be called)
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Checks the availability of the link on the service.
        /// </summary>
        /// <param name="url">The link to check.</param>
        /// <returns>
        ///   <c>true</c> if the link is available; otherwise, <c>false</c>.
        /// </returns>
        public override bool Check(string url)
        {
            var loc = string.Empty;

            Utils.GetURL(url,
                         request: r =>
            {
                r.Method            = "HEAD";
                r.AllowAutoRedirect = false;
            },
                         response: r =>
            {
                loc = r.Headers[HttpResponseHeader.Location];
            });

            if (string.IsNullOrWhiteSpace(loc) || !CanCheck(loc))
            {
                return(false);
            }

            var checker = Extensibility.GetNewInstances <LinkCheckerEngine>().FirstOrDefault(x => x.CanCheck(loc));

            if (checker == null)
            {
                throw new NotSupportedException();
            }

            return(checker.Check(loc));
        }
示例#4
0
 public static void BeforeApplicationStart()
 {
     extensionsPath = HostingEnvironment.MapPath("~/bin/Extensions") ?? string.Empty;
     if (Directory.Exists(extensionsPath))
     {
         Extensibility.EnableAspNetIntegration(extensionsPath);
     }
 }
示例#5
0
 public void Mouse_InputReceived(object sender, Extensibility.Input.MouseEventArgs e)
 {
     //e.Log();
     //_viewModel.AddMessageInternal("Mouse Input",
     //    string.Format("name={0} {1}",
     //        e.Client != null ? e.Client.Name : "(no client)",
     //        e.ToString()));
 }
示例#6
0
		/// <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(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
		{
			if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
			{
				OnBeginShutdown(ref custom);
			}

			// appThis = null;
		}
示例#7
0
        private void CompletePackageInitialization()
        {
            try
            {
                this.Logger().Debug("Start Second Pass Initialization");

                if (Dte != null)
                {
                    this.Logger().Warn("Package Previously Initialized");
                    return;
                }

                Dte = GetService(typeof(SDTE)) as DTE;

                if (Dte == null)
                {
                    this.Logger().Warn("DTE not found");
                    return;
                }

                Extensibility = (IVsExtensibility)GetGlobalService(typeof(IVsExtensibility));
                this.Logger().Trace("IVsExtensibility: {0}", Extensibility != null);

                if (Extensibility == null)
                {
                    throw new ArgumentException("Extensibility cannot be null");
                }

                VsSolution = (IVsSolution)GetService(typeof(SVsSolution));
                this.Logger().Trace("IVsSolution: {0}", VsSolution != null);

                Dte2 = (DTE2)Extensibility.GetGlobalsObject(null).DTE;
                this.Logger().Trace("Dte2: {0}", Dte2 != null);

                if (Dte2 == null)
                {
                    throw new ArgumentException("Dte2 cannot be null");
                }

                if (VsSolution == null)
                {
                    throw new ArgumentException("VsSolution cannot be null");
                }

                _teamPilgrimVsService   = new TeamPilgrimVsService(_teamPilgrimPackageInstance, UIShell, Dte2, VsSolution);
                TeamPilgrimServiceModel = new TeamPilgrimServiceModel(new TeamPilgrimServiceModelProvider(), _teamPilgrimVsService);

                Messenger.Default.Register <ShowUnshelveDetailsDialogMessage>(this, ShowUnshelveDetailsDialog);

                this.Logger().Debug("End Second Pass Initialization");
            }
            catch (Exception exception)
            {
                this.Logger().FatalException("Second Pass Initialization", exception);
                throw;
            }
        }
示例#8
0
 void Extensibility.IDTExtensibility2.OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref Array custom)
 {
     if (application is Excel.Application) {
         _excelapp = (Excel.Application)application;
         _addInInstance = addInInst;
         _commands = new Commands((Excel.Application)application);
         if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
             OnStartupComplete();
     }
 }
示例#9
0
文件: Setup.cs 项目: ngs-doo/revenj
        protected override void Load(Extensibility.Autofac.ContainerBuilder builder)
        {
            var cs = ConfigurationManager.AppSettings["Revenj.ConnectionString"] ?? ConfigurationManager.AppSettings["ConnectionString"];
            if (string.IsNullOrEmpty(cs))
                throw new ConfigurationErrorsException(@"ConnectionString is missing from configuration. Add ConnectionString to <appSettings>
            Example: <add key=""ConnectionString"" value=""server=postgres.localhost;port=5432;database=MyDatabase;user=postgres;password=123456;encoding=unicode"" />");

            Revenj.DatabasePersistence.Postgres.Setup.ConfigurePostgres(builder, cs);
            base.Load(builder);
        }
示例#10
0
文件: Setup.cs 项目: ngs-doo/revenj
        protected override void Load(Extensibility.Autofac.ContainerBuilder builder)
        {
            var cs = ConfigurationManager.AppSettings["Revenj.ConnectionString"] ?? ConfigurationManager.AppSettings["ConnectionString"];
            if (string.IsNullOrEmpty(cs))
                throw new ConfigurationErrorsException(@"ConnectionString is missing from configuration. Add ConnectionString to <appSettings>
            Example: <add key=""ConnectionString"" value=""Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyOracleHost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xe)));User Id=oracle;Password=123456;"" />");

            Revenj.DatabasePersistence.Oracle.Setup.ConfigureOracle(builder, cs);
            base.Load(builder);
        }
示例#11
0
文件: Connect.cs 项目: 0k/OpenUpgrade
        /// <summary>
        ///      Implements the OnConnection method of the IDTExtensibility2 interface.
        ///      Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///      Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///      Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        ///      Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            applicationObject = application;
            addInInstance = addInInst;

            if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
            {
                OnStartupComplete(ref custom);
                
            }
        }
示例#12
0
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
            _OutlookApplication = (Microsoft.Office.Interop.Outlook.Application)application;
            InspectorWrapper.TheOutlookApplication = _OutlookApplication;            
            _addInInstance = addInInst;

            if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
            {
                OnStartupComplete(ref custom);
            }

		}
示例#13
0
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
			try
			{
				MindManager.Application app = (MindManager.Application) application;

				//TODO: Connect the Add-in
			}
			catch(System.Exception e)
			{
				Mindjet.Utility.HandleError(e);
			}
		}
示例#14
0
        /// <summary>
        /// Initialization code for the registry.
        /// </summary>
        public static void Init()
        {
            List <Type> prefixes = Extensibility.
                                   GetAllTypesWithAttribute <PrefixOperatorAttribute>();

            foreach (Type t in prefixes)
            {
                object obj = t.GetCustomAttributes(typeof(PrefixOperatorAttribute),
                                                   false).FirstOrDefault();
                PrefixOperatorAttribute att = obj as PrefixOperatorAttribute;

                if (att == null)
                {
                    Logger.Log(LogLevel.Error, Logger.REGISTRY,
                               "Attribute is null!");

                    System.Diagnostics.Debugger.Break();
                }

                Register(att.TokenInstance, att.NodeType);
            }
        }
示例#15
0
        /// <summary>
        /// Reloads the parsers list view.
        /// </summary>
        private void ReloadParsers()
        {
            var idx = listView.SelectedIndex;

            listView.Items.GroupDescriptions.Clear();
            FeedsListViewItemCollection.Clear();

            foreach (var engine in Extensibility.GetNewInstances <FeedReaderEngine>().OrderBy(x => x.Language).ThenBy(x => x.Name))
            {
                FeedsListViewItemCollection.Add(new FeedsListViewItem
                {
                    Enabled  = GuidesPage.Actives.Contains(engine.Name),
                    Icon     = "/RSTVShowTracker;component/Images/navigation.png",
                    Site     = engine.Name,
                    Language = Languages.List[engine.Language],
                    LangIcon = "pack://application:,,,/RSTVShowTracker;component/Images/flag-" + engine.Language + ".png"
                });
            }

            listView.SelectedIndex = idx;
            listView.Items.GroupDescriptions.Add(new PropertyGroupDescription("Language"));
        }
示例#16
0
文件: Connect.cs 项目: tgassner/NDoc
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
			try
			{
				// Application object
				applicationObject = (_DTE)application;
				addInInstance = (AddIn)addInInst;

				// Events we're interested in.
				EnvDTE.Events events = applicationObject.Events;
				buildEvents = (EnvDTE.BuildEvents)events.BuildEvents;
				solutionEvents = (EnvDTE.SolutionEvents)events.SolutionEvents;

				buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone);
				solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(this.Opened);

				OutputWindow		outputWindow;

				// Get the IDE's Output Window, Build Pane
				if (buildPane == null)
				{
					outputWindow = (OutputWindow)applicationObject.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object;
					buildPane = outputWindow.OutputWindowPanes.Item("Build");
				}

				// Set up some filenames and paths that we're going to need.
				SetPathsAndFilenames();
	
				// Add our add-in commands
				AddCommand ("Build", "NDoc Build Solution Documentation", "Builds MSDN help for C# projects in the solution", "", "Tools");
				AddCommand ("SolutionProperties", "NDoc Edit Solution Properties", "Set NDoc Solution Properties", "", "Tools");
				AddCommand ("View", "NDoc View Solution Documentation", "View NDoc Solution Documentation", "", "Tools");
			}
			catch(Exception e)
			{
				Trace.WriteLine(e.Message);
			}
			
		}
示例#17
0
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
			string strAppName = (string)application.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, application, null);
			if (strAppName == "Microsoft Word")
				 appThis = new WordApp(application);
			else if (strAppName == "Microsoft Excel")
				appThis = new ExcelApp(application);
			else if (strAppName == "Microsoft Publisher")
				appThis = new PubApp(application);
			else if (strAppName == "Microsoft Access")
				appThis = new AccessApp(application);
			else
			{
				string strError = String.Format("The '{0}' application is not supported!", strAppName);
				System.Windows.Forms.MessageBox.Show(strError, cstrCaption);
				throw new Exception(strError);
			}

			if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
			{
				OnStartupComplete(ref custom);
			}
		}
示例#18
0
        /// <summary>
        /// Initializes and loads binary operators via reflection
        /// </summary>
        public static void Init()
        {
            List <Type> infixes = Extensibility.
                                  GetAllTypesWithAttribute(typeof(BinaryOperatorAttribute));

            foreach (Type t in infixes)
            {
                object obj = t.GetCustomAttributes(typeof(BinaryOperatorAttribute),
                                                   false).FirstOrDefault();
                BinaryOperatorAttribute att = obj as BinaryOperatorAttribute;

                if (att == null)
                {
                    Logger.Log(LogLevel.Error, Logger.REGISTRY,
                               "Attribute is null!");

                    System.Diagnostics.Debugger.Break();
                }

                Register(att.TokenInstance, att.NodeType, att.PrecedenceLevel,
                         att.IsRightAssociative);
            }
        }
示例#19
0
		/// <summary>
		///      Implements the OnConnection method of the IDTExtensibility2 interface.
		///      Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param term='application'>
		///      Root object of the host application.
		/// </param>
		/// <param term='connectMode'>
		///      Describes how the Add-in is being loaded.
		/// </param>
		/// <param term='addInInst'>
		///      Object representing this Add-in.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
		{
			
                  
                  applicationObject = application;
			addInInstance = addInInst;
                  //bool flag = applicationObject is Microsoft.Office.Interop.Visio.Application;
                  //MessageBox.Show(flag.ToString());
                  //MessageBox.Show("asd2");
                  //try
                  //{
                  //      foreach (Microsoft.Office.Interop.Visio.Document doc in (applicationObject as Microsoft.Office.Interop.Visio.Application).Documents)
                  //      {
                  //            MessageBox.Show(doc.Path);
                  //      }
                  //}
                  //catch (Exception ex)
                  //{
                  //      MessageBox.Show(ex.ToString());
                  //}
                  
                  
		}
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode,
           object addInInst, ref System.Array custom)
        {
            try
            {
                applicationObject = (DTE2)application;
                addInInstance = (EnvDTE.AddIn)addInInst;

                switch (connectMode)
                {
                    case ext_ConnectMode.ext_cm_UISetup:

                        // Initialize the UI of the add-in
                        AddPermanentUI();
                        break;

                    case ext_ConnectMode.ext_cm_Startup:

                        // The add-in was marked to load on startup
                        // Do nothing at this point because the IDE may not be fully initialized
                        // Visual Studio will call OnStartupComplete when fully initialized
                        break;

                    case ext_ConnectMode.ext_cm_AfterStartup:

                        // The add-in was loaded by hand after startup using the Add-In Manager
                        // Initialize it in the same way that when is loaded on startup
                        InitializeAddIn();
                        break;
                }
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }
        }
示例#21
0
        /// <summary>
        ///      Implements the OnConnection method of the IDTExtensibility2 interface.
        ///      Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///      Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///      Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        ///      Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            m_OutlookAppObj = (Outlook.Application)application;
              m_AddInInstance = addInInst;

              // If we are not loaded upon startup, forward to OnStartupComplete() and pass the incoming System.Array.
              if (connectMode != ext_ConnectMode.ext_cm_Startup)
              {
            OnStartupComplete(ref custom);
              }
        }
示例#22
0
        /// <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(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
        {
            try
            {
                if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
                {
                    OnBeginShutdown(ref custom);
                }
                if (ContactsFolder != null)
                {
                    // Unregister Events
                   // ContactsFolder.Items.ItemAdd -= new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
                    // Release Reference to COM Object
                    ContactsFolder= null;

                }
                myAddInInstance = null;
                myApplicationObject = null;            }
            catch (System.Exception ex)
            {
                logger.Error(ex.Message);
                logger.Debug(ex.StackTrace.ToString());
                MessageBox.Show(ex.Message);
            }
        }
示例#23
0
        /// <summary>
        ///      Implements the OnConnection method of the IDTExtensibility2 interface.
        ///      Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///      Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///      Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        ///      Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            try
            {
                //MessageBox.Show("Starting Addin from " + AppDomain.CurrentDomain.BaseDirectory);

                // Get the initial Application object
                logger.Info("GContactsSync Connecting.");
                myApplicationObject = (Ol.Application)application;
                myAddInInstance = addInInst;

                if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
                {
                //    MessageBox.Show("On Connection - Startup");
                    OnStartupComplete(ref custom);
                }
                logger.Info("GContactsSync connected succesfully.");
            } catch (System.Exception ex)
            {
                logger.Error(ex.Message);
                logger.Debug(ex.StackTrace.ToString());
                MessageBox.Show("Error " + ex.Message);
            }
        }
示例#24
0
 void Engine_MetadataChanged(object sender, Extensibility.PlaybackMetaDataChangedEventArgs e)
 {
     CurrentTrack = e.Track;
     CurrentArtist = e.Artist;
 }
示例#25
0
        public override void Execute()
        {
            ArtifactContext artifactContext  = new ArtifactContext();
            FileInfo        artifactFileInfo = PathUtil.GetPrivateApplicationBaseFileFor(artifactContext.GetArtifactFor(mavenProject),
                                                                                         new FileInfo(localRepository).Directory, Directory.GetCurrentDirectory());

            Console.WriteLine("Artifact Path = " + artifactFileInfo.FullName);

            object[] extensibilityItems = new object[2];
            //Host Application
            ExtensibilityHostApplication hostApplication  = new ExtensibilityHostApplication();
            List <ItemsChoiceType>       itemsChoiceTypes = new List <ItemsChoiceType>();
            List <String> itemsChoiceTypeValues           = new List <string>();

            itemsChoiceTypes.Add(ItemsChoiceType.Name);
            itemsChoiceTypeValues.Add("Microsoft Visual Studio");

            itemsChoiceTypes.Add(ItemsChoiceType.Version);
            itemsChoiceTypeValues.Add("8.0");

            hostApplication.Items            = itemsChoiceTypeValues.ToArray();
            hostApplication.ItemsElementName = itemsChoiceTypes.ToArray();
            extensibilityItems[0]            = hostApplication;

            //Addin
            ExtensibilityAddin      addin      = new ExtensibilityAddin();
            List <ItemsChoiceType1> itemNames  = new List <ItemsChoiceType1>();
            List <string>           itemValues = new List <string>();

            itemNames.Add(ItemsChoiceType1.Assembly);
            itemValues.Add(artifactFileInfo.FullName);

            itemNames.Add(ItemsChoiceType1.FullClassName);
            itemValues.Add(mavenProject.artifactId + ".Connect");

            itemNames.Add(ItemsChoiceType1.FriendlyName);
            itemValues.Add(mavenProject.name);

            itemNames.Add(ItemsChoiceType1.Description);
            itemValues.Add(mavenProject.description);

            itemNames.Add(ItemsChoiceType1.LoadBehavior);
            itemValues.Add("0");

            itemNames.Add(ItemsChoiceType1.CommandLineSafe);
            itemValues.Add("0");

            itemNames.Add(ItemsChoiceType1.CommandPreload);
            itemValues.Add("1");

            addin.Items            = itemValues.ToArray();
            addin.ItemsElementName = itemNames.ToArray();
            extensibilityItems[1]  = addin;

            Extensibility extensibility = new Extensibility();

            extensibility.Items = extensibilityItems;

            //write XML
            XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Extensibility));
            XmlTextWriter xmlWriter  = new XmlTextWriter(Environment.GetEnvironmentVariable("TMP")
                                                         + @"\NPandayBuild.AddIn", System.Text.Encoding.Unicode);

            xmlWriter.Formatting = Formatting.Indented;
            serializer.Serialize(xmlWriter, extensibility);
        }
示例#26
0
        public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
        {
            this.logger.WriteLine("OnDisconnection: Begin");

            if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
            {
                OnBeginShutdown(ref custom);
            }

            GC.WaitForPendingFinalizers();
            GC.Collect();

            try
            {
                this.objOutlook = null;
                this.addInInstance = null;

                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
            catch (Exception ex)
            {
                this.logger.WriteLine("OnDisconnection (1): Exception");
                this.logger.WriteLine(ex.Message);
                this.logger.WriteLine(ex.StackTrace);
            }

            GC.WaitForPendingFinalizers();
            GC.Collect();

            this.logger.WriteLine("OnDisconnection: End");
            this.logger.Dispose();
        }
示例#27
0
        void IDTExtensibility2.OnConnection( object oApplication, Extensibility.ext_ConnectMode cmConnectMode, object oAddInInstance, ref System.Array arrCustom )
        {
            _pApplication = ( _DTE )oApplication;
            _pAddInInstance = ( EnvDTE.AddIn )oAddInInstance;

            _pf = new ProfilerForm();
            _pf.Owner = null;
            _pf.Closed += new EventHandler(_pf_Closed);

            // Hook up to run events
            Command cmdDebug;

            cmdDebug = _pApplication.Commands.Item( "Debug.Start", 1 );
            _cmdevDebugStart = _pApplication.Events.get_CommandEvents( cmdDebug.Guid, cmdDebug.ID );
            _cmdevDebugStart.BeforeExecute += new EnvDTE._dispCommandEvents_BeforeExecuteEventHandler( OnBeforeRun );
            _cmdevDebugStart.AfterExecute += new EnvDTE._dispCommandEvents_AfterExecuteEventHandler( OnAfterRun );

            cmdDebug = _pApplication.Commands.Item( "Debug.StartWithoutDebugging", 1 );
            _cmdevNoDebugStart = _pApplication.Events.get_CommandEvents( cmdDebug.Guid, cmdDebug.ID );
            _cmdevNoDebugStart.BeforeExecute += new EnvDTE._dispCommandEvents_BeforeExecuteEventHandler( OnBeforeRun );
            _cmdevNoDebugStart.AfterExecute += new EnvDTE._dispCommandEvents_AfterExecuteEventHandler( OnAfterRun );

            if ( cmConnectMode == Extensibility.ext_ConnectMode.ext_cm_UISetup )
            {
                object[] contextGUIDS = new object[] { };
                foreach ( Command cmd in _pApplication.Commands )
                {
                    try
                    {
                        if ( cmd.Name != null && cmd.Name.StartsWith( "NProf.Connect" ) )
                            cmd.Delete();
                    }
                    catch ( Exception )
                    {
                    }
                }

                try
                {
                    CommandBar barNProf = _pApplication.CommandBars[ "nprof Profiling" ];
                    if ( barNProf != null )
                        barNProf.Delete();
                }
                catch ( Exception )
                {
                }

                Command command = _pApplication.Commands.AddNamedCommand(
                    _pAddInInstance,
                    "Enable",
                    "Enable nprof",
                    "Toggle nprof integration",
                    true,
                    0,
                    ref contextGUIDS,
                    (int)vsCommandStatus.vsCommandStatusUnsupported );

                CommandBar barTools = ( CommandBar )_pApplication.CommandBars[ "Tools" ];
                CommandBar barMenu = ( CommandBar )_pApplication.Commands.AddCommandBar( "nprof Profiling", vsCommandBarType.vsCommandBarTypeMenu, barTools, 1 );

                CommandBarControl cbc = command.AddControl( barMenu, 1 );
            }
        }
示例#28
0
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            this.logger.WriteLine("OnConnection: Begin");

            this.objOutlook = (Application)application;
            this.addInInstance = addInInst;

            if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
            {
                OnStartupComplete(ref custom);
            }
            this.logger.WriteLine("OnConnection: End");
        }
示例#29
0
 /// <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(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     //			Trace.Write( "Addin.OnDisconnection start" );
     if (m_addin != null)
     {
         m_addin.OnDisconnection(disconnectMode, ref custom);
     }
     //			Trace.Write( "Addin.OnDisconnection finish" );
 }
示例#30
0
        void IDTExtensibility2.OnDisconnection( Extensibility.ext_DisconnectMode dmDisconnectMode, ref System.Array arrCustom )
        {
            // Remove command handlers
            _cmdevDebugStart.BeforeExecute -= new EnvDTE._dispCommandEvents_BeforeExecuteEventHandler( OnBeforeRun );
            _cmdevDebugStart.AfterExecute -= new EnvDTE._dispCommandEvents_AfterExecuteEventHandler( OnAfterRun );
            _cmdevDebugStart = null;

            _cmdevNoDebugStart.BeforeExecute -= new EnvDTE._dispCommandEvents_BeforeExecuteEventHandler( OnBeforeRun );
            _cmdevNoDebugStart.AfterExecute -= new EnvDTE._dispCommandEvents_AfterExecuteEventHandler( OnAfterRun );
            _cmdevNoDebugStart = null;

            _pApplication = null;
            _pAddInInstance = null;

            _pf = null;
        }
示例#31
0
        /// <summary>
        /// Reloads the list.
        /// </summary>
        public void ReloadList()
        {
            DestinationsListViewItemCollection.Clear();

            // load torrent

            var atr = Utils.GetApplicationForExtension(".torrent");
            Tuple <string, BitmapSource> tri;

            if (!string.IsNullOrWhiteSpace(atr) && (tri = Utils.GetExecutableInfo(atr)) != null)
            {
                DestinationsListViewItemCollection.Add(new DestinationListViewItem
                {
                    Icon      = tri.Item2,
                    Name      = DownloadLinksPage.CleanExeName(tri.Item1) + " for .torrent",
                    Type      = "Default local associations",
                    GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application-blue.png"
                });
            }

            // load usenet

            var anz = Utils.GetApplicationForExtension(".nzb");
            Tuple <string, BitmapSource> nzi;

            if (!string.IsNullOrWhiteSpace(anz) && (nzi = Utils.GetExecutableInfo(anz)) != null)
            {
                DestinationsListViewItemCollection.Add(new DestinationListViewItem
                {
                    Icon      = nzi.Item2,
                    Name      = DownloadLinksPage.CleanExeName(nzi.Item1) + " for .nzb",
                    Type      = "Default local associations",
                    GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application-blue.png"
                });
            }

            // load dlc

            var adl = Utils.GetApplicationForExtension(".dlc");
            Tuple <string, BitmapSource> dli;

            if (!string.IsNullOrWhiteSpace(adl) && (dli = Utils.GetExecutableInfo(adl)) != null)
            {
                DestinationsListViewItemCollection.Add(new DestinationListViewItem
                {
                    Icon      = dli.Item2,
                    Name      = DownloadLinksPage.CleanExeName(dli.Item1) + " for .dlc",
                    Type      = "Default local associations",
                    GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application-blue.png"
                });
            }

            // load html

            var aht = Utils.GetApplicationForExtension(".html");
            Tuple <string, BitmapSource> hti;

            if (!string.IsNullOrWhiteSpace(aht) && (hti = Utils.GetExecutableInfo(aht)) != null)
            {
                DestinationsListViewItemCollection.Add(new DestinationListViewItem
                {
                    Icon      = hti.Item2,
                    Name      = DownloadLinksPage.CleanExeName(hti.Item1) + " for .html",
                    Type      = "Default local associations",
                    GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application-blue.png"
                });
            }

            // load alternatives

            foreach (var alt in Settings.Get <Dictionary <string, object> >("Alternative Associations"))
            {
                var lst = (List <string>)alt.Value;

                if (lst == null || lst.Count == 0)
                {
                    continue;
                }

                foreach (var app in lst)
                {
                    Tuple <string, BitmapSource> sci;
                    if ((sci = Utils.GetExecutableInfo(app)) != null)
                    {
                        DestinationsListViewItemCollection.Add(new DestinationListViewItem
                        {
                            ID        = alt.Key + "|" + app,
                            Icon      = sci.Item2,
                            Name      = DownloadLinksPage.CleanExeName(sci.Item1) + " for " + alt.Key,
                            Type      = "Alternative local associations",
                            GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application.png"
                        });
                    }
                    else
                    {
                        DestinationsListViewItemCollection.Add(new DestinationListViewItem
                        {
                            ID        = alt.Key + "|" + app,
                            Icon      = "pack://application:,,,/RSTVShowTracker;component/Images/exclamation.png",
                            Name      = Path.GetFileName(app) + " for " + alt.Key + " [File not found!]",
                            Type      = "Alternative local associations",
                            GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/application.png"
                        });
                    }
                }
            }

            // load senders

            var senders = Extensibility.GetNewInstances <SenderEngine>().ToList();

            foreach (var dest in Settings.Get <Dictionary <string, object> >("Sender Destinations"))
            {
                var conf = (Dictionary <string, object>)dest.Value;
                Uri uri;
                DestinationsListViewItemCollection.Add(new DestinationListViewItem
                {
                    ID        = dest.Key,
                    Icon      = senders.First(s => s.Name == (string)conf["Sender"]).Icon,
                    Name      = (string)conf["Sender"] + " at " + (Uri.TryCreate((string)conf["Location"], UriKind.Absolute, out uri) ? uri.DnsSafeHost + ":" + uri.Port : (string)conf["Location"]),
                    Type      = "Remote servers",
                    GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/server-cast.png"
                });
            }

            // load folders

            foreach (var alt in Settings.Get <Dictionary <string, object> >("Folder Destinations"))
            {
                var lst = (List <string>)alt.Value;

                if (lst == null || lst.Count == 0)
                {
                    continue;
                }

                foreach (var app in lst)
                {
                    if (Directory.Exists(app))
                    {
                        DestinationsListViewItemCollection.Add(new DestinationListViewItem
                        {
                            ID        = alt.Key + "|" + app,
                            Icon      = "pack://application:,,,/RSTVShowTracker;component/Images/folder-open-document.png",
                            Name      = Path.GetFileName(app) + " for " + alt.Key,
                            Type      = "Folder destinations",
                            GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/folder.png"
                        });
                    }
                    else
                    {
                        DestinationsListViewItemCollection.Add(new DestinationListViewItem
                        {
                            ID        = alt.Key + "|" + app,
                            Icon      = "pack://application:,,,/RSTVShowTracker;component/Images/exclamation.png",
                            Name      = Path.GetFileName(app) + " for " + alt.Key + " [Folder not found!]",
                            Type      = "Folder destinations",
                            GroupIcon = "pack://application:,,,/RSTVShowTracker;component/Images/folder.png"
                        });
                    }
                }
            }

            DestinationsListViewSelectionChanged();
        }
示例#32
0
        /// <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(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
        {
            // proper implementation of this method should test the connection mode (this time for anything other than ext_DisconnectMode.ext_dm_HostShutdown)
              // and forward the incoming System.Array to our implementation of OnBeginShutdown()
              if (disconnectMode != ext_DisconnectMode.ext_dm_HostShutdown)
              {
            OnBeginShutdown(ref custom);
              }

              m_OutlookAppObj = null;
        }
示例#33
0
 /// <summary>
 ///      Implements the OnConnection method of the IDTExtensibility2 interface.
 ///      Receives notification that the Add-in is being loaded.
 /// </summary>
 /// <param term='application'>
 ///      Root object of the host application.
 /// </param>
 /// <param term='connectMode'>
 ///      Describes how the Add-in is being loaded.
 /// </param>
 /// <param term='addInInst'>
 ///      Object representing this Add-in.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
 {
     applicationObject = application;
     addInInstance = addInInst;
 }
示例#34
0
 public override void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom)
 {
     // Unloading custom task panes prevents the crash on Excel 2010 64-bit.
     CustomTaskPaneFactory.UnloadCustomTaskPanes();
     CustomTaskPaneFactory.DetachAddIn();
     if (Factory != null)
     {
         Marshal.ReleaseComObject(Factory);
         Factory = null;
     }
     base.OnDisconnection(RemoveMode, ref custom);
 }
示例#35
0
 /// <summary>
 /// ʵ�� IDTExtensibility2 �ӿڵ�OnConnection ����.
 /// ����ӳ��򱻼���ʱ,����֪ͨ.
 /// </summary>
 /// <param term='application'>
 ///  ����Ӧ�ó���ĸ�����
 /// </param>
 /// <param term='connectMode'>
 ///  ������ӳ������ڱ����ص����.
 /// </param>
 /// <param term='addInInst'>
 ///  ��ʾ����ӳ���Ķ���.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, 
     object addInInst, ref System.Array custom)
 {
     MessageBox.Show("CSOneNoteRibbonAddIn OnConnection");
     applicationObject = application;
     addInInstance = addInInst;
 }
 public void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref System.Array custom)
 {
 }
        /// <summary>
        /// Reloads the plugins list view.
        /// </summary>
        /// <param name="inclInternal">if set to <c>true</c> internal classes will be included too.</param>
        private void ReloadPlugins(bool inclInternal = false)
        {
            PluginsListViewItemCollection.Clear();

            var types = new[]
            {
#pragma warning disable 618
                typeof(Parsers.Guides.Guide),
                typeof(Parsers.Downloads.DownloadSearchEngine),
                typeof(Parsers.Subtitles.SubtitleSearchEngine),
                typeof(Parsers.LinkCheckers.LinkCheckerEngine),
                typeof(Parsers.OnlineVideos.OnlineVideoSearchEngine),
                typeof(Parsers.Recommendations.RecommendationEngine),
                typeof(Parsers.Social.SocialEngine),
                typeof(Parsers.WebSearch.WebSearchEngine),
                typeof(Parsers.ForeignTitles.ForeignTitleEngine),
                typeof(Parsers.Senders.SenderEngine),
                typeof(Parsers.News.FeedReaderEngine),
                typeof(ContextMenus.Menus.OverviewContextMenu),
                typeof(ContextMenus.Menus.UpcomingListingContextMenu),
                typeof(ContextMenus.Menus.EpisodeListingContextMenu),
                typeof(ContextMenus.Menus.DownloadLinkContextMenu),
                typeof(ContextMenus.Menus.SubtitleContextMenu),
                typeof(ContextMenus.Menus.StatisticsContextMenu),
                typeof(ContextMenus.Menus.RecommendationContextMenu),
                typeof(LocalProgrammingPlugin),
                typeof(Scripting.ScriptingPlugin),
                typeof(StartupPlugin),
                typeof(IPlugin)
#pragma warning restore 618
            };

            var icons = new[]
            {
                "/RSTVShowTracker;component/Images/guides.png",
                "/RSTVShowTracker;component/Images/torrents.png",
                "/RSTVShowTracker;component/Images/subtitles.png",
                "/RSTVShowTracker;component/Images/tick.png",
                "/RSTVShowTracker;component/Images/monitor.png",
                "/RSTVShowTracker;component/Images/information.png",
                "/RSTVShowTracker;component/Images/bird.png",
                "/RSTVShowTracker;component/Images/magnifier.png",
                "/RSTVShowTracker;component/Images/language.png",
                "/RSTVShowTracker;component/Images/server-cast.png",
                "/RSTVShowTracker;component/Images/feed.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/menu.png",
                "/RSTVShowTracker;component/Images/table-select-row.png",
                "/RSTVShowTracker;component/Images/code.png",
                "/RSTVShowTracker;component/Images/document-insert.png",
                "/RSTVShowTracker;component/Images/dll.gif"
            };

            foreach (var engine in Extensibility.GetNewInstances <IPlugin>(inclInternal: inclInternal).OrderBy(engine => engine.Name))
            {
                var type   = engine.GetType();
                var parent = string.Empty;
                var picon  = string.Empty;
                var i      = 0;

                foreach (var ptype in types)
                {
                    if (type.IsSubclassOf(ptype))
                    {
                        parent = ptype.Name;
                        picon  = icons[i];
                        break;
                    }

                    i++;
                }

                var file = type.Assembly.ManifestModule.Name;

                if (file == "<In Memory Module>")
                {
                    var script = Extensibility.Scripts.FirstOrDefault(s => s.Type == type);

                    if (script != null)
                    {
                        file = Path.GetFileName(script.File);
                    }
                }

                PluginsListViewItemCollection.Add(new PluginsListViewItem
                {
                    Icon    = engine.Icon,
                    Name    = engine.Name,
                    Type    = parent,
                    Icon2   = picon,
                    Version = engine.Version.ToString().PadRight(14, '0'),
                    File    = file
                });
            }
        }
示例#38
0
 /// <summary>
 ///  ʵ�� IDTExtensibility2 �ӿڵ�OnDisconnection ����.
 ///  ����ӳ���ж��ʱ,����֪ͨ.
 /// </summary>
 /// <param term='disconnectMode'>
 ///  ������ӳ������ڱ�ж�ص����.
 /// </param>
 /// <param term='custom'>
 ///  ����Ӧ�ó����ض��IJ���������.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, 
     ref System.Array custom)
 {
     MessageBox.Show("CSOneNoteRibbonAddIn OnDisconnection");
     this.applicationObject = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
示例#39
0
		/// <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(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
		{
			try
			{
				//TODO: Disconnect the add-in
			}
			catch(System.Exception e)
			{
				Mindjet.Utility.HandleError(e);
			}
		}