Skip to content

Commit

Permalink
Applied the new CancelChanges pattern to other pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Sep 22, 2017
1 parent 85167ae commit 6307daa
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 212 deletions.
2 changes: 2 additions & 0 deletions JexusManager.Features.Access/AccessPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ protected override bool ApplyChanges()

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
}
Expand Down
20 changes: 11 additions & 9 deletions JexusManager.Features.Asp/AspPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public override void ShowHelp()

public AspPage()
{
this.InitializeComponent();
InitializeComponent();
}

protected override void Initialize(object navigationData)
{
var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
var service = (IConfigurationService)GetService(typeof(IConfigurationService));
pictureBox1.Image = service.Scope.GetImage();

_feature = new AspFeature(this.Module);
_feature.AspSettingsUpdated = this.Refresh;
_feature = new AspFeature(Module);
_feature.AspSettingsUpdated = Refresh;
_feature.Load();
base.Initialize(navigationData);
}
Expand All @@ -74,14 +74,16 @@ protected override bool ApplyChanges()
return false;
}

this.ClearChanges();
ClearChanges();
return true;
}

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
ClearChanges();
}

protected override bool HasChanges
Expand All @@ -102,13 +104,13 @@ private void InformChanges()
}

_hasChanges = true;
this.Refresh();
Refresh();
}

private void ClearChanges()
{
_hasChanges = false;
this.Refresh();
Refresh();
}

protected override TaskListCollection Tasks
Expand All @@ -134,7 +136,7 @@ protected override void OnRefresh()
_initialized = true;
}

this.Tasks.Fill(tsActionPanel, cmsActionPanel);
Tasks.Fill(tsActionPanel, cmsActionPanel);
}

private void PgAspPropertyValueChanged(object s, PropertyValueChangedEventArgs e)
Expand Down
20 changes: 11 additions & 9 deletions JexusManager.Features.Cgi/CgiPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public override void ShowHelp()

public CgiPage()
{
this.InitializeComponent();
InitializeComponent();
}

protected override void Initialize(object navigationData)
{
var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
var service = (IConfigurationService)GetService(typeof(IConfigurationService));
pictureBox1.Image = service.Scope.GetImage();

_feature = new CgiFeature(this.Module);
_feature.CgiSettingsUpdated = this.Refresh;
_feature = new CgiFeature(Module);
_feature.CgiSettingsUpdated = Refresh;
_feature.Load();
base.Initialize(navigationData);
}
Expand All @@ -74,14 +74,16 @@ protected override bool ApplyChanges()
return false;
}

this.ClearChanges();
ClearChanges();
return true;
}

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
ClearChanges();
}

protected override bool HasChanges
Expand All @@ -102,13 +104,13 @@ private void InformChanges()
}

_hasChanges = true;
this.Refresh();
Refresh();
}

private void ClearChanges()
{
_hasChanges = false;
this.Refresh();
Refresh();
}

protected override TaskListCollection Tasks
Expand All @@ -134,7 +136,7 @@ protected override void OnRefresh()
_initialized = true;
}

this.Tasks.Fill(tsActionPanel, cmsActionPanel);
Tasks.Fill(tsActionPanel, cmsActionPanel);
}

private void PgCgiPropertyValueChanged(object s, PropertyValueChangedEventArgs e)
Expand Down
22 changes: 12 additions & 10 deletions JexusManager.Features.DirectoryBrowse/DirectoryBrowsePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ public override void ShowHelp()

public DirectoryBrowsePage()
{
this.InitializeComponent();
InitializeComponent();
}

protected override void Initialize(object navigationData)
{
var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
var service = (IConfigurationService)GetService(typeof(IConfigurationService));
pictureBox1.Image = service.Scope.GetImage();

_feature = new DirectoryBrowseFeature(this.Module);
_feature.DirectoryBrowseSettingsUpdated = this.Refresh;
_feature = new DirectoryBrowseFeature(Module);
_feature.DirectoryBrowseSettingsUpdated = Refresh;
_feature.Load();
base.Initialize(navigationData);
}
Expand Down Expand Up @@ -78,14 +78,16 @@ protected override bool ApplyChanges()
return false;
}

this.ClearChanges();
ClearChanges();
return true;
}

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
ClearChanges();
}

protected override bool HasChanges
Expand All @@ -106,13 +108,13 @@ private void InformChanges()
}

_hasChanges = true;
this.Refresh();
Refresh();
}

private void ClearChanges()
{
_hasChanges = false;
this.Refresh();
Refresh();
}

protected override TaskListCollection Tasks
Expand Down Expand Up @@ -143,12 +145,12 @@ protected override void OnRefresh()
_initialized = true;
}

this.Tasks.Fill(tsActionPanel, cmsActionPanel);
Tasks.Fill(tsActionPanel, cmsActionPanel);
}

private void CbDateCheckedChanged(object sender, EventArgs e)
{
this.InformChanges();
InformChanges();
cbLongDate.Enabled = cbDate.Checked && cbDate.Enabled;
}

Expand Down
34 changes: 18 additions & 16 deletions JexusManager.Features.HttpRedirect/HttpRedirectPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ private class CodeItem

public CodeItem(long code, string description)
{
this.Code = code;
this.Description = description;
Code = code;
Description = description;
}

public override string ToString()
{
return this.Description;
return Description;
}
}

Expand All @@ -58,16 +58,16 @@ public override string ToString()

public HttpRedirectPage()
{
this.InitializeComponent();
InitializeComponent();
}

protected override void Initialize(object navigationData)
{
var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
var service = (IConfigurationService)GetService(typeof(IConfigurationService));
pictureBox1.Image = service.Scope.GetImage();

_feature = new HttpRedirectFeature(this.Module, null, null);
_feature.HttpRedirectSettingsUpdated = this.Refresh;
_feature = new HttpRedirectFeature(Module, null, null);
_feature.HttpRedirectSettingsUpdated = Refresh;
_feature.Load();

base.Initialize(navigationData);
Expand Down Expand Up @@ -98,14 +98,16 @@ protected override bool ApplyChanges()
return false;
}

this.ClearChanges();
ClearChanges();
return true;
}

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
ClearChanges();
}

protected override bool HasChanges
Expand All @@ -126,13 +128,13 @@ private void InformChanges()
}

_hasChanges = true;
this.Refresh();
Refresh();
}

private void ClearChanges()
{
_hasChanges = false;
this.Refresh();
Refresh();
}

protected override TaskListCollection Tasks
Expand Down Expand Up @@ -186,28 +188,28 @@ protected override void OnRefresh()
_initialized = true;
}

this.Tasks.Fill(tsActionPanel, cmsActionPanel);
Tasks.Fill(tsActionPanel, cmsActionPanel);
}

private void CbSslCheckedChanged(object sender, EventArgs e)
{
this.InformChanges();
InformChanges();
txtLink.Enabled = cbCode.Enabled = cbExact.Enabled = cbThis.Enabled = cbRedirect.Checked;
}

private void CbExactCheckedChanged(object sender, EventArgs e)
{
this.InformChanges();
InformChanges();
}

private void CbCodeSelectedIndexChanged(object sender, EventArgs e)
{
this.InformChanges();
InformChanges();
}

private void TxtLinkTextChanged(object sender, EventArgs e)
{
this.InformChanges();
InformChanges();
}
}
}
22 changes: 12 additions & 10 deletions JexusManager.Features.Jexus/JexusPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public override void ShowHelp()

public JexusPage()
{
this.InitializeComponent();
InitializeComponent();
}

protected override void Initialize(object navigationData)
{
var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
var service = (IConfigurationService)GetService(typeof(IConfigurationService));
pictureBox1.Image = service.Scope.GetImage();

_feature = new JexusFeature(this.Module);
_feature.JexusSettingsUpdated = this.Refresh;
_feature = new JexusFeature(Module);
_feature.JexusSettingsUpdated = Refresh;
_feature.Load();
txtSettings.Enabled = _feature.IsFeatureEnabled;
base.Initialize(navigationData);
Expand All @@ -71,7 +71,7 @@ private void SplitContainer1SplitterMoved(object sender, SplitterEventArgs e)
private void txtSettings_TextChanged(object sender, EventArgs e)
{
_feature.Contents = txtSettings.Text;
this.InformChanges();
InformChanges();
}

protected override bool ApplyChanges()
Expand All @@ -81,14 +81,16 @@ protected override bool ApplyChanges()
return false;
}

this.ClearChanges();
ClearChanges();
return true;
}

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
this.ClearChanges();
ClearChanges();
}

protected override bool HasChanges
Expand All @@ -109,13 +111,13 @@ private void InformChanges()
}

_hasChanges = true;
this.Refresh();
Refresh();
}

private void ClearChanges()
{
_hasChanges = false;
this.Refresh();
Refresh();
}

protected override TaskListCollection Tasks
Expand All @@ -140,7 +142,7 @@ protected override void OnRefresh()
_initialized = true;
}

this.Tasks.Fill(tsActionPanel, cmsActionPanel);
Tasks.Fill(tsActionPanel, cmsActionPanel);
}
}
}
2 changes: 2 additions & 0 deletions JexusManager.Features.Logging/LoggingPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ protected override bool ApplyChanges()

protected override void CancelChanges()
{
_initialized = false;
_hasChanges = false;
_feature.CancelChanges();
ClearChanges();
}
Expand Down
Loading

0 comments on commit 6307daa

Please sign in to comment.