Skip to content

Commit

Permalink
Adds UI support for changing warning interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannewington committed Dec 14, 2018
1 parent 6d8cd0c commit d047454
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 14 deletions.
62 changes: 50 additions & 12 deletions src/Lithnet.IdleLogoff/frmSettings.Designer.cs

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

12 changes: 10 additions & 2 deletions src/Lithnet.IdleLogoff/frmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private void RefreshUI()
this.ckIgnoreDisplayRequested.Enabled = !Settings.IsSettingFromPolicy(nameof(Settings.IgnoreDisplayRequested));

this.cbAction.Items.Clear();

foreach (string item in Enum.GetNames(typeof(IdleTimeoutAction)))
{
this.cbAction.Items.Add(item);
Expand All @@ -45,9 +45,12 @@ private void RefreshUI()
this.udMinutes.Value = 60;
}

this.udWarning.Value = Settings.WarningPeriod;

this.udMinutes.Enabled = !Settings.IsSettingFromPolicy(nameof(Settings.IdleLimit));
this.udWarning.Enabled = !Settings.IsSettingFromPolicy(nameof(Settings.WarningPeriod));

if (!this.udMinutes.Enabled | !this.ckEnableIdleLogoff.Enabled | !this.ckIgnoreDisplayRequested.Enabled)
if (!this.udMinutes.Enabled | !this.ckEnableIdleLogoff.Enabled | !this.ckIgnoreDisplayRequested.Enabled | !this.udWarning.Enabled)
{
this.lbGPControlled.Visible = true;
}
Expand All @@ -72,6 +75,11 @@ private void btOK_Click(object sender, EventArgs e)
Settings.IgnoreDisplayRequested = this.ckIgnoreDisplayRequested.Checked;
}

if (this.udWarning.Enabled)
{
Settings.WarningPeriod = (int) this.udWarning.Value;
}

if (this.cbAction.Enabled)
{
Settings.Action = (IdleTimeoutAction)Enum.Parse(typeof(IdleTimeoutAction), (string)this.cbAction.SelectedItem, true);
Expand Down

0 comments on commit d047454

Please sign in to comment.