diff --git a/XRMTokensRun/GetAttribute.Designer.cs b/XRMTokensRun/GetAttribute.Designer.cs index 8512d20..9faa7a0 100644 --- a/XRMTokensRun/GetAttribute.Designer.cs +++ b/XRMTokensRun/GetAttribute.Designer.cs @@ -41,16 +41,18 @@ private void InitializeComponent() this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.label10 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); + this.chkParent = new System.Windows.Forms.CheckBox(); + this.txtResult = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); this.xrmParentEntity = new Rappen.XTB.Helpers.Controls.XRMEntityComboBox(); this.xrmParentAttr = new Rappen.XTB.Helpers.Controls.XRMAttributeComboBox(); this.xrmColumn = new Rappen.XTB.Helpers.Controls.XRMAttributeComboBox(); - this.chkParent = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // button1 // this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; - this.button1.Location = new System.Drawing.Point(138, 284); + this.button1.Location = new System.Drawing.Point(138, 298); this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(115, 28); @@ -71,7 +73,7 @@ private void InitializeComponent() // button2 // this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.button2.Location = new System.Drawing.Point(272, 284); + this.button2.Location = new System.Drawing.Point(272, 298); this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(115, 28); @@ -117,6 +119,7 @@ private void InitializeComponent() this.chkValue.Size = new System.Drawing.Size(15, 14); this.chkValue.TabIndex = 17; this.chkValue.UseVisualStyleBackColor = true; + this.chkValue.CheckedChanged += new System.EventHandler(this.ShowResult); // // label7 // @@ -160,6 +163,35 @@ private void InitializeComponent() this.label3.TabIndex = 26; this.label3.Text = "Parent Table"; // + // chkParent + // + this.chkParent.AutoSize = true; + this.chkParent.Location = new System.Drawing.Point(138, 156); + this.chkParent.Name = "chkParent"; + this.chkParent.Size = new System.Drawing.Size(15, 14); + this.chkParent.TabIndex = 27; + this.chkParent.UseVisualStyleBackColor = true; + this.chkParent.CheckedChanged += new System.EventHandler(this.chkParent_CheckedChanged); + // + // txtResult + // + this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtResult.Location = new System.Drawing.Point(138, 261); + this.txtResult.Name = "txtResult"; + this.txtResult.ReadOnly = true; + this.txtResult.Size = new System.Drawing.Size(401, 22); + this.txtResult.TabIndex = 35; + // + // label5 + // + this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(33, 264); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(46, 16); + this.label5.TabIndex = 34; + this.label5.Text = "Result"; + // // xrmParentEntity // this.xrmParentEntity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -182,6 +214,7 @@ private void InitializeComponent() this.xrmParentAttr.Name = "xrmParentAttr"; this.xrmParentAttr.Size = new System.Drawing.Size(375, 24); this.xrmParentAttr.TabIndex = 10; + this.xrmParentAttr.SelectedIndexChanged += new System.EventHandler(this.ShowResult); // // xrmColumn // @@ -194,16 +227,6 @@ private void InitializeComponent() this.xrmColumn.TabIndex = 0; this.xrmColumn.SelectedIndexChanged += new System.EventHandler(this.xrmColumn_SelectedIndexChanged); // - // chkParent - // - this.chkParent.AutoSize = true; - this.chkParent.Location = new System.Drawing.Point(138, 156); - this.chkParent.Name = "chkParent"; - this.chkParent.Size = new System.Drawing.Size(15, 14); - this.chkParent.TabIndex = 27; - this.chkParent.UseVisualStyleBackColor = true; - this.chkParent.CheckedChanged += new System.EventHandler(this.chkParent_CheckedChanged); - // // GetAttribute // this.AcceptButton = this.button1; @@ -211,6 +234,8 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; this.ClientSize = new System.Drawing.Size(575, 347); + this.Controls.Add(this.txtResult); + this.Controls.Add(this.label5); this.Controls.Add(this.chkParent); this.Controls.Add(this.label3); this.Controls.Add(this.xrmParentEntity); @@ -233,6 +258,7 @@ private void InitializeComponent() this.Name = "GetAttribute"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Get Column"; + this.Load += new System.EventHandler(this.ShowResult); this.ResumeLayout(false); this.PerformLayout(); @@ -254,5 +280,7 @@ private void InitializeComponent() private System.Windows.Forms.Label label3; private Rappen.XTB.Helpers.Controls.XRMEntityComboBox xrmParentEntity; private System.Windows.Forms.CheckBox chkParent; + private System.Windows.Forms.TextBox txtResult; + private System.Windows.Forms.Label label5; } } \ No newline at end of file diff --git a/XRMTokensRun/GetAttribute.cs b/XRMTokensRun/GetAttribute.cs index 819bf94..483a0bc 100644 --- a/XRMTokensRun/GetAttribute.cs +++ b/XRMTokensRun/GetAttribute.cs @@ -28,21 +28,26 @@ public static string ShowDialog(XRMTR owner, EntityMetadata entity = null, IEnum dialog.xrmColumn.DataSource = attributes ?? entity.Attributes.Where(a => a.IsLogical == false); if (dialog.ShowDialog((Control)owner) == DialogResult.OK) { - var result = "{" + dialog.xrmColumn.SelectedAttribute.LogicalName; - if (dialog.chkParent.Checked) - { - result += "." + dialog.xrmParentAttr.SelectedAttribute.LogicalName; - } - if (dialog.chkValue.Checked) - { - result += "|"; - } - result += "}"; - return result; + return dialog.GetResult(); } return null; } + private string GetResult() + { + var result = "{" + xrmColumn.SelectedAttribute.LogicalName; + if (chkParent.Checked) + { + result += "." + xrmParentAttr.SelectedAttribute.LogicalName; + } + if (chkValue.Checked) + { + result += "|"; + } + result += "}"; + return result; + } + private void xrmColumn_SelectedIndexChanged(object sender, System.EventArgs e) { if (xrmColumn.SelectedAttribute is LookupAttributeMetadata look) @@ -58,6 +63,7 @@ private void xrmColumn_SelectedIndexChanged(object sender, System.EventArgs e) chkParent.Checked = false; xrmParentEntity.DataSource = null; } + ShowResult(); } private void xrmParentEntity_SelectedIndexChanged(object sender, System.EventArgs e) @@ -79,6 +85,7 @@ private void xrmParentEntity_SelectedIndexChanged(object sender, System.EventArg { xrmParentAttr.DataSource = null; } + ShowResult(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -102,6 +109,12 @@ private void chkParent_CheckedChanged(object sender, System.EventArgs e) xrmParentEntity.SelectedItem = null; xrmParentAttr.SelectedItem = null; } + ShowResult(); + } + + private void ShowResult(object sender = null, System.EventArgs e = null) + { + txtResult.Text = GetResult(); } } } \ No newline at end of file diff --git a/XRMTokensRun/GetChildEntityAttribute.Designer.cs b/XRMTokensRun/GetChildEntityAttribute.Designer.cs index 416060f..7987a8f 100644 --- a/XRMTokensRun/GetChildEntityAttribute.Designer.cs +++ b/XRMTokensRun/GetChildEntityAttribute.Designer.cs @@ -52,12 +52,15 @@ private void InitializeComponent() this.xrmShow = new Rappen.XTB.Helpers.Controls.XRMAttributeComboBox(); this.xrmEntityComboBox1 = new Rappen.XTB.Helpers.Controls.XRMEntityComboBox(); this.xrmLookup = new Rappen.XTB.Helpers.Controls.XRMAttributeComboBox(); + this.txtResult = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // button1 // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; - this.button1.Location = new System.Drawing.Point(136, 383); + this.button1.Location = new System.Drawing.Point(136, 414); this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(115, 28); @@ -77,8 +80,9 @@ private void InitializeComponent() // // button2 // + this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.button2.Location = new System.Drawing.Point(271, 383); + this.button2.Location = new System.Drawing.Point(271, 414); this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(115, 28); @@ -153,6 +157,7 @@ private void InitializeComponent() this.txtSeparate.Size = new System.Drawing.Size(401, 22); this.txtSeparate.TabIndex = 13; this.txtSeparate.Text = ", "; + this.txtSeparate.TextChanged += new System.EventHandler(this.ShowResult); // // label7 // @@ -175,6 +180,7 @@ private void InitializeComponent() this.chkDistinct.Size = new System.Drawing.Size(15, 14); this.chkDistinct.TabIndex = 15; this.chkDistinct.UseVisualStyleBackColor = true; + this.chkDistinct.TextChanged += new System.EventHandler(this.ShowResult); // // label8 // @@ -197,6 +203,7 @@ private void InitializeComponent() this.chkActive.Size = new System.Drawing.Size(15, 14); this.chkActive.TabIndex = 17; this.chkActive.UseVisualStyleBackColor = true; + this.chkActive.TextChanged += new System.EventHandler(this.ShowResult); // // label9 // @@ -217,6 +224,7 @@ private void InitializeComponent() this.mskMax.Size = new System.Drawing.Size(95, 22); this.mskMax.TabIndex = 20; this.mskMax.Text = "100"; + this.mskMax.TextChanged += new System.EventHandler(this.ShowResult); // // label10 // @@ -249,6 +257,7 @@ private void InitializeComponent() this.xrmOrder.Name = "xrmOrder"; this.xrmOrder.Size = new System.Drawing.Size(401, 24); this.xrmOrder.TabIndex = 12; + this.xrmOrder.SelectedIndexChanged += new System.EventHandler(this.ShowResult); // // xrmShow // @@ -259,6 +268,7 @@ private void InitializeComponent() this.xrmShow.Name = "xrmShow"; this.xrmShow.Size = new System.Drawing.Size(401, 24); this.xrmShow.TabIndex = 8; + this.xrmShow.SelectedIndexChanged += new System.EventHandler(this.ShowResult); // // xrmEntityComboBox1 // @@ -280,6 +290,26 @@ private void InitializeComponent() this.xrmLookup.Name = "xrmLookup"; this.xrmLookup.Size = new System.Drawing.Size(401, 24); this.xrmLookup.TabIndex = 0; + this.xrmLookup.SelectedIndexChanged += new System.EventHandler(this.ShowResult); + // + // txtResult + // + this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtResult.Location = new System.Drawing.Point(136, 378); + this.txtResult.Name = "txtResult"; + this.txtResult.ReadOnly = true; + this.txtResult.Size = new System.Drawing.Size(401, 22); + this.txtResult.TabIndex = 37; + // + // label11 + // + this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(31, 381); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(46, 16); + this.label11.TabIndex = 36; + this.label11.Text = "Result"; // // GetChildEntityAttribute // @@ -287,7 +317,9 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; - this.ClientSize = new System.Drawing.Size(575, 433); + this.ClientSize = new System.Drawing.Size(575, 453); + this.Controls.Add(this.txtResult); + this.Controls.Add(this.label11); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.label10); this.Controls.Add(this.mskMax); @@ -317,6 +349,7 @@ private void InitializeComponent() this.Name = "GetChildEntityAttribute"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Expand Childs"; + this.Load += new System.EventHandler(this.ShowResult); this.ResumeLayout(false); this.PerformLayout(); @@ -345,5 +378,7 @@ private void InitializeComponent() private System.Windows.Forms.MaskedTextBox mskMax; private System.Windows.Forms.Label label10; private System.Windows.Forms.LinkLabel linkLabel1; + private System.Windows.Forms.TextBox txtResult; + private System.Windows.Forms.Label label11; } } \ No newline at end of file diff --git a/XRMTokensRun/GetChildEntityAttribute.cs b/XRMTokensRun/GetChildEntityAttribute.cs index 447d0ee..b5ba6e7 100644 --- a/XRMTokensRun/GetChildEntityAttribute.cs +++ b/XRMTokensRun/GetChildEntityAttribute.cs @@ -27,19 +27,24 @@ public static string ShowDialog(XRMTR owner, EntityMetadata entity = null, IEnum dialog.xrmEntityComboBox1.DataSource = owner.entities.Where(e => ents.Contains(e.LogicalName)); if (dialog.ShowDialog((Control)owner) == DialogResult.OK) { - return ""; + return dialog.GetResult(); } return null; } + private string GetResult() + { + return ""; + } + private void xrmEntityComboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { if (xrmEntityComboBox1.SelectedEntity is EntityMetadata select) @@ -61,11 +66,17 @@ private void xrmEntityComboBox1_SelectedIndexChanged(object sender, System.Event xrmShow.DataSource = null; xrmOrder.DataSource = null; } + ShowResult(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Process.Start("https://jonasr.app/xrm-tokens/#expand"); } + + private void ShowResult(object sender = null, System.EventArgs e = null) + { + txtResult.Text = GetResult(); + } } } \ No newline at end of file diff --git a/XRMTokensRun/GetSystem.Designer.cs b/XRMTokensRun/GetSystem.Designer.cs index 036cb88..c793132 100644 --- a/XRMTokensRun/GetSystem.Designer.cs +++ b/XRMTokensRun/GetSystem.Designer.cs @@ -95,7 +95,7 @@ private void InitializeComponent() this.label10.Location = new System.Drawing.Point(134, 22); this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(39, 11); + this.label10.Size = new System.Drawing.Size(68, 20); this.label10.TabIndex = 23; this.label10.Text = "System"; // @@ -132,6 +132,7 @@ private void InitializeComponent() this.btnCol.TabIndex = 31; this.btnCol.Text = "Col"; this.btnCol.UseVisualStyleBackColor = true; + this.btnCol.Visible = false; this.btnCol.Click += new System.EventHandler(this.btnCol_Click); // // txtFormat @@ -140,7 +141,7 @@ private void InitializeComponent() this.txtFormat.Name = "txtFormat"; this.txtFormat.Size = new System.Drawing.Size(346, 22); this.txtFormat.TabIndex = 30; - this.txtFormat.TextChanged += new System.EventHandler(this.cmbOperator_SelectedIndexChanged); + this.txtFormat.TextChanged += new System.EventHandler(this.ShowResult); // // label1 // @@ -148,7 +149,7 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(33, 178); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(26, 9); + this.label1.Size = new System.Drawing.Size(46, 16); this.label1.TabIndex = 32; this.label1.Text = "Result"; // diff --git a/XRMTokensRun/GetSystem.cs b/XRMTokensRun/GetSystem.cs index 3429d3d..82e72af 100644 --- a/XRMTokensRun/GetSystem.cs +++ b/XRMTokensRun/GetSystem.cs @@ -50,6 +50,7 @@ private void btnCol_Click(object sender, System.EventArgs e) { txtFormat.Text = val; } + ShowResult(); } private void cmbOperator_SelectedIndexChanged(object sender, System.EventArgs e) @@ -58,7 +59,7 @@ private void cmbOperator_SelectedIndexChanged(object sender, System.EventArgs e) ShowResult(); } - private void ShowResult() + private void ShowResult(object sender = null, System.EventArgs e = null) { txtResult.Text = GetResult(); }