Exemple #1
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;
        }
        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;
        }