ssg: advanced config: impl StaticSitePreferencesPanel with common protected attributes, make all panels inherit it

This commit is contained in:
Nick Vella 2019-08-01 23:53:13 +10:00
parent b7751ca027
commit b1cbb5c6ad
5 changed files with 36 additions and 37 deletions

View File

@ -23,7 +23,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// <summary>
/// Summary description for AccountPanel.
/// </summary>
public class AuthoringPanel : PreferencesPanel
public class AuthoringPanel : StaticSitePreferencesPanel
{
private Label labelPostsPath;
private TextBox textBoxPostsPath;
@ -46,8 +46,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// </summary>
// private System.ComponentModel.Container components = null;
private PreferencesController _controller;
public string PostsPath
{
get => textBoxPostsPath.Text;
@ -96,14 +94,10 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
set => textBoxImagesPath.Text = value;
}
public AuthoringPanel(PreferencesController controller)
: base()
public AuthoringPanel(StaticSitePreferencesController controller, TemporaryBlogSettings blogSettings)
: base(controller, blogSettings)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
//UpdateStrings();
_controller = controller;
}
protected override void OnLoad(EventArgs e)

View File

@ -24,7 +24,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// <summary>
/// Summary description for BuildPublishPanel.
/// </summary>
public class BuildPublishPanel : PreferencesPanel
public class BuildPublishPanel : StaticSitePreferencesPanel
{
private System.Windows.Forms.GroupBox groupBoxGeneral;
private CheckBox checkBoxShowCommandWindows;
@ -46,18 +46,11 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// </summary>
// private System.ComponentModel.Container components = null;
private PreferencesController _controller;
public BuildPublishPanel(PreferencesController controller)
: base()
public BuildPublishPanel(StaticSitePreferencesController controller, TemporaryBlogSettings blogSettings)
: base(controller, blogSettings)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
numericUpDownCmdTimeout.Maximum = int.MaxValue;
//UpdateStrings();
_controller = controller;
}
protected override void OnLoad(EventArgs e)
@ -79,7 +72,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
if (checkBoxEnableCmdTimeout.Checked)
return Convert.ToInt32(numericUpDownCmdTimeout.Value);
return StaticSiteConfig.DEFAULT_CMD_TIMEOUT;
return -1; // -1 for disabled
}
set

View File

@ -27,7 +27,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// <summary>
/// Summary description for AccountPanel.
/// </summary>
public class FrontMatterPanel : PreferencesPanel
public class FrontMatterPanel : StaticSitePreferencesPanel
{
private DataGridView dataGridView;
@ -35,22 +35,18 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// Required designer variable.
/// </summary>
// private System.ComponentModel.Container components = null;
private PreferencesController _controller;
private DataGridViewTextBoxColumn colProperty;
private DataGridViewTextBoxColumn colKey;
private Label labelSubtitle;
private Dictionary<KeyIdentifier, DataGridViewRow> _keyRowMap = new Dictionary<KeyIdentifier, DataGridViewRow>();
public FrontMatterPanel(PreferencesController controller)
: base()
public FrontMatterPanel(StaticSitePreferencesController controller, TemporaryBlogSettings blogSettings)
: base(controller, blogSettings)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
//UpdateStrings();
_controller = controller;
}
protected override void OnLayout(LayoutEventArgs e)
{
base.OnLayout(e);

View File

@ -23,7 +23,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// <summary>
/// Summary description for AccountPanel.
/// </summary>
public class GeneralPanel : PreferencesPanel
public class GeneralPanel : StaticSitePreferencesPanel
{
private System.Windows.Forms.GroupBox groupBoxSetup;
private TextBox textBoxSiteTitle;
@ -44,8 +44,6 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
/// </summary>
// private System.ComponentModel.Container components = null;
private PreferencesController _controller;
public string SiteTitle
{
get => textBoxSiteTitle.Text;
@ -64,14 +62,10 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
set => textBoxLocalSitePath.Text = value;
}
public GeneralPanel(PreferencesController controller)
: base()
public GeneralPanel(StaticSitePreferencesController controller, TemporaryBlogSettings blogSettings)
: base(controller, blogSettings)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
//UpdateStrings();
_controller = controller;
}
protected override void OnLoad(EventArgs e)

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenLiveWriter.ApplicationFramework.Preferences;
namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
{
public abstract class StaticSitePreferencesPanel : PreferencesPanel
{
protected StaticSitePreferencesController _controller;
protected TemporaryBlogSettings _blogSettings;
public StaticSitePreferencesPanel(StaticSitePreferencesController controller, TemporaryBlogSettings blogSettings) : base()
{
_controller = controller;
_blogSettings = blogSettings;
}
}
}