Skip to content

Commit

Permalink
Fixed IIF-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Sep 12, 2021
1 parent 47b2bef commit df278c7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 17 deletions.
42 changes: 39 additions & 3 deletions XRMTokensRun/GetIif.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 28 additions & 13 deletions XRMTokensRun/GetIif.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Microsoft.Xrm.Sdk.Metadata;
using Rappen.XTB.Helpers.Extensions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Diagnostics;
using System.Windows.Forms;

namespace XRMTokensRun
Expand All @@ -22,28 +18,47 @@ public static string ShowDialog(XRMTR owner)
dialog.xrmtr = owner;
if (dialog.ShowDialog((Control)owner) == DialogResult.OK)
{
var result = "<iif|" +
dialog.txtValue1.Text + "|" +
dialog.cmbOperator.Text + "|" +
dialog.txtValue2.Text + "|" +
dialog.txtTrue.Text + "|" +
dialog.txtFalse.Text + ">";
return result;
return dialog.GetResult();
}
return null;
}

private string GetResult()
{
return "<iif|" +
txtValue1.Text + "|" +
cmbOperator.Text + "|" +
txtValue2.Text + "|" +
txtTrue.Text + "|" +
txtFalse.Text + ">";
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://jonasr.app/xrm-tokens/#ifelse");
}

private void btnValue1_Click(object sender, System.EventArgs e)
{
var value =
sender == btnValue1 ? txtValue1 :
sender == btnValue2 ? txtValue2 :
sender == btnTrue ? txtTrue :
sender == btnFalse ? txtFalse : null;
if (value == null)
{
return;
}
if (GetAttribute.ShowDialog(xrmtr) is string val && !string.IsNullOrEmpty(val))
{
txtValue1.Text = val;
value.Text = val;
}
ShowResult();
}

private void ShowResult(object sender = null, System.EventArgs e = null)
{
txtResult.Text = GetResult();
}
}
}
2 changes: 1 addition & 1 deletion XRMTokensRun/XRMTR.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df278c7

Please sign in to comment.