Skip to content

Commit

Permalink
Whole lotta changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Nov 16, 2019
1 parent dbced25 commit 25e46d1
Show file tree
Hide file tree
Showing 10 changed files with 650 additions and 401 deletions.
106 changes: 65 additions & 41 deletions PowerAppsChecker/Dialogs/SolutionDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,25 @@ namespace Rappen.XTB.PAC.Dialogs
{
public partial class SolutionDialog : Form
{
#region Private Fields

private readonly PAC pac;
private List<Solution> solutions;

#endregion Private Fields

#region Public Constructors

public SolutionDialog(PAC pac)
{
InitializeComponent();
this.pac = pac;
}

#endregion Public Constructors

#region Public Methods

public List<Solution> GetSolutions()
{
LoadSolutions();
Expand All @@ -31,17 +41,66 @@ public List<Solution> GetSolutions()
return null;
}

#endregion Public Methods

#region Internal Methods

internal void SettingsApplyToUI(Settings settings)
{
txtFilename.Text = settings.SolutionFile;
}

internal void SettingsGetFromUI(Settings settings)
{
settings.SolutionFile = txtFilename.Text;
}

#endregion Internal Methods

#region Private Methods

private void AddSelectedSolution()
{
solutions.Add(new Solution
{
UniqueName = rbOrg.Checked ? cbSolution.SelectedEntity["uniquename"].ToString() : null,
LocalFilePath = rbLocal.Checked ? txtFilename.Text : null
});
}

private void btnAddSolution_Click(object sender, EventArgs e)
{
AddSelectedSolution();
}

private void btnOpenFile_Click(object sender, EventArgs e)
{
using (var od = new OpenFileDialog
{
InitialDirectory = Paths.LogsPath,
CheckPathExists = true,
DefaultExt = "zip",
Filter = "ZIP files|*.zip|All files|*.*",
Title = "Select Solution file"
})
{
if (od.ShowDialog() == DialogResult.OK)
{
txtFilename.Text = od.FileName;
}
}
}

private void CheckInputs()
{
btnOK.Enabled =
(rbOrg.Checked && cbSolution.SelectedEntity != null) ||
(rbLocal.Checked && File.Exists(txtFilename.Text));
}

private List<Solution> SelectSolutions()
private void inputs_Changed(object sender, EventArgs e)
{
AddSelectedSolution();
return solutions;
CheckInputs();
}

private void LoadSolutions()
Expand Down Expand Up @@ -87,47 +146,12 @@ private void rbSource_CheckedChanged(object sender, EventArgs e)
CheckInputs();
}

private void btnAddSolution_Click(object sender, EventArgs e)
private List<Solution> SelectSolutions()
{
AddSelectedSolution();
return solutions;
}

private void AddSelectedSolution()
{
solutions.Add(new Solution
{
UniqueName = rbOrg.Checked ? cbSolution.SelectedEntity["uniquename"].ToString() : null,
LocalFilePath = rbLocal.Checked ? txtFilename.Text : null
});
}

internal void SettingsApplyToUI(Settings settings)
{
txtFilename.Text = settings.SolutionFile;
}

internal void SettingsGetFromUI(Settings settings)
{
settings.SolutionFile = txtFilename.Text;
}

private void btnOpenFile_Click(object sender, EventArgs e)
{
using (var od = new OpenFileDialog
{
InitialDirectory = Paths.LogsPath
})
{
if (od.ShowDialog() == DialogResult.OK)
{
txtFilename.Text = od.FileName;
}
}
}

private void inputs_Changed(object sender, EventArgs e)
{
CheckInputs();
}
#endregion Private Methods
}
}
Loading

0 comments on commit 25e46d1

Please sign in to comment.