From 158cb44f0c02ac1cc34c35e9e087384233ed72ae Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Tue, 20 Aug 2019 14:10:05 +0100 Subject: [PATCH 1/4] Add Repeat Button --- .../MainControl.Designer.cs | 10 +++++++++ Xrm.Sdk.PluginRegistration/MainControl.cs | 5 ++++- Xrm.Sdk.PluginRegistration/MainControl.resx | 21 +++++++----------- .../Resources.Designer.cs | 10 +++++++++ Xrm.Sdk.PluginRegistration/Resources.resx | 3 +++ .../Resources/Repeat-All-24.png | Bin 0 -> 2417 bytes .../Resources/Repeat.png | Bin 0 -> 233 bytes .../Xrm.Sdk.PluginRegistration.csproj | 2 ++ 8 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 Xrm.Sdk.PluginRegistration/Resources/Repeat-All-24.png create mode 100644 Xrm.Sdk.PluginRegistration/Resources/Repeat.png diff --git a/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs b/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs index 9857a6d..45effa2 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs @@ -76,6 +76,7 @@ private void InitializeComponent() this.trvPlugins = new Xrm.Sdk.PluginRegistration.Controls.CrmTreeControl(); this.btnSave = new System.Windows.Forms.Button(); this.propGridEntity = new System.Windows.Forms.PropertyGrid(); + this.toolRepeat = new System.Windows.Forms.ToolStripButton(); this.mnuContextNode.SuspendLayout(); this.mnuContextGeneral.SuspendLayout(); this.grpGrid.SuspendLayout(); @@ -270,6 +271,7 @@ private void InitializeComponent() this.toolProfilerSep, this.toolUpdate, this.toolEnable, + this.toolRepeat, this.toolUnregister, this.toolCommonSep2, this.toolRefresh, @@ -526,6 +528,13 @@ private void InitializeComponent() this.propGridEntity.Size = new System.Drawing.Size(274, 407); this.propGridEntity.TabIndex = 4; // + // toolRepeat + // + this.toolRepeat.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolRepeat.Name = "toolRepeat"; + this.toolRepeat.Size = new System.Drawing.Size(47, 22); + this.toolRepeat.Text = "Re&peat"; + // // MainControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -601,5 +610,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton toolClose; private System.Windows.Forms.ToolStripButton toolExport; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton toolRepeat; } } diff --git a/Xrm.Sdk.PluginRegistration/MainControl.cs b/Xrm.Sdk.PluginRegistration/MainControl.cs index d3cb4b8..f1306bf 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.cs @@ -138,7 +138,8 @@ public MainControl() "UninstallProfiler", "Debug", "Close", - "Save"); + "Save", + "Repeat"); toolRegister.Image = imageList["Register"]; toolView.Image = imageList["View"]; @@ -149,6 +150,8 @@ public MainControl() toolUnregister.Image = imageList["Delete"]; mnuContextNodeUnregister.Image = toolUnregister.Image; + toolRepeat.Image = imageList["Repeat"]; + toolSearch.Image = imageList["Search"]; mnuContextNodeSearch.Image = toolSearch.Image; mnuContextGeneralSearch.Image = toolSearch.Image; diff --git a/Xrm.Sdk.PluginRegistration/MainControl.resx b/Xrm.Sdk.PluginRegistration/MainControl.resx index fcf2f98..360d89a 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.resx +++ b/Xrm.Sdk.PluginRegistration/MainControl.resx @@ -117,21 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + 153, 17 - - + + 291, 17 - - + + 441, 17 - - + + 17, 17 - - - - Resources\dynamics365_icon_32.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + \ No newline at end of file diff --git a/Xrm.Sdk.PluginRegistration/Resources.Designer.cs b/Xrm.Sdk.PluginRegistration/Resources.Designer.cs index a2f69e6..6f29bd7 100644 --- a/Xrm.Sdk.PluginRegistration/Resources.Designer.cs +++ b/Xrm.Sdk.PluginRegistration/Resources.Designer.cs @@ -239,6 +239,16 @@ internal static System.Drawing.Bitmap Register { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Repeat { + get { + object obj = ResourceManager.GetObject("Repeat", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Xrm.Sdk.PluginRegistration/Resources.resx b/Xrm.Sdk.PluginRegistration/Resources.resx index 8512827..5414c07 100644 --- a/Xrm.Sdk.PluginRegistration/Resources.resx +++ b/Xrm.Sdk.PluginRegistration/Resources.resx @@ -204,4 +204,7 @@ Resources\dynamics365-icon-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Resources\Repeat-All-24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Xrm.Sdk.PluginRegistration/Resources/Repeat-All-24.png b/Xrm.Sdk.PluginRegistration/Resources/Repeat-All-24.png new file mode 100644 index 0000000000000000000000000000000000000000..4c5e4bc84ed864cdcb50b293a2f72c44bf881309 GIT binary patch literal 2417 zcmcIlYe-a45I*PJ_3m|Zt=JxFNvM>%1r|nx(2vqci6kPT{z&;immoIHq9UX>mX8!9 z7sRMvMfSj-(GMg0RZ{)PM`k5jQ6!1@*vEY|b9T?RKH9dzvz$9~XTJGn?%X?Pt9R$` zuv!uOW4B7ufCDwuE}oKk-?^!F+?OlDK>)U zvJ3xAiFo4H+{LfmeXgTJ&7poGTEs!(QuE?2dv5JX7?&sGrl?1le=DQC=HwCe#~lQi zC38!Ll3Loh>M-v@XaZh!PH*{sx9&Nk5;e^*jNg(HUYp-fDJ8$Klqe>1OQywM3hzWW z35Lo(7kQy~*N*EGP6T5RZiw`AA)(Nb7fYLwAK|z>nx`1v392Q*1TT%=f+@r83=Ila z#fbuJf>cOg3Gnj#$cl-mX5hFGo}g%;M(Opuzs$+O$q0i-le!t9-@yePJ?$ z`dJLK+}sFlsm*ZASsa4-Zs@$na{DU_#r?lXSmWd_h|T zI&yJ*LEmNNf$d5CC>e90k-r0wtf8}wwA(t%Cyc49jI!@&LqMdfxW88UpbqaF(1xm1 zq9sRD^GS>qpD@YpaUMf*{PrP%*Q86gBPEA`WjfKaR6~o!7>tjXmZscKJwMD71jz## z#UzUv-~)}3Vz@+EfqOCV8~`^^{gsaNMtlPQajh{u9pm9dK@qa>9yZV9*Ae622n+Z@ zqZD;G>`2t(BxPk4sQhcX|QnMttijMI!2oS;Z2&&>gEERX4vq3*t7?H*-Ou3L` zP271S>A07hf=E!DZ<|bT9=SZ4w-8%ojfy$#lhjw>3cKJ~A#hxeCd%=zTq(|3|G}c0 z{7K6Dud^<_+vSEN%b6{^J?&CQSoS|Vr~hTvt#+szXj-Yl+r^{*W)|kc&ME<)gjMu6 rn@Zl*Et=(>ZV+?AV?tcQ9%7nDwXF4!T4K~6#1whk^K!x2AA6$+S6}hN-9%vmdKI;Vst04O9%8~^|S literal 0 HcmV?d00001 diff --git a/Xrm.Sdk.PluginRegistration/Xrm.Sdk.PluginRegistration.csproj b/Xrm.Sdk.PluginRegistration/Xrm.Sdk.PluginRegistration.csproj index 4d4f5e5..7729ac6 100644 --- a/Xrm.Sdk.PluginRegistration/Xrm.Sdk.PluginRegistration.csproj +++ b/Xrm.Sdk.PluginRegistration/Xrm.Sdk.PluginRegistration.csproj @@ -302,6 +302,8 @@ + + From f8b1f51ac886fc0e401709aac2757c9c95a9db0f Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Tue, 20 Aug 2019 15:00:39 +0100 Subject: [PATCH 2/4] Repeat functionality --- .../Forms/PluginRegistrationForm.cs | 10 +++ .../MainControl.Designer.cs | 18 +++-- Xrm.Sdk.PluginRegistration/MainControl.cs | 79 +++++++++++++++++++ 3 files changed, 99 insertions(+), 8 deletions(-) diff --git a/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs b/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs index 6294685..5746797 100644 --- a/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs +++ b/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs @@ -161,11 +161,20 @@ private void AssemblyPathControl_PathChanged(object sender, EventArgs e) } } + public void RepeatRegistration(object sender,string AssemblyFileName) + { + AssemblyPathControl.FileName = AssemblyFileName; + btnLoadAssembly_Click(sender, new EventArgs()); + btnRegister_Click(sender, new EventArgs()); + } + private void btnCancel_Click(object sender, EventArgs e) { Close(); } + public string AssemblyFileName { get; set; } + private void btnLoadAssembly_Click(object sender, EventArgs e) { if (!AssemblyPathControl.FileExists) @@ -179,6 +188,7 @@ private void btnLoadAssembly_Click(object sender, EventArgs e) CrmPluginAssembly assembly; try { + AssemblyFileName = AssemblyPathControl.FileName; assembly = RegistrationHelper.RetrievePluginsFromAssembly(AssemblyPathControl.FileName); } catch (Exception ex) diff --git a/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs b/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs index 45effa2..fac8f42 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.Designer.cs @@ -62,6 +62,7 @@ private void InitializeComponent() this.toolProfilerSep = new System.Windows.Forms.ToolStripSeparator(); this.toolUpdate = new System.Windows.Forms.ToolStripButton(); this.toolEnable = new System.Windows.Forms.ToolStripButton(); + this.toolRepeat = new System.Windows.Forms.ToolStripButton(); this.toolUnregister = new System.Windows.Forms.ToolStripButton(); this.toolCommonSep2 = new System.Windows.Forms.ToolStripSeparator(); this.toolRefresh = new System.Windows.Forms.ToolStripButton(); @@ -76,7 +77,6 @@ private void InitializeComponent() this.trvPlugins = new Xrm.Sdk.PluginRegistration.Controls.CrmTreeControl(); this.btnSave = new System.Windows.Forms.Button(); this.propGridEntity = new System.Windows.Forms.PropertyGrid(); - this.toolRepeat = new System.Windows.Forms.ToolStripButton(); this.mnuContextNode.SuspendLayout(); this.mnuContextGeneral.SuspendLayout(); this.grpGrid.SuspendLayout(); @@ -390,6 +390,15 @@ private void InitializeComponent() this.toolEnable.Visible = false; this.toolEnable.Click += new System.EventHandler(this.toolEnable_Click); // + // toolRepeat + // + this.toolRepeat.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolRepeat.Name = "toolRepeat"; + this.toolRepeat.Size = new System.Drawing.Size(47, 22); + this.toolRepeat.Text = "Re&peat"; + this.toolRepeat.Visible = false; + this.toolRepeat.Click += new System.EventHandler(this.toolRepeat_Click); + // // toolUnregister // this.toolUnregister.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -528,13 +537,6 @@ private void InitializeComponent() this.propGridEntity.Size = new System.Drawing.Size(274, 407); this.propGridEntity.TabIndex = 4; // - // toolRepeat - // - this.toolRepeat.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolRepeat.Name = "toolRepeat"; - this.toolRepeat.Size = new System.Drawing.Size(47, 22); - this.toolRepeat.Text = "Re&peat"; - // // MainControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Xrm.Sdk.PluginRegistration/MainControl.cs b/Xrm.Sdk.PluginRegistration/MainControl.cs index f1306bf..bb40f4d 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.cs @@ -1285,6 +1285,7 @@ private void SelectItem(ICrmTreeNode node) { //Reset the visibility and enabled properties because we don't what is enabled toolUpdate.Visible = false; + toolRepeat.Visible = false; mnuContextNodeUpdate.Visible = false; toolEnable.Visible = false; @@ -1330,6 +1331,9 @@ private void SelectItem(ICrmTreeNode node) btnSave.Enabled = true; //Load the data table and display information gridTable = OrganizationHelper.CreateDataTable(CrmPlugin.Columns, assembly.Plugins); + + toolRepeat.Visible = true; + } break; @@ -1700,6 +1704,8 @@ private void toolUnregister_Click(object sender, EventArgs e) } } + public string LastAssemblyFileName { get; set; } + private void toolUpdate_Click(object sender, EventArgs e) { if (IsNodeSystemItem(trvPlugins.SelectedNode)) @@ -1714,6 +1720,8 @@ private void toolUpdate_Click(object sender, EventArgs e) { var regForm = new PluginRegistrationForm(Organization, this, (CrmPluginAssembly)trvPlugins.SelectedNode); regForm.ShowDialog(ParentForm); + LastAssemblyFileName = regForm.AssemblyFileName; + LastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; } break; @@ -2353,5 +2361,76 @@ private void UpdateNodeText() } #endregion Private Classes + + public string LastRepeatedAssemblyName { get; set; } + + private void toolRepeat_Click(object sender, EventArgs e) + { + if (IsNodeSystemItem(trvPlugins.SelectedNode)) + { + ShowSystemItemError("The assembly cannot be updated."); + return; + } + + if (String.IsNullOrEmpty(LastAssemblyFileName)) + { + ShowSystemItemError("Please register the assembly manually first"); + return; + } + + switch (trvPlugins.SelectedNode.NodeType) + { + case CrmTreeNodeType.Assembly: + { + + if (LastRepeatedAssemblyName != ((CrmPluginAssembly)trvPlugins.SelectedNode).Name) + { + ShowSystemItemError("Repeat can only be used on the last registered assembly"); + return; + } + + var regForm = new PluginRegistrationForm(Organization, this, (CrmPluginAssembly)trvPlugins.SelectedNode); + LastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; + + + regForm.RepeatRegistration(ParentForm,LastAssemblyFileName); + } + break; + + case CrmTreeNodeType.Step: + { + var step = (CrmPluginStep)trvPlugins.SelectedNode; + CrmPlugin plugin = m_org[step.AssemblyId][step.PluginId]; + + CrmServiceEndpoint serviceEndpoint = null; + if (step.ServiceBusConfigurationId != Guid.Empty) + { + serviceEndpoint = m_org.ServiceEndpoints[step.ServiceBusConfigurationId]; + } + + var regForm = new StepRegistrationForm(Organization, this, plugin, step, serviceEndpoint); + regForm.ShowDialog(); + } + break; + + case CrmTreeNodeType.Image: + { + var regForm = new ImageRegistrationForm(m_org, this, + trvPlugins.RootNodes, (CrmPluginImage)trvPlugins.SelectedNode, trvPlugins.SelectedNode.NodeId); + regForm.ShowDialog(); + } + break; + + default: + throw new NotImplementedException($"NodeType = {trvPlugins.SelectedNode.NodeType.ToString()}"); + } + + ICrmTreeNode node = trvPlugins.SelectedNode; + if (node != null) + { + trvPlugins_SelectionChanged(sender, new CrmTreeNodeTreeEventArgs(node, TreeViewAction.Unknown)); + } + + } } } \ No newline at end of file From 7d5c93fbb9ac3b312a2ee2e7d6c94ea2de233571 Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Tue, 20 Aug 2019 15:12:30 +0100 Subject: [PATCH 3/4] tidy up message boxes --- Xrm.Sdk.PluginRegistration/MainControl.cs | 43 ++++++++--------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/Xrm.Sdk.PluginRegistration/MainControl.cs b/Xrm.Sdk.PluginRegistration/MainControl.cs index bb40f4d..4b90e2e 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.cs @@ -610,7 +610,7 @@ public void ShowAboutDialog() } } - public void ShowSystemItemError(string text) + public void ShowSystemItemError(string text,bool showSystemMessage = true) { if (text == null) { @@ -618,8 +618,15 @@ public void ShowSystemItemError(string text) } else { - MessageBox.Show(string.Format("{0}\n{1}", SYSTEM_ERROR_MESSAGE, text), - SYSTEM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); + if (showSystemMessage) + { + MessageBox.Show(string.Format("{0}\n{1}", SYSTEM_ERROR_MESSAGE, text), + SYSTEM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + MessageBox.Show( text, SYSTEM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } @@ -2374,7 +2381,7 @@ private void toolRepeat_Click(object sender, EventArgs e) if (String.IsNullOrEmpty(LastAssemblyFileName)) { - ShowSystemItemError("Please register the assembly manually first"); + ShowSystemItemError("Please register the assembly manually first",false); return; } @@ -2385,7 +2392,7 @@ private void toolRepeat_Click(object sender, EventArgs e) if (LastRepeatedAssemblyName != ((CrmPluginAssembly)trvPlugins.SelectedNode).Name) { - ShowSystemItemError("Repeat can only be used on the last registered assembly"); + ShowSystemItemError("Repeat can only be used on the last registered assembly",false); return; } @@ -2397,32 +2404,10 @@ private void toolRepeat_Click(object sender, EventArgs e) } break; - case CrmTreeNodeType.Step: - { - var step = (CrmPluginStep)trvPlugins.SelectedNode; - CrmPlugin plugin = m_org[step.AssemblyId][step.PluginId]; - - CrmServiceEndpoint serviceEndpoint = null; - if (step.ServiceBusConfigurationId != Guid.Empty) - { - serviceEndpoint = m_org.ServiceEndpoints[step.ServiceBusConfigurationId]; - } - - var regForm = new StepRegistrationForm(Organization, this, plugin, step, serviceEndpoint); - regForm.ShowDialog(); - } - break; - - case CrmTreeNodeType.Image: - { - var regForm = new ImageRegistrationForm(m_org, this, - trvPlugins.RootNodes, (CrmPluginImage)trvPlugins.SelectedNode, trvPlugins.SelectedNode.NodeId); - regForm.ShowDialog(); - } - break; default: - throw new NotImplementedException($"NodeType = {trvPlugins.SelectedNode.NodeType.ToString()}"); + ShowSystemItemError("Repeat can only be used on assemblies",false); + break; } ICrmTreeNode node = trvPlugins.SelectedNode; From 8830765e02a2de18833a99d776708b0dcbd72af9 Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Wed, 21 Aug 2019 11:24:25 +0100 Subject: [PATCH 4/4] tidying up as requested for pull request --- .../Forms/PluginRegistrationForm.cs | 27 ++++- Xrm.Sdk.PluginRegistration/MainControl.cs | 107 +++++++++--------- 2 files changed, 77 insertions(+), 57 deletions(-) diff --git a/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs b/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs index 5746797..eccb714 100644 --- a/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs +++ b/Xrm.Sdk.PluginRegistration/Forms/PluginRegistrationForm.cs @@ -42,6 +42,10 @@ public partial class PluginRegistrationForm : Form private List m_registeredPluginList; #endregion Private Fields + + #region Public Properties + public string AssemblyFileName { get; set; } + #endregion Public Properties #region Public Constructors @@ -161,11 +165,10 @@ private void AssemblyPathControl_PathChanged(object sender, EventArgs e) } } - public void RepeatRegistration(object sender,string AssemblyFileName) + public void RepeatRegistration(string assemblyFileName) { - AssemblyPathControl.FileName = AssemblyFileName; - btnLoadAssembly_Click(sender, new EventArgs()); - btnRegister_Click(sender, new EventArgs()); + CheckAndLoadAssembly(assemblyFileName); + RegisterPlugin(); } private void btnCancel_Click(object sender, EventArgs e) @@ -173,10 +176,19 @@ private void btnCancel_Click(object sender, EventArgs e) Close(); } - public string AssemblyFileName { get; set; } private void btnLoadAssembly_Click(object sender, EventArgs e) { + CheckAndLoadAssembly(); + } + + private void CheckAndLoadAssembly(string assemblyFileName = null) + { + if (!string.IsNullOrEmpty(assemblyFileName)) + { + AssemblyPathControl.FileName = assemblyFileName; + } + if (!AssemblyPathControl.FileExists) { MessageBox.Show("Error: Unable to locate the specified file. Please ensure that it exists", @@ -212,6 +224,11 @@ private void btnLoadAssembly_Click(object sender, EventArgs e) } private void btnRegister_Click(object sender, EventArgs e) + { + RegisterPlugin(); + } + + private void RegisterPlugin() { const string ERROR_CAPTION = "Registration Error"; string ERROR_MESSAGE; diff --git a/Xrm.Sdk.PluginRegistration/MainControl.cs b/Xrm.Sdk.PluginRegistration/MainControl.cs index 4b90e2e..41d4499 100644 --- a/Xrm.Sdk.PluginRegistration/MainControl.cs +++ b/Xrm.Sdk.PluginRegistration/MainControl.cs @@ -56,6 +56,9 @@ public partial class MainControl : PluginControlBase, IStatusBarMessenger, IGitH private Dictionary m_stepEntityMap = new Dictionary(); private Dictionary m_stepParentList = null; private Dictionary m_viewNodeList = null; + private string m_lastAssemblyFileName = null; + private string m_lastRepeatedAssemblyName = null; + #endregion Private Fields @@ -610,7 +613,7 @@ public void ShowAboutDialog() } } - public void ShowSystemItemError(string text,bool showSystemMessage = true) + public void ShowSystemItemError(string text, bool showSystemMessage = true) { if (text == null) { @@ -1711,7 +1714,54 @@ private void toolUnregister_Click(object sender, EventArgs e) } } - public string LastAssemblyFileName { get; set; } + + private void toolRepeat_Click(object sender, EventArgs e) + { + if (IsNodeSystemItem(trvPlugins.SelectedNode)) + { + ShowSystemItemError("The assembly cannot be updated."); + return; + } + + if (String.IsNullOrEmpty(m_lastAssemblyFileName)) + { + ShowSystemItemError("Please register the assembly manually first", false); + return; + } + + switch (trvPlugins.SelectedNode.NodeType) + { + case CrmTreeNodeType.Assembly: + { + + if (m_lastRepeatedAssemblyName != ((CrmPluginAssembly)trvPlugins.SelectedNode).Name) + { + ShowSystemItemError("Repeat can only be used on the last registered assembly", false); + return; + } + + var regForm = new PluginRegistrationForm(Organization, this, (CrmPluginAssembly)trvPlugins.SelectedNode); + m_lastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; + + + regForm.RepeatRegistration(m_lastAssemblyFileName); + } + break; + + + default: + ShowSystemItemError("Repeat can only be used on assemblies", false); + break; + } + + ICrmTreeNode node = trvPlugins.SelectedNode; + if (node != null) + { + trvPlugins_SelectionChanged(sender, new CrmTreeNodeTreeEventArgs(node, TreeViewAction.Unknown)); + } + + } + private void toolUpdate_Click(object sender, EventArgs e) { @@ -1727,8 +1777,8 @@ private void toolUpdate_Click(object sender, EventArgs e) { var regForm = new PluginRegistrationForm(Organization, this, (CrmPluginAssembly)trvPlugins.SelectedNode); regForm.ShowDialog(ParentForm); - LastAssemblyFileName = regForm.AssemblyFileName; - LastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; + m_lastAssemblyFileName = regForm.AssemblyFileName; + m_lastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; } break; @@ -2369,53 +2419,6 @@ private void UpdateNodeText() #endregion Private Classes - public string LastRepeatedAssemblyName { get; set; } - - private void toolRepeat_Click(object sender, EventArgs e) - { - if (IsNodeSystemItem(trvPlugins.SelectedNode)) - { - ShowSystemItemError("The assembly cannot be updated."); - return; - } - - if (String.IsNullOrEmpty(LastAssemblyFileName)) - { - ShowSystemItemError("Please register the assembly manually first",false); - return; - } - - switch (trvPlugins.SelectedNode.NodeType) - { - case CrmTreeNodeType.Assembly: - { - - if (LastRepeatedAssemblyName != ((CrmPluginAssembly)trvPlugins.SelectedNode).Name) - { - ShowSystemItemError("Repeat can only be used on the last registered assembly",false); - return; - } - - var regForm = new PluginRegistrationForm(Organization, this, (CrmPluginAssembly)trvPlugins.SelectedNode); - LastRepeatedAssemblyName = ((CrmPluginAssembly)trvPlugins.SelectedNode).Name; - - - regForm.RepeatRegistration(ParentForm,LastAssemblyFileName); - } - break; - - - default: - ShowSystemItemError("Repeat can only be used on assemblies",false); - break; - } - - ICrmTreeNode node = trvPlugins.SelectedNode; - if (node != null) - { - trvPlugins_SelectionChanged(sender, new CrmTreeNodeTreeEventArgs(node, TreeViewAction.Unknown)); - } - - } + } } \ No newline at end of file