public override void OnDisable() { base.OnDisable(); foreach (EditorWindow win in windowHandlesFixedDeployPerspectives.Values) { win.ActiveViewChanged -= win_ActiveViewChanged; VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); if (toolbar != null) { toolbar.ButtonClick -= toolbar_ButtonClick; if (newDeployPerspectivesButton != null) { if (toolbar.Buttons.ContainsKey(newDeployPerspectivesButton.Name)) { toolbar.Buttons.RemoveByKey(newDeployPerspectivesButton.Name); } if (newSeparatorButton != null) { if (toolbar.Buttons.ContainsKey(newSeparatorButton.Name)) { toolbar.Buttons.RemoveByKey(newSeparatorButton.Name); } } } } } }
public override void OnWindowActivated(Window GotFocus, Window LostFocus) { try { if (GotFocus == null) { return; } IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) { return; } ProjectItem pi = GotFocus.ProjectItem; if ((pi == null) || (!(pi.Object is Cube))) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); IntPtr ptr = win.Handle; string sHandle = ptr.ToInt64().ToString(); if (!windowHandlesFixedDeployPerspectives.ContainsKey(sHandle)) { windowHandlesFixedDeployPerspectives.Add(sHandle, win); win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); } if (pi.Name.ToLower().EndsWith(".cube") && win.SelectedView.MenuItemCommandID.ID == 12904) //language neutral way of saying win.SelectedView.Caption == "Perspectives" { if (!toolbar.Buttons.ContainsKey(this.FullName + ".DeployPerspectives")) { newSeparatorButton = new ToolBarButton(); newSeparatorButton.Name = this.FullName + ".Separator"; newSeparatorButton.Style = ToolBarButtonStyle.Separator; if (Connect.Plugins[DeployMDXScriptPlugin.BaseName + typeof(DeployPerspectivesPlugin).Name].Enabled) { toolbar.ImageList.Images.Add(BIDSHelper.Resources.Common.DeployPerspectivesIcon); newDeployPerspectivesButton = new ToolBarButton(); newDeployPerspectivesButton.ToolTipText = this.ButtonText + " (BIDS Helper)"; newDeployPerspectivesButton.Name = this.FullName + ".DeployPerspectives"; newDeployPerspectivesButton.Tag = newDeployPerspectivesButton.Name; newDeployPerspectivesButton.ImageIndex = toolbar.ImageList.Images.Count - 1; newDeployPerspectivesButton.Enabled = true; newDeployPerspectivesButton.Style = ToolBarButtonStyle.PushButton; toolbar.Buttons.Add(newSeparatorButton); toolbar.Buttons.Add(newDeployPerspectivesButton); //catch the button clicks of the new buttons we just added toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick); } } } } catch { } }
public Control CreatePerformanceTabControl(VsStyleToolBar pageViewToolBar) { SSIS.PerformanceVisualization.PerformanceTab tab = new SSIS.PerformanceVisualization.PerformanceTab(); tab.LayoutToolBar(pageViewToolBar); tab.Init(win, view, projectItem, DataFlowGUID); PerformanceVisualizationPlugin.PerformanceEditorViews.Add(win, tab); return(tab); }
public override void OnDisable() { base.OnDisable(); foreach (EditorWindow win in windowHandlesFixedDefaultCalcScriptView.Values) { win.ActiveViewChanged -= win_ActiveViewChanged; // get toolbar and remove click handlers } foreach (EditorWindow win in windowHandlesFixedForCalcProperties.Values) { win.ActiveViewChanged -= win_ActiveViewChanged; VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); if (toolbar != null) { toolbar.Click -= toolbar_Click; toolbar.ButtonClick -= toolbar_ButtonClick; if (newCalcPropButton != null) { if (toolbar.Buttons.ContainsKey(newCalcPropButton.Name)) { toolbar.Buttons.RemoveByKey(newCalcPropButton.Name); } // make the standard properties button visible foreach (ToolBarButton b in toolbar.Buttons) { if (b.ToolTipText.StartsWith("Calculation Properties")) { if (b.Tag == null || b.Tag.ToString() != this.FullName + ".CommandProperties") { b.Visible = true; } } } } if (newDeployMdxScriptButton != null) { if (toolbar.Buttons.ContainsKey(newDeployMdxScriptButton.Name)) { toolbar.Buttons.RemoveByKey(newDeployMdxScriptButton.Name); } } } } }
public override void OnWindowActivated(Window GotFocus, Window LostFocus) { try { if (GotFocus == null) { return; } IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) { return; } ProjectItem pi = GotFocus.ProjectItem; if (!(pi.Object is Cube)) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(IComponentNavigator)); VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); IntPtr ptr = win.Handle; string sHandle = ptr.ToInt64().ToString(); if (!windowHandlesFixedPartitionsView.ContainsKey(sHandle)) { windowHandlesFixedPartitionsView.Add(sHandle, win); win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); } //if (win.SelectedView.Caption == "Partitions") if (win.SelectedView.MenuItemCommandID.ID == (int)BIDSViewMenuItemCommandID.Partitions) { if (!toolbar.Buttons.ContainsKey(this.FullName + "." + SET_ESTIMATED_COUNTS_BUTTON)) { ToolBarButton separator = new ToolBarButton(); separator.Style = ToolBarButtonStyle.Separator; toolbar.Buttons.Add(separator); toolbar.ImageList.Images.Add(SET_ESTIMATED_COUNTS_ICON_KEY, BIDSHelper.Resources.Common.EstimatedCounts); ToolBarButton oSetAllEstimatedCountsButton = new ToolBarButton(); oSetAllEstimatedCountsButton.ToolTipText = "Update All Estimated Counts (BIDS Helper)"; oSetAllEstimatedCountsButton.Name = this.FullName + "." + SET_ESTIMATED_COUNTS_BUTTON; oSetAllEstimatedCountsButton.Tag = oSetAllEstimatedCountsButton.Name; oSetAllEstimatedCountsButton.ImageIndex = toolbar.ImageList.Images.IndexOfKey(SET_ESTIMATED_COUNTS_ICON_KEY); oSetAllEstimatedCountsButton.Enabled = true; oSetAllEstimatedCountsButton.Style = ToolBarButtonStyle.PushButton; toolbar.Buttons.Add(oSetAllEstimatedCountsButton); toolbar.ImageList.Images.Add(EDIT_AGGREGATIONS_ICON_KEY, BIDSHelper.Resources.Common.EditAggregations); ToolBarButton oEditAggregationsButton = new ToolBarButton(); oEditAggregationsButton.ToolTipText = "Edit Aggregations (BIDS Helper)"; oEditAggregationsButton.Name = this.FullName + "." + EDIT_AGGREGATIONS_BUTTON_SUFFIX; oEditAggregationsButton.Tag = oEditAggregationsButton.Name; oEditAggregationsButton.ImageIndex = toolbar.ImageList.Images.IndexOfKey(EDIT_AGGREGATIONS_ICON_KEY); oEditAggregationsButton.Enabled = true; oEditAggregationsButton.Style = ToolBarButtonStyle.PushButton; toolbar.Buttons.Add(oEditAggregationsButton); if (pi.Name.ToLower().EndsWith(".cube")) //checking the file extension is adequate because this feature is not needed for in online mode (when live connected to the server) { toolbar.ImageList.Images.Add(DEPLOY_AGGREGATION_DESIGNS_ICON_KEY, BIDSHelper.Resources.Common.DeployAggDesignsIcon); ToolBarButton oDeployAggDesignsButton = new ToolBarButton(); oDeployAggDesignsButton.ToolTipText = "Deploy Aggregation Designs (BIDS Helper)"; oDeployAggDesignsButton.Name = this.FullName + "." + DEPLOY_AGGREGATION_DESIGNS_BUTTON; oDeployAggDesignsButton.Tag = oDeployAggDesignsButton.Name; oDeployAggDesignsButton.ImageIndex = toolbar.ImageList.Images.IndexOfKey(DEPLOY_AGGREGATION_DESIGNS_ICON_KEY); oDeployAggDesignsButton.Enabled = true; oDeployAggDesignsButton.Style = ToolBarButtonStyle.PushButton; toolbar.Buttons.Add(oDeployAggDesignsButton); } toolbar.ImageList.Images.Add(STOP_ICON_KEY, BIDSHelper.Resources.Common.Stop); //catch the button clicks of the new buttons we just added toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick); } } } catch { } }
public override void OnWindowActivated(Window GotFocus, Window LostFocus) { try { if (GotFocus == null) { return; } IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) { return; } ProjectItem pi = GotFocus.ProjectItem; if ((pi == null) || (!(pi.Object is Cube))) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); IntPtr ptr = win.Handle; string sHandle = ptr.ToInt64().ToString(); if (!windowHandlesFixedForM2M.ContainsKey(sHandle)) { windowHandlesFixedForM2M.Add(sHandle, win); win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); } if (win.SelectedView.MenuItemCommandID.ID == 12898) //language neutral way of saying win.SelectedView.Caption == "Dimension Usage" { if (!toolbar.Buttons.ContainsKey(this.FullName + ".M2M")) { newSeparatorButton = new ToolBarButton(); newSeparatorButton.Name = this.FullName + ".Separator"; newSeparatorButton.Style = ToolBarButtonStyle.Separator; toolbar.ImageList.Images.Add(BIDSHelper.Resources.Common.M2MIcon); newM2MButton = new ToolBarButton(); newM2MButton.ToolTipText = this.FeatureName + " (BIDS Helper)"; newM2MButton.Name = this.FullName + ".M2M"; newM2MButton.Tag = newM2MButton.Name; newM2MButton.ImageIndex = toolbar.ImageList.Images.Count - 1; newM2MButton.Enabled = true; newM2MButton.Style = ToolBarButtonStyle.PushButton; if (BIDSHelperPackage.Plugins[BaseName + typeof(PrinterFriendlyDimensionUsagePlugin).Name].Enabled) { toolbar.ImageList.Images.Add(BIDSHelper.Resources.Common.PrinterFriendlyDimensionUsageIcon); newPrintFriendlyButton = new ToolBarButton(); newPrintFriendlyButton.ToolTipText = "Printer Friendly Dimension Usage (BIDS Helper)"; newPrintFriendlyButton.Name = this.FullName + ".PrintFriendly"; newPrintFriendlyButton.Tag = newPrintFriendlyButton.Name; newPrintFriendlyButton.ImageIndex = toolbar.ImageList.Images.Count - 1; newPrintFriendlyButton.Enabled = true; newPrintFriendlyButton.Style = ToolBarButtonStyle.PushButton; } //catch the button clicks of the new buttons we just added toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick); } if (newM2MButton != null && !toolbar.Buttons.Contains(newM2MButton)) { toolbar.Buttons.Add(newSeparatorButton); toolbar.Buttons.Add(newM2MButton); } if (newPrintFriendlyButton != null && !toolbar.Buttons.Contains(newPrintFriendlyButton)) { toolbar.Buttons.Add(newPrintFriendlyButton); } } } catch { } }
public override void OnWindowActivated(Window GotFocus, Window LostFocus) { try { package.Log.Debug("TriStatPerspectives OnWindowActivated fired"); if (GotFocus == null) { return; } IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) { return; } ProjectItem pi = GotFocus.ProjectItem; if ((pi == null) || (!(pi.Object is Cube))) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); Cube cube = (Cube)pi.Object; IntPtr ptr = win.Handle; string sHandle = ptr.ToInt64().ToString(); if (!windowHandlesFixedForPerspectives.ContainsKey(sHandle)) { windowHandlesFixedForPerspectives.Add(sHandle, win); win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); } //if (win.SelectedView.Caption == "Perspectives") if (win.SelectedView.MenuItemCommandID.ID == (int)BIDSViewMenuItemCommandID.Perspectives) { Microsoft.AnalysisServices.Design.Scripts mdxScriptCache = new Microsoft.AnalysisServices.Design.Scripts(cube); Control perspectiveBuilder = (Control)win.SelectedView.GetType().InvokeMember("ViewControl", getflags, null, win.SelectedView, null); //Microsoft.AnalysisServices.Design.PerspectivesBuilder Control grid = perspectiveBuilder.Controls[0]; //Microsoft.SqlServer.Management.UI.Grid.DlgGridControl if (!windowHandlesFixedForGridEvents.ContainsKey(sHandle)) { grid.MouseClick += new MouseEventHandler(grid_MouseClick); grid.KeyPress += new KeyPressEventHandler(grid_KeyPress); #if !(YUKON || KATMAI) _IsMetroOrGreater = VisualStudioHelpers.IsMetroOrGreater(win); HookCellPaintEvent(grid, true); #endif windowHandlesFixedForGridEvents.Add(sHandle, win); } System.Reflection.BindingFlags getpropertyflags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; object dlgStorage = null; #if !(YUKON) dlgStorage = grid.GetType().BaseType.BaseType.InvokeMember("DlgStorage", getpropertyflags, null, grid, null); #else dlgStorage = grid.GetType().BaseType.InvokeMember("DlgStorage", getpropertyflags, null, grid, null); //Microsoft.SqlServer.Management.UI.Grid.IDlgStorage #endif object storage = dlgStorage.GetType().InvokeMember("Storage", getpropertyflags, null, dlgStorage, null); //Microsoft.SqlServer.Management.UI.Grid.MemDataStorage System.Reflection.BindingFlags getfieldflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; ArrayList rows = (ArrayList)storage.GetType().BaseType.InvokeMember("m_arrRows", getfieldflags, null, storage, new object[] { }); //ArrayList columns = (ArrayList)storage.GetType().BaseType.InvokeMember("m_arrColumns", getfieldflags, null, storage, new object[] { }); object[] perspectivesColumns = (object[])rows[0]; ArrayList allGridCubeObjects = (ArrayList)perspectiveBuilder.GetType().InvokeMember("allGridCubeObjects", getfieldflags, null, perspectiveBuilder, null); for (int i = 3; i < rows.Count; i++) { object[] columns = (object[])rows[i]; object cell = columns[2]; //Microsoft.SqlServer.Management.UI.Grid.GridCell string rowObjectType = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); if (rowObjectType == "MeasureGroup") { cell = columns[1]; string rowObjectName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); MeasureGroup mg = cube.MeasureGroups.GetByName(rowObjectName); for (int j = 3; j < columns.Length; j += 2) { cell = perspectivesColumns[j + 1]; string perspectiveName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); Perspective perspective = cube.Perspectives.GetByName(perspectiveName); cell = columns[j]; bool bHighlight = false; if (perspective.MeasureGroups.Contains(mg.ID)) { PerspectiveMeasureGroup pmg = perspective.MeasureGroups[mg.ID]; foreach (Measure m in mg.Measures) { if (m.Visible && !pmg.Measures.Contains(m.ID)) { bHighlight = true; break; } } } HighlightCell(bHighlight, columns, cell, j); } } else if (rowObjectType == "CubeDimension") { cell = columns[1]; string rowObjectName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); CubeDimension cd = cube.Dimensions.GetByName(rowObjectName); for (int j = 3; j < columns.Length; j += 2) { cell = perspectivesColumns[j + 1]; string perspectiveName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); Perspective perspective = cube.Perspectives.GetByName(perspectiveName); cell = columns[j]; bool bHighlight = false; if (perspective.Dimensions.Contains(cd.ID)) { PerspectiveDimension pcd = perspective.Dimensions[cd.ID]; foreach (CubeHierarchy h in cd.Hierarchies) { if (h.Visible && h.Enabled && !pcd.Hierarchies.Contains(h.HierarchyID)) { bHighlight = true; break; } } if (!bHighlight) { foreach (CubeAttribute a in cd.Attributes) { if (a.AttributeHierarchyVisible && a.AttributeHierarchyEnabled && a.Attribute.AttributeHierarchyVisible && a.Attribute.AttributeHierarchyEnabled && !pcd.Attributes.Contains(a.AttributeID)) { bHighlight = true; break; } } } } HighlightCell(bHighlight, columns, cell, j); } } else if (rowObjectType == "Kpi") { cell = columns[1]; string rowObjectName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); rowObjectName = rowObjectName.Trim(); Kpi kpi = cube.Kpis.GetByName(rowObjectName); for (int j = 3; j < columns.Length; j += 2) { cell = perspectivesColumns[j + 1]; string perspectiveName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); Perspective perspective = cube.Perspectives.GetByName(perspectiveName); cell = columns[j]; bool bHighlight = false; if (perspective.Kpis.Contains(kpi.ID)) { PerspectiveKpi pkpi = perspective.Kpis[kpi.ID]; bHighlight = ShouldPerspectiveKpiBeHighlighted(pkpi, mdxScriptCache); } HighlightCell(bHighlight, columns, cell, j); } } else if (rowObjectType.EndsWith("Action")) { cell = columns[1]; string rowObjectName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); rowObjectName = rowObjectName.Trim(); Microsoft.AnalysisServices.Action action = cube.Actions.GetByName(rowObjectName); for (int j = 3; j < columns.Length; j += 2) { cell = perspectivesColumns[j + 1]; string perspectiveName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); Perspective perspective = cube.Perspectives.GetByName(perspectiveName); cell = columns[j]; bool bHighlight = false; if (perspective.Actions.Contains(action.ID)) { bHighlight = true; if (action.TargetType == ActionTargetType.DimensionMembers) { foreach (PerspectiveDimension dim in perspective.Dimensions) { if (string.Compare(action.Target, "[" + dim.CubeDimension.Name + "]", true) == 0) { bHighlight = false; break; } } } else if (action.TargetType == ActionTargetType.AttributeMembers || action.TargetType == ActionTargetType.HierarchyMembers) { foreach (PerspectiveDimension dim in perspective.Dimensions) { foreach (PerspectiveAttribute attr in dim.Attributes) { if (string.Compare(action.Target, "[" + attr.Parent.CubeDimension.Name + "].[" + attr.Attribute.Name + "]", true) == 0) { bHighlight = false; break; } } } } else if (action.TargetType == ActionTargetType.Level || action.TargetType == ActionTargetType.LevelMembers) { foreach (PerspectiveDimension dim in perspective.Dimensions) { foreach (PerspectiveHierarchy hier in dim.Hierarchies) { foreach (Level level in hier.Hierarchy.Levels) { if (string.Compare(action.Target, "[" + hier.Parent.CubeDimension.Name + "].[" + hier.Hierarchy.Name + "].[" + level.Name + "]", true) == 0) { bHighlight = false; break; } } } } } else if (action.TargetType == ActionTargetType.HierarchyMembers) { foreach (PerspectiveDimension dim in perspective.Dimensions) { foreach (PerspectiveHierarchy hier in dim.Hierarchies) { if (string.Compare(action.Target, "[" + hier.Parent.CubeDimension.Name + "].[" + hier.Hierarchy.Name + "]", true) == 0) { bHighlight = false; break; } } } } else { bHighlight = false; } } HighlightCell(bHighlight, columns, cell, j); } } else if (rowObjectType == "CalculatedMember") { cell = columns[1]; string rowObjectName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); rowObjectName = rowObjectName.Trim(); for (int j = 3; j < columns.Length; j += 2) { cell = perspectivesColumns[j + 1]; string perspectiveName = (string)cell.GetType().InvokeMember("CellData", getpropertyflags, null, cell, null); Perspective perspective = cube.Perspectives.GetByName(perspectiveName); cell = columns[j]; Microsoft.AnalysisServices.Design.Script calc = (Microsoft.AnalysisServices.Design.Script)allGridCubeObjects[i].GetType().InvokeMember("Object", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetField, null, allGridCubeObjects[i], null); if (CalcIsHidden(calc)) { continue; } bool bHighlight = false; if (calc != null && calc.CalculationProperty != null && perspective.Calculations.Contains(calc.CalculationProperty.CalculationReference) && !CalcIsHidden(calc)) { if (!string.IsNullOrEmpty(calc.CalculationProperty.AssociatedMeasureGroupID)) { if (!perspective.MeasureGroups.Contains(calc.CalculationProperty.AssociatedMeasureGroupID)) { bHighlight = true; } } } HighlightCell(bHighlight, columns, cell, j); } } } grid.Refresh(); } } catch { } }
public Control CreatePerformanceTabControl(VsStyleToolBar pageViewToolBar) { SSIS.PerformanceVisualization.PerformanceTab tab = new SSIS.PerformanceVisualization.PerformanceTab(); tab.LayoutToolBar(pageViewToolBar); tab.Init(win, view, projectItem, DataFlowGUID); PerformanceVisualizationPlugin.PerformanceEditorViews.Add(win, tab); return tab; }
public override void OnWindowActivated(Window GotFocus, Window LostFocus) { try { if (GotFocus == null) { return; } IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) { return; } ProjectItem pi = GotFocus.ProjectItem; if ((pi == null) || (!(pi.Object is Cube))) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); VsStyleToolBar toolbar = (VsStyleToolBar)win.SelectedView.GetType().InvokeMember("ToolBar", getflags, null, win.SelectedView, null); IntPtr ptr = win.Handle; string sHandle = ptr.ToInt64().ToString(); if (!windowHandlesFixedForCalcProperties.ContainsKey(sHandle)) { windowHandlesFixedForCalcProperties.Add(sHandle, win); win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); } if (win.SelectedView.MenuItemCommandID.ID == 12899) //if (win.SelectedView.Caption == "Calculations") { int iMicrosoftCalcPropertiesIndex = 0; bool bFlipScriptViewButton = false; foreach (ToolBarButton b in toolbar.Buttons) { Microsoft.DataWarehouse.Controls.MenuCommandToolBarButton tbb = b as Microsoft.DataWarehouse.Controls.MenuCommandToolBarButton; if (tbb != null && tbb.AssociatedCommandID.ID == (int)BIDSToolbarButtonID.CalculationProperties) //if (b.ToolTipText.StartsWith("Calculation Properties")) { if (b.Tag == null || b.Tag.ToString() != this.FullName + ".CommandProperties") { if (!toolbar.Buttons.ContainsKey(this.FullName + ".CommandProperties")) { //if we haven't created it yet iMicrosoftCalcPropertiesIndex = toolbar.Buttons.IndexOf(b); b.Visible = false; newCalcPropButton = new ToolBarButton(); newCalcPropButton.ToolTipText = "Calculation Properties (BIDS Helper)"; newCalcPropButton.Name = this.FullName + ".CommandProperties"; newCalcPropButton.Tag = newCalcPropButton.Name; #if KATMAI || DENALI || SQL2014 newCalcPropButton.ImageIndex = 12; #else newCalcPropButton.ImageIndex = 11; #endif newCalcPropButton.Enabled = true; newCalcPropButton.Style = ToolBarButtonStyle.PushButton; toolbar.ImageList.Images.Add(BIDSHelper.Resources.Common.DeployMdxScriptIcon); if (pi.Name.ToLower().EndsWith(".cube")) //only show feature if we're in offline mode { // TODO - does not disable if Deploy plugin is disabled after the button has been added if (Connect.Plugins[DeployMDXScriptPlugin.BaseName + typeof(DeployMDXScriptPlugin).Name].Enabled) { newDeployMdxScriptButton = new ToolBarButton(); newDeployMdxScriptButton.ToolTipText = "Deploy MDX Script (BIDS Helper)"; newDeployMdxScriptButton.Name = this.FullName + ".DeployMdxScript"; newDeployMdxScriptButton.Tag = newDeployMdxScriptButton.Name; newDeployMdxScriptButton.ImageIndex = toolbar.ImageList.Images.Count - 1; newDeployMdxScriptButton.Enabled = true; newDeployMdxScriptButton.Style = ToolBarButtonStyle.PushButton; } } //catch the button clicks of the new buttons we just added toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick); //catch the mouse clicks... the only way to catch the button click for the Microsoft buttons toolbar.Click += new EventHandler(toolbar_Click); } } } else if (tbb != null && tbb.AssociatedCommandID.ID == 12854 && ScriptViewDefault && !windowHandlesFixedDefaultCalcScriptView.ContainsKey(sHandle)) //else if (b.ToolTipText == "Form View" && ScriptViewDefault && !windowHandlesFixedDefaultCalcScriptView.ContainsKey(sHandle)) //12854 { Control control = (Control)win.SelectedView.GetType().InvokeMember("ViewControl", getflags, null, win.SelectedView, null); System.Reflection.BindingFlags getfieldflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; object controlMgr = control.GetType().InvokeMember("calcControlMgr", getfieldflags, null, control, null); System.Reflection.BindingFlags getmethodflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; controlMgr.GetType().InvokeMember("ViewScript", getmethodflags, null, controlMgr, new object[] { }); bFlipScriptViewButton = true; b.Pushed = false; windowHandlesFixedDefaultCalcScriptView.Add(sHandle, win); } else if (tbb != null && tbb.AssociatedCommandID.ID == (int)BIDSHelper.BIDSToolbarButtonID.ScriptView && bFlipScriptViewButton) //12853 //else if (b.ToolTipText == "Script View" && bFlipScriptViewButton) //12853 { b.Pushed = true; } } if (newDeployMdxScriptButton != null && !toolbar.Buttons.Contains(newDeployMdxScriptButton)) { toolbar.Buttons.Insert(iMicrosoftCalcPropertiesIndex, newDeployMdxScriptButton); } if (newCalcPropButton != null && !toolbar.Buttons.Contains(newCalcPropButton)) { toolbar.Buttons.Insert(iMicrosoftCalcPropertiesIndex, newCalcPropButton); } } } catch { } }