Пример #1
0
        private void showToolWindow()
        {
            const string toolwindowGuid      = "{6CCD0EE9-20DB-4636-9149-665A958D8A9A}";
            object       myUserControlObject = null;

            try
            {
                if (_myToolWindow == null)                 // First time, create it
                {
                    EnvDTE80.Windows2 windows2 = (EnvDTE80.Windows2)_applicationObject.Windows;

                    string assembly = System.Reflection.Assembly.GetExecutingAssembly().Location;

                    _myToolWindow         = windows2.CreateToolWindow2(_addInInstance, assembly, typeof(UserControl1).FullName, "Tablar", toolwindowGuid, ref myUserControlObject);
                    _myUserControl        = (UserControl1)myUserControlObject;
                    _myUserControl.Width  = 310;
                    _myUserControl.Height = 800;
                    //_myUserControl.Dock = DockStyle.Right;
                }
                _myToolWindow.Visible = true;
                _myUserControl.Initialize(_applicationObject);
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }
        }
Пример #2
0
        public override void OnEnable()
        {
            base.OnEnable();

            RegistryKey rk = Registry.CurrentUser.OpenSubKey(Connect.REGISTRY_BASE_PATH + "\\" + REGISTRY_EXTENDED_PATH);
            bool        windowIsVisible = false;

            if (rk != null)
            {
                windowIsVisible = (1 == (int)rk.GetValue(REGISTRY_SETTING_NAME, 0));
                rk.Close();
            }

            processPackage = new System.ComponentModel.BackgroundWorker();
            processPackage.WorkerReportsProgress      = true;
            processPackage.WorkerSupportsCancellation = true;
            processPackage.DoWork             += new System.ComponentModel.DoWorkEventHandler(processPackage_DoWork);
            processPackage.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(processPackage_ProgressChanged);
            processPackage.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(processPackage_RunWorkerCompleted);

            object programmableObject = null;

            //This guid must be unique for each different tool window,
            // but you may use the same guid for the same tool window.
            //This guid can be used for indexing the windows collection,
            // for example: applicationObject.Windows.Item(guidstr)
            String guidstr = "{6679390F-A712-40EA-8729-E2184A1436BF}";

            EnvDTE80.Windows2          windows2 = (EnvDTE80.Windows2) this.ApplicationObject.Windows;
            System.Reflection.Assembly asm      = System.Reflection.Assembly.GetExecutingAssembly();
            toolWindow           = windows2.CreateToolWindow2(this.AddInInstance, asm.Location, "BIDSHelper.SSIS.ExpressionListControl", "Expressions", guidstr, ref programmableObject);
            expressionListWindow = (ExpressionListControl)programmableObject;
            expressionListWindow.RefreshExpressions     += new EventHandler(expressionListWindow_RefreshExpressions);
            expressionListWindow.EditExpressionSelected += new EventHandler <EditExpressionSelectedEventArgs>(expressionListWindow_EditExpressionSelected);

            // Set the picture displayed when the window is tab docked
            // Clean build required when switching between VS 2005 and VS 2008
            // during testing, otherwise we get some strange behaviour with this
            IntPtr icon = BIDSHelper.Resources.Common.ExpressionListIcon.ToBitmap().GetHbitmap();

#if KATMAI || DENALI || SQL2014
            toolWindow.SetTabPicture(icon.ToInt32());
#else
            toolWindow.SetTabPicture(icon);
#endif

            //if (windowIsVisible)
            //    toolWindow.Visible = true;
        }
Пример #3
0
        /// <summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary>
        /// <param term='custom'>Array of parameters that are host application specific.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnStartupComplete(ref Array custom)
        {
            Window _windowToolWindow;

            object programmableObject = null;

            //This guid must be unique for each different tool window,
            // but you may use the same guid for the same tool window.
            //This guid can be used for indexing the windows collection,
            // for example: applicationObject.Windows.Item(guidstr)
            String guidstr = "{B3C2874F-99E6-49a3-8B89-BFE3336CC1B0}";

            EnvDTE80.Windows2          windows2 = (EnvDTE80.Windows2)_applicationObject.Windows;
            System.Reflection.Assembly asm      = System.Reflection.Assembly.GetExecutingAssembly();
            _windowToolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "CcdAddIn.CcdGradeControl", "CCD Wertesystem", guidstr, ref programmableObject);

            //Set the picture displayed when the window is tab docked

            //When using the hosting control, you must set visible to true before calling HostUserControl,
            // otherwise the UserControl cannot be hosted properly.
            _windowToolWindow.Visible = true;
        }
Пример #4
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, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
            {
                applicationObject = (DTE2)application;
                addInInstance     = (AddIn)addInInst;

                object tempObject = null;

                var controlName = "MSILWindow.Window.WindowControl";

                // Change this to your path
                var assemblyPath = @"C:\Users\filip.ekberg\Documents\GitHub\MSILWindow\MSILWindow.Window\bin\Debug\MSILWindow.Window.dll";
                var controlGuid  = "{6d0f6084-69ef-4100-92c5-5e7e3a557e05}";

                toolWins = (Windows2)applicationObject.Windows;

                toolWin = toolWins.CreateToolWindow2(addInInstance,
                                                     assemblyPath, controlName, "Real-time MSIL Viewer", controlGuid,
                                                     ref tempObject);

                if (toolWin != null)
                {
                    toolWin.Visible = true;
                }

                events                        = applicationObject.Events;
                buildEvents                   = events.BuildEvents;
                buildEvents.OnBuildDone      += BuildEvents_OnBuildDone;
                textEditorEvents              = events.get_TextEditorEvents();
                textEditorEvents.LineChanged += Connect_LineChanged;

                serviceProxy = ChannelFactory <ICommandService> .CreateChannel(new NetNamedPipeBinding(), serviceAddress);
            }
            catch { }
        }