public override IDiagramActionInstance CreateActionInstance(IEnumerable <IDiagramObject> targets, bool forceExecutionWithConfirmSkipped)
        {
            System.Reflection.ConstructorInfo constructor = TYPE_DIAGRAM_ACTION_INSTANCE.GetConstructor(new Type[] { typeof(IDiagramAction) });
            IDiagramActionInstance            instance    = (IDiagramActionInstance)constructor.Invoke(new object[] { this });

            TYPE_DIAGRAM_ACTION_INSTANCE.InvokeMember("Targets", System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.FlattenHierarchy, null, instance, new object[] { targets });
            return(instance);
        }
            public override DiagramActionResult Do(IDiagramActionInstance actionInstance)
            {
                try
                {
                    Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow();
                    if (sandbox == null)
                    {
                        throw new Exception("Can't get Sandbox!");
                    }
                    IServiceProvider provider = TabularHelpers.GetTabularServiceProviderFromActiveWindow();

                    foreach (IDiagramNode node in actionInstance.Targets.OfType <IDiagramNode>())
                    {
                        _plugin.ExecuteSyncDescriptions(sandbox, provider, node.Text);
                    }
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error");
                }
                return(new DiagramActionResult(null, (IDiagramObject)null));
            }
 public override void Consider(IDiagramActionInstance actionInstance)
 {
 }
 public override IShowMessageRequest Confirm(IDiagramActionInstance actionInstance)
 {
     return(null);
 }
 public override void Cancel(IDiagramActionInstance actionInstance)
 {
 }
            public override DiagramActionResult Do(IDiagramActionInstance actionInstance)
            {
                try
                {
                    Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow();
                    if (sandbox == null) throw new Exception("Can't get Sandbox!");
                    IServiceProvider provider = TabularHelpers.GetTabularServiceProviderFromActiveWindow();

                    foreach (IDiagramNode node in actionInstance.Targets.OfType<IDiagramNode>())
                    {
                        _plugin.ExecuteSyncDescriptions(sandbox, provider, node.Text);
                    }
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error");
                }
                return new DiagramActionResult(null, (IDiagramObject)null);
            }
Beispiel #7
0
 public override DiagramActionResult Do(IDiagramActionInstance actionInstance)
 public override void Consider(IDiagramActionInstance actionInstance)
 {
 }
 public override IShowMessageRequest Confirm(IDiagramActionInstance actionInstance)
 {
     return null;
 }
 public override void Cancel(IDiagramActionInstance actionInstance)
 {
 }
            public override DiagramActionResult Do(IDiagramActionInstance actionInstance)
            {
                try
                {
                    IEnumerable<Tuple<string, string, string>> hierarchyLevels = this.SortHierarchyLevels(actionInstance.Targets.OfType<IDiagramNode>());

                    Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow();
                    if (sandbox == null) throw new Exception("Can't get Sandbox!");

                    string sWarning = _plugin.GetPreBuildWarning(sandbox);
                    if (sWarning != null)
                    {
                        if (MessageBox.Show(sWarning, "BIDS Helper Tabular HideMemberIf", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            _plugin.FixPreBuildWarning(sandbox);
                        }
                    }


                    Microsoft.AnalysisServices.HideIfValue currentValue = _plugin.GetHideMemberIf(hierarchyLevels);

                    form = new Form();
                    form.Icon = BIDSHelper.Resources.Common.BIDSHelper;
                    form.Text = "BIDS Helper Tabular HideMemberIf Editor";
                    form.MaximizeBox = true;
                    form.MinimizeBox = false;
                    form.Width = 400;
                    form.Height = 150;
                    form.SizeGripStyle = SizeGripStyle.Hide;
                    form.MinimumSize = new System.Drawing.Size(form.Width, form.Height);

                    Label labelAnnotation = new Label();
                    labelAnnotation.Text = "HideMemberIf:";
                    labelAnnotation.Top = 25;
                    labelAnnotation.Left = 5;
                    labelAnnotation.Width = 80;
                    labelAnnotation.Anchor = AnchorStyles.Left | AnchorStyles.Top;
                    labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    form.Controls.Add(labelAnnotation);

                    ComboBox combo = new ComboBox();
                    combo.DropDownStyle = ComboBoxStyle.DropDownList;
                    combo.Width = form.Width - 40 - labelAnnotation.Width;
                    combo.Left = labelAnnotation.Right + 5;
                    combo.Top = 25;
                    combo.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                    form.Controls.Add(combo);
                    combo.Items.AddRange(Enum.GetNames(typeof(HideIfValue)));
                    combo.SelectedIndex = combo.Items.IndexOf(currentValue.ToString());

                    labelAnnotation = new Label();
                    labelAnnotation.Text = "BIDS Helper will ProcessFull this table when you click OK.";
                    labelAnnotation.Top = combo.Bottom + 10;
                    labelAnnotation.Left = 5;
                    labelAnnotation.Width = form.Width;
                    labelAnnotation.Anchor = AnchorStyles.Left | AnchorStyles.Top;
                    labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                    form.Controls.Add(labelAnnotation);

                    Button okButton = new Button();
                    okButton.Text = "OK";
                    okButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                    okButton.Left = form.Right - okButton.Width * 2 - 40;
                    okButton.Top = form.Bottom - okButton.Height * 2 - 20;
                    okButton.Click += new EventHandler(okButton_Click);
                    form.Controls.Add(okButton);
                    form.AcceptButton = okButton;

                    Button cancelButton = new Button();
                    cancelButton.Text = "Cancel";
                    cancelButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                    cancelButton.Left = okButton.Right + 10;
                    cancelButton.Top = okButton.Top;
                    form.CancelButton = cancelButton;
                    form.Controls.Add(cancelButton);

                    DialogResult result = form.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        //build a list of HideIfValue enums the same length as the list of levels
                        HideIfValue val = (HideIfValue)Enum.Parse(typeof(HideIfValue), combo.SelectedItem.ToString());
                        List<HideIfValue> vals = new List<HideIfValue>();
                        foreach (Tuple<string, string, string> level in hierarchyLevels)
                        {
                            vals.Add(val);
                        }

                        //set the value
                        _plugin.SetHideMemberIf(sandbox, hierarchyLevels, vals);
                    }
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error");
                }
                return new DiagramActionResult(null, (IDiagramObject)null);
            }
Beispiel #12
0
            public override DiagramActionResult Do(IDiagramActionInstance actionInstance)
            {
                try
                {
                    IEnumerable <Tuple <string, string, string> > hierarchyLevels = this.SortHierarchyLevels(actionInstance.Targets.OfType <IDiagramNode>());

                    Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow();
                    if (sandbox == null)
                    {
                        throw new Exception("Can't get Sandbox!");
                    }

                    string sWarning = _plugin.GetPreBuildWarning(sandbox);
                    if (sWarning != null)
                    {
                        if (MessageBox.Show(sWarning, "BIDS Helper Tabular HideMemberIf", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            _plugin.FixPreBuildWarning(sandbox);
                        }
                    }


                    Microsoft.AnalysisServices.HideIfValue currentValue = _plugin.GetHideMemberIf(hierarchyLevels);

                    form               = new Form();
                    form.Icon          = BIDSHelper.Resources.Common.BIDSHelper;
                    form.Text          = "BIDS Helper Tabular HideMemberIf Editor";
                    form.MaximizeBox   = true;
                    form.MinimizeBox   = false;
                    form.Width         = 400;
                    form.Height        = 150;
                    form.SizeGripStyle = SizeGripStyle.Hide;
                    form.MinimumSize   = new System.Drawing.Size(form.Width, form.Height);

                    Label labelAnnotation = new Label();
                    labelAnnotation.Text      = "HideMemberIf:";
                    labelAnnotation.Top       = 25;
                    labelAnnotation.Left      = 5;
                    labelAnnotation.Width     = 80;
                    labelAnnotation.Anchor    = AnchorStyles.Left | AnchorStyles.Top;
                    labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    form.Controls.Add(labelAnnotation);

                    ComboBox combo = new ComboBox();
                    combo.DropDownStyle = ComboBoxStyle.DropDownList;
                    combo.Width         = form.Width - 40 - labelAnnotation.Width;
                    combo.Left          = labelAnnotation.Right + 5;
                    combo.Top           = 25;
                    combo.Anchor        = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                    form.Controls.Add(combo);
                    combo.Items.AddRange(Enum.GetNames(typeof(HideIfValue)));
                    combo.SelectedIndex = combo.Items.IndexOf(currentValue.ToString());

                    labelAnnotation           = new Label();
                    labelAnnotation.Text      = "BIDS Helper will ProcessFull this table when you click OK.";
                    labelAnnotation.Top       = combo.Bottom + 10;
                    labelAnnotation.Left      = 5;
                    labelAnnotation.Width     = form.Width;
                    labelAnnotation.Anchor    = AnchorStyles.Left | AnchorStyles.Top;
                    labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                    form.Controls.Add(labelAnnotation);

                    Button okButton = new Button();
                    okButton.Text   = "OK";
                    okButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                    okButton.Left   = form.Right - okButton.Width * 2 - 40;
                    okButton.Top    = form.Bottom - okButton.Height * 2 - 20;
                    okButton.Click += new EventHandler(okButton_Click);
                    form.Controls.Add(okButton);
                    form.AcceptButton = okButton;

                    Button cancelButton = new Button();
                    cancelButton.Text   = "Cancel";
                    cancelButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                    cancelButton.Left   = okButton.Right + 10;
                    cancelButton.Top    = okButton.Top;
                    form.CancelButton   = cancelButton;
                    form.Controls.Add(cancelButton);

                    DialogResult result = form.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        //build a list of HideIfValue enums the same length as the list of levels
                        HideIfValue        val  = (HideIfValue)Enum.Parse(typeof(HideIfValue), combo.SelectedItem.ToString());
                        List <HideIfValue> vals = new List <HideIfValue>();
                        foreach (Tuple <string, string, string> level in hierarchyLevels)
                        {
                            vals.Add(val);
                        }

                        //set the value
                        _plugin.SetHideMemberIf(sandbox, hierarchyLevels, vals);
                    }
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error");
                }
                return(new DiagramActionResult(null, (IDiagramObject)null));
            }