示例#1
0
        public override void Exec()
        {
            try
            {
                string propertyPath;
                string newValue;

                //Get PropertyPath values
                BatchPropertyUpdateForm frm = new BatchPropertyUpdateForm();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    propertyPath = frm.PropertyPath;
                    newValue     = frm.NewValue;
                }
                else
                {
                    return;
                }

                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;

                foreach (UIHierarchyItem hi in ((System.Array)solExplorer.SelectedItems))
                {
                    ProjectItem pi = (ProjectItem)hi.Object;

                    Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer
                    w.Activate();

                    IDesignerHost designer = w.Object as IDesignerHost;
                    if (designer == null)
                    {
                        continue;
                    }
                    changesvc = (IComponentChangeService)designer.GetService(typeof(IComponentChangeService));


                    EditorWindow win     = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator));
                    Package      package = win.PropertiesLinkComponent as Package;
                    if (package == null)
                    {
                        continue;
                    }
                    SetPropertyValue(package, propertyPath, newValue);

                    SSISHelpers.MarkPackageDirty(package); //for now always mark it as dirty

                    //ApplicationObject.ActiveDocument.Save(null);
                    //w.Close(vsSaveChanges.vsSaveChangesYes);
                    //w.Close(vsSaveChanges.vsSaveChangesNo); //close the designer
                    //w = pi.Open(BIDSViewKinds.Designer); //opens the designer
                    w.Activate(); //that was the quick and easy way to get the expression highlighter up to date
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + " " + ex.StackTrace);
            }
        }
        public override void Exec()
        {

            try
            {
                string propertyPath;
                string newValue;

                //Get PropertyPath values
                BatchPropertyUpdateForm frm = new BatchPropertyUpdateForm();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    propertyPath = frm.PropertyPath;
                    newValue = frm.NewValue;
                }
                else
                {
                    return;
                }

                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;

                foreach (UIHierarchyItem hi in ((System.Array)solExplorer.SelectedItems))
                {
                    ProjectItem pi = (ProjectItem)hi.Object;

                    Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer
                    w.Activate();

                    IDesignerHost designer = w.Object as IDesignerHost;
                    if (designer == null) continue;
                    changesvc = (IComponentChangeService)designer.GetService(typeof(IComponentChangeService));


                    EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator));
                    Package package = win.PropertiesLinkComponent as Package;
                    if (package == null) continue;
                    SetPropertyValue(package, propertyPath, newValue);

                    SSISHelpers.MarkPackageDirty(package); //for now always mark it as dirty

                    //ApplicationObject.ActiveDocument.Save(null);
                    //w.Close(vsSaveChanges.vsSaveChangesYes);
                    //w.Close(vsSaveChanges.vsSaveChangesNo); //close the designer
                    //w = pi.Open(BIDSViewKinds.Designer); //opens the designer
                    w.Activate(); //that was the quick and easy way to get the expression highlighter up to date
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + " " + ex.StackTrace);
            }
        }