Skip to content

Commit

Permalink
New SelectSolutions dialog.
Browse files Browse the repository at this point in the history
Refactoring refactoring...
  • Loading branch information
rappen committed Nov 16, 2019
1 parent e78955e commit dbced25
Show file tree
Hide file tree
Showing 15 changed files with 645 additions and 639 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
using System.Windows.Forms;
using XrmToolBox.Extensibility;

namespace Rappen.XTB.PAC
namespace Rappen.XTB.PAC.Dialogs
{
public partial class AzureLoginDialog : Form
{
#region Public Constructors

public AzureLoginDialog(PAC pac)
public AzureLoginDialog()
{
InitializeComponent();
btnConnectPAC.Enabled = Guid.TryParse(txtTenantId.Text, out Guid t) && Guid.TryParse(txtClientId.Text, out Guid c) && !string.IsNullOrWhiteSpace(txtClientSec.Text);
}

#endregion Public Constructors
Expand Down Expand Up @@ -42,6 +41,7 @@ internal void SettingsApplyToUI(Settings settings)
if (!settings.ClientId.Equals(Guid.Empty)) txtClientId.Text = settings.ClientId.ToString();
if (!string.IsNullOrEmpty(settings.ClientSecret)) txtClientSec.Text = settings.ClientSecret;
if (!string.IsNullOrEmpty(settings.Region)) cbRegion.SelectedIndex = cbRegion.Items.IndexOf(settings.Region);
CheckInputs();
}

internal void SettingsGetFromUI(Settings settings)
Expand All @@ -61,9 +61,21 @@ internal void SettingsGetFromUI(Settings settings)

#endregion Internal Methods


#region Private Methods

private void cbRegion_SelectedIndexChanged(object sender, EventArgs e)
{
CheckInputs();
}

private void CheckInputs()
{
btnConnectPAC.Enabled =
Guid.TryParse(txtClientId.Text, out var clientId) &&
cbRegion.SelectedItem != null &&
(rbUser.Checked || (Guid.TryParse(txtTenantId.Text, out var tenantId) && !string.IsNullOrEmpty(txtClientSec.Text)));
}

private Tuple<HttpClient, string> ConnectPAChecker(bool silent = false)
{
if (silent && !(Guid.TryParse(txtTenantId.Text, out Guid t) && Guid.TryParse(txtClientId.Text, out Guid c) && !string.IsNullOrWhiteSpace(txtClientSec.Text)))
Expand Down Expand Up @@ -105,14 +117,6 @@ private Tuple<HttpClient, string> ConnectPAChecker(bool silent = false)
}
}

private void CheckInputs()
{
btnConnectPAC.Enabled =
Guid.TryParse(txtClientId.Text, out var clientId) &&
cbRegion.SelectedItem != null &&
(rbUser.Checked || (Guid.TryParse(txtTenantId.Text, out var tenantId) && !string.IsNullOrEmpty(txtClientSec.Text)));
}

private void picClient_Click(object sender, EventArgs e)
{
Process.Start("https://docs.microsoft.com/en-us/powershell/powerapps/get-started-powerapps-checker?view=pa-ps-latest#powerapps-checker-authentication-and-authorization");
Expand All @@ -139,16 +143,11 @@ private void rbMethod_CheckedChanged(object sender, EventArgs e)
CheckInputs();
}

#endregion Private Methods

private void txtInput_TextChanged(object sender, EventArgs e)
{
CheckInputs();
}

private void cbRegion_SelectedIndexChanged(object sender, EventArgs e)
{
CheckInputs();
}
#endregion Private Methods
}
}
File renamed without changes.
Loading

0 comments on commit dbced25

Please sign in to comment.