ssg: advanced config: use preferences form, add basic general panel, relevant controller logic
This commit is contained in:
parent
6e2db9bf42
commit
4750b05edd
|
@ -16,7 +16,6 @@ using OpenLiveWriter.BlogClient;
|
|||
using OpenLiveWriter.PostEditor;
|
||||
using OpenLiveWriter.ApplicationFramework.Preferences;
|
||||
using OpenLiveWriter.PostEditor.Configuration.Wizard;
|
||||
using OpenLiveWriter.PostEditor.Configuration.StaticSite;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.Settings
|
||||
{
|
||||
|
@ -134,7 +133,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.Settings
|
|||
// For static sites, the advanced configuration panel will be displayed
|
||||
// Otherwise, display the wizard
|
||||
bool settingsModified = blogSettings.IsStaticSiteBlog
|
||||
? StaticSiteAdvancedConfigController.EditTemporarySettings(FindForm(), blogSettings)
|
||||
? StaticSiteAdvanced.PreferencesController.EditTemporarySettings(FindForm(), blogSettings)
|
||||
: WeblogConfigurationWizardController.EditTemporarySettings(FindForm(), blogSettings);
|
||||
|
||||
if (settingsModified)
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using OpenLiveWriter.PostEditor.Configuration;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSite
|
||||
{
|
||||
public class StaticSiteAdvancedConfigController
|
||||
{
|
||||
private TemporaryBlogSettings _temporarySettings;
|
||||
private StaticSiteAdvancedConfigForm _form;
|
||||
|
||||
public bool SettingsModified { get; set; } = false;
|
||||
|
||||
public StaticSiteAdvancedConfigController(TemporaryBlogSettings blogSettings)
|
||||
{
|
||||
_temporarySettings = blogSettings;
|
||||
|
||||
_form = new StaticSiteAdvancedConfigForm(this);
|
||||
_form.AddTabPage("test1", new StaticSiteAdvancedConfigPanel());
|
||||
_form.AddTabPage("test2", new StaticSiteAdvancedConfigPanel());
|
||||
}
|
||||
|
||||
private bool EditWeblogTemporarySettings(IWin32Window owner)
|
||||
{
|
||||
_form.ShowDialog(owner);
|
||||
return SettingsModified;
|
||||
}
|
||||
|
||||
public static bool EditTemporarySettings(IWin32Window owner, TemporaryBlogSettings settings)
|
||||
=> new StaticSiteAdvancedConfigController(settings).EditWeblogTemporarySettings(owner);
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSite
|
||||
{
|
||||
partial class StaticSiteAdvancedConfigForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.applyBtn = new System.Windows.Forms.Button();
|
||||
this.cancelBtn = new System.Windows.Forms.Button();
|
||||
this.okBtn = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Location = new System.Drawing.Point(2, 2);
|
||||
this.tabControl.Multiline = true;
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(245, 270);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// applyBtn
|
||||
//
|
||||
this.applyBtn.Location = new System.Drawing.Point(355, 481);
|
||||
this.applyBtn.Name = "applyBtn";
|
||||
this.applyBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.applyBtn.TabIndex = 1;
|
||||
this.applyBtn.Text = "Apply";
|
||||
this.applyBtn.UseVisualStyleBackColor = true;
|
||||
this.applyBtn.Click += new System.EventHandler(this.ApplyButton_Click);
|
||||
//
|
||||
// cancelBtn
|
||||
//
|
||||
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelBtn.Location = new System.Drawing.Point(274, 481);
|
||||
this.cancelBtn.Name = "cancelBtn";
|
||||
this.cancelBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelBtn.TabIndex = 2;
|
||||
this.cancelBtn.Text = "Cancel";
|
||||
this.cancelBtn.UseVisualStyleBackColor = true;
|
||||
this.cancelBtn.Click += new System.EventHandler(this.CancelButton_Click);
|
||||
//
|
||||
// okBtn
|
||||
//
|
||||
this.okBtn.Location = new System.Drawing.Point(193, 481);
|
||||
this.okBtn.Name = "okBtn";
|
||||
this.okBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.okBtn.TabIndex = 3;
|
||||
this.okBtn.Text = "OK";
|
||||
this.okBtn.UseVisualStyleBackColor = true;
|
||||
this.okBtn.Click += new System.EventHandler(this.OkButton_Click);
|
||||
//
|
||||
// StaticSiteAdvancedConfigForm
|
||||
//
|
||||
this.AcceptButton = this.okBtn;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelBtn;
|
||||
this.ClientSize = new System.Drawing.Size(450, 550);
|
||||
this.Controls.Add(this.okBtn);
|
||||
this.Controls.Add(this.cancelBtn);
|
||||
this.Controls.Add(this.applyBtn);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "StaticSiteAdvancedConfigForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Static Site Advanced Configuration";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl;
|
||||
private System.Windows.Forms.Button applyBtn;
|
||||
private System.Windows.Forms.Button cancelBtn;
|
||||
private System.Windows.Forms.Button okBtn;
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSite
|
||||
{
|
||||
public partial class StaticSiteAdvancedConfigForm : Form
|
||||
{
|
||||
private StaticSiteAdvancedConfigController _controller;
|
||||
|
||||
public StaticSiteAdvancedConfigForm(StaticSiteAdvancedConfigController controller)
|
||||
{
|
||||
InitializeComponent();
|
||||
_controller = controller;
|
||||
}
|
||||
|
||||
public void AddTabPage(string title, Control tabPageControl)
|
||||
{
|
||||
var page = new TabPage(title);
|
||||
page.Controls.Add(tabPageControl);
|
||||
tabControl.TabPages.Add(page);
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
_controller.SettingsModified = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ApplyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
_controller.SettingsModified = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSite
|
||||
{
|
||||
partial class StaticSiteAdvancedConfigPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.textBox1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.textBox2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.textBox3, 0, 2);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(85, 45);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(200, 100);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(3, 43);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox2.TabIndex = 1;
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(3, 83);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox3.TabIndex = 2;
|
||||
//
|
||||
// StaticSiteAdvancedConfigPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.AutoSize = true;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "StaticSiteAdvancedConfigPanel";
|
||||
this.Size = new System.Drawing.Size(425, 425);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSite
|
||||
{
|
||||
public partial class StaticSiteAdvancedConfigPanel : UserControl
|
||||
{
|
||||
public StaticSiteAdvancedConfigPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Dock = DockStyle.Fill; // Fill tab control
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,246 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for details.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using OpenLiveWriter.Localization;
|
||||
using OpenLiveWriter.Localization.Bidi;
|
||||
using OpenLiveWriter.Controls;
|
||||
using OpenLiveWriter.CoreServices;
|
||||
using OpenLiveWriter.BlogClient;
|
||||
using OpenLiveWriter.PostEditor;
|
||||
using OpenLiveWriter.ApplicationFramework.Preferences;
|
||||
using OpenLiveWriter.PostEditor.Configuration.Wizard;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for AccountPanel.
|
||||
/// </summary>
|
||||
public class GeneralPanel : PreferencesPanel
|
||||
{
|
||||
private System.Windows.Forms.GroupBox groupBoxSetup;
|
||||
private TextBox textBoxSiteTitle;
|
||||
private Label labelSiteTitle;
|
||||
private TextBox textBoxLocalSitePath;
|
||||
private Label labelLocalSitePath;
|
||||
private TextBox textBoxSiteUrl;
|
||||
private Button buttonRunAccountWizard;
|
||||
private GroupBox groupBoxOptions;
|
||||
private Label labelAutoDetect;
|
||||
private Button buttonRunAutoDetect;
|
||||
private Label labelRunWizardAgain;
|
||||
private Label labelSiteUrl;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
// private System.ComponentModel.Container components = null;
|
||||
|
||||
private PreferencesController _controller;
|
||||
|
||||
public string SiteTitle
|
||||
{
|
||||
get => textBoxSiteTitle.Text;
|
||||
set => textBoxSiteTitle.Text = value;
|
||||
}
|
||||
|
||||
public string SiteUrl
|
||||
{
|
||||
get => textBoxSiteUrl.Text;
|
||||
set => textBoxSiteUrl.Text = value;
|
||||
}
|
||||
|
||||
public string LocalSitePath
|
||||
{
|
||||
get => textBoxLocalSitePath.Text;
|
||||
set => textBoxLocalSitePath.Text = value;
|
||||
}
|
||||
|
||||
public GeneralPanel(PreferencesController controller)
|
||||
: base()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
//UpdateStrings();
|
||||
|
||||
_controller = controller;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
DisplayHelper.AutoFitSystemButton(buttonRunAccountWizard);
|
||||
DisplayHelper.AutoFitSystemButton(buttonRunAutoDetect);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GeneralPanel));
|
||||
this.groupBoxSetup = new System.Windows.Forms.GroupBox();
|
||||
this.textBoxLocalSitePath = new System.Windows.Forms.TextBox();
|
||||
this.labelLocalSitePath = new System.Windows.Forms.Label();
|
||||
this.textBoxSiteUrl = new System.Windows.Forms.TextBox();
|
||||
this.labelSiteUrl = new System.Windows.Forms.Label();
|
||||
this.textBoxSiteTitle = new System.Windows.Forms.TextBox();
|
||||
this.labelSiteTitle = new System.Windows.Forms.Label();
|
||||
this.buttonRunAccountWizard = new System.Windows.Forms.Button();
|
||||
this.groupBoxOptions = new System.Windows.Forms.GroupBox();
|
||||
this.labelAutoDetect = new System.Windows.Forms.Label();
|
||||
this.buttonRunAutoDetect = new System.Windows.Forms.Button();
|
||||
this.labelRunWizardAgain = new System.Windows.Forms.Label();
|
||||
this.groupBoxSetup.SuspendLayout();
|
||||
this.groupBoxOptions.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBoxSetup
|
||||
//
|
||||
this.groupBoxSetup.Controls.Add(this.textBoxLocalSitePath);
|
||||
this.groupBoxSetup.Controls.Add(this.labelLocalSitePath);
|
||||
this.groupBoxSetup.Controls.Add(this.textBoxSiteUrl);
|
||||
this.groupBoxSetup.Controls.Add(this.labelSiteUrl);
|
||||
this.groupBoxSetup.Controls.Add(this.textBoxSiteTitle);
|
||||
this.groupBoxSetup.Controls.Add(this.labelSiteTitle);
|
||||
this.groupBoxSetup.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.groupBoxSetup.Location = new System.Drawing.Point(8, 32);
|
||||
this.groupBoxSetup.Name = "groupBoxSetup";
|
||||
this.groupBoxSetup.Size = new System.Drawing.Size(345, 158);
|
||||
this.groupBoxSetup.TabIndex = 1;
|
||||
this.groupBoxSetup.TabStop = false;
|
||||
this.groupBoxSetup.Text = "Setup";
|
||||
//
|
||||
// textBoxLocalSitePath
|
||||
//
|
||||
this.textBoxLocalSitePath.Location = new System.Drawing.Point(16, 126);
|
||||
this.textBoxLocalSitePath.Name = "textBoxLocalSitePath";
|
||||
this.textBoxLocalSitePath.Size = new System.Drawing.Size(316, 23);
|
||||
this.textBoxLocalSitePath.TabIndex = 5;
|
||||
//
|
||||
// labelLocalSitePath
|
||||
//
|
||||
this.labelLocalSitePath.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.labelLocalSitePath.Location = new System.Drawing.Point(16, 107);
|
||||
this.labelLocalSitePath.Name = "labelLocalSitePath";
|
||||
this.labelLocalSitePath.Size = new System.Drawing.Size(144, 16);
|
||||
this.labelLocalSitePath.TabIndex = 4;
|
||||
this.labelLocalSitePath.Text = "&Local Site Path:";
|
||||
//
|
||||
// textBoxSiteUrl
|
||||
//
|
||||
this.textBoxSiteUrl.Location = new System.Drawing.Point(16, 81);
|
||||
this.textBoxSiteUrl.Name = "textBoxSiteUrl";
|
||||
this.textBoxSiteUrl.Size = new System.Drawing.Size(316, 23);
|
||||
this.textBoxSiteUrl.TabIndex = 3;
|
||||
//
|
||||
// labelSiteUrl
|
||||
//
|
||||
this.labelSiteUrl.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.labelSiteUrl.Location = new System.Drawing.Point(16, 63);
|
||||
this.labelSiteUrl.Name = "labelSiteUrl";
|
||||
this.labelSiteUrl.Size = new System.Drawing.Size(144, 16);
|
||||
this.labelSiteUrl.TabIndex = 2;
|
||||
this.labelSiteUrl.Text = "Site &URL:";
|
||||
//
|
||||
// textBoxSiteTitle
|
||||
//
|
||||
this.textBoxSiteTitle.Location = new System.Drawing.Point(16, 37);
|
||||
this.textBoxSiteTitle.Name = "textBoxSiteTitle";
|
||||
this.textBoxSiteTitle.Size = new System.Drawing.Size(316, 23);
|
||||
this.textBoxSiteTitle.TabIndex = 1;
|
||||
//
|
||||
// labelSiteTitle
|
||||
//
|
||||
this.labelSiteTitle.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.labelSiteTitle.Location = new System.Drawing.Point(16, 19);
|
||||
this.labelSiteTitle.Name = "labelSiteTitle";
|
||||
this.labelSiteTitle.Size = new System.Drawing.Size(144, 16);
|
||||
this.labelSiteTitle.TabIndex = 0;
|
||||
this.labelSiteTitle.Text = "Site &Title:";
|
||||
//
|
||||
// buttonRunAccountWizard
|
||||
//
|
||||
this.buttonRunAccountWizard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRunAccountWizard.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.buttonRunAccountWizard.Location = new System.Drawing.Point(188, 70);
|
||||
this.buttonRunAccountWizard.Name = "buttonRunAccountWizard";
|
||||
this.buttonRunAccountWizard.Size = new System.Drawing.Size(144, 23);
|
||||
this.buttonRunAccountWizard.TabIndex = 10;
|
||||
this.buttonRunAccountWizard.Text = "Run Account &Wizard";
|
||||
this.buttonRunAccountWizard.Click += new System.EventHandler(this.ButtonRunAccountWizard_Click);
|
||||
//
|
||||
// groupBoxOptions
|
||||
//
|
||||
this.groupBoxOptions.Controls.Add(this.labelAutoDetect);
|
||||
this.groupBoxOptions.Controls.Add(this.buttonRunAutoDetect);
|
||||
this.groupBoxOptions.Controls.Add(this.labelRunWizardAgain);
|
||||
this.groupBoxOptions.Controls.Add(this.buttonRunAccountWizard);
|
||||
this.groupBoxOptions.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.groupBoxOptions.Location = new System.Drawing.Point(8, 196);
|
||||
this.groupBoxOptions.Name = "groupBoxOptions";
|
||||
this.groupBoxOptions.Size = new System.Drawing.Size(345, 211);
|
||||
this.groupBoxOptions.TabIndex = 2;
|
||||
this.groupBoxOptions.TabStop = false;
|
||||
this.groupBoxOptions.Text = "Options";
|
||||
//
|
||||
// labelAutoDetect
|
||||
//
|
||||
this.labelAutoDetect.Location = new System.Drawing.Point(13, 96);
|
||||
this.labelAutoDetect.Name = "labelAutoDetect";
|
||||
this.labelAutoDetect.Size = new System.Drawing.Size(316, 75);
|
||||
this.labelAutoDetect.TabIndex = 13;
|
||||
this.labelAutoDetect.Text = resources.GetString("labelAutoDetect.Text");
|
||||
//
|
||||
// buttonRunAutoDetect
|
||||
//
|
||||
this.buttonRunAutoDetect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRunAutoDetect.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.buttonRunAutoDetect.Location = new System.Drawing.Point(188, 174);
|
||||
this.buttonRunAutoDetect.Name = "buttonRunAutoDetect";
|
||||
this.buttonRunAutoDetect.Size = new System.Drawing.Size(144, 23);
|
||||
this.buttonRunAutoDetect.TabIndex = 12;
|
||||
this.buttonRunAutoDetect.Text = "Run Auto-&Detect";
|
||||
this.buttonRunAutoDetect.Click += new System.EventHandler(this.ButtonRunAutoDetect_Click);
|
||||
//
|
||||
// labelRunWizardAgain
|
||||
//
|
||||
this.labelRunWizardAgain.Location = new System.Drawing.Point(16, 19);
|
||||
this.labelRunWizardAgain.Name = "labelRunWizardAgain";
|
||||
this.labelRunWizardAgain.Size = new System.Drawing.Size(316, 48);
|
||||
this.labelRunWizardAgain.TabIndex = 11;
|
||||
this.labelRunWizardAgain.Text = "You can chose to run the Account Wizard again if you wish to be guided through th" +
|
||||
"e core static site configuration options interactively.";
|
||||
//
|
||||
// GeneralPanel
|
||||
//
|
||||
this.AccessibleName = "General";
|
||||
this.Controls.Add(this.groupBoxSetup);
|
||||
this.Controls.Add(this.groupBoxOptions);
|
||||
this.Name = "GeneralPanel";
|
||||
this.PanelName = "General";
|
||||
this.Size = new System.Drawing.Size(370, 425);
|
||||
this.Controls.SetChildIndex(this.groupBoxOptions, 0);
|
||||
this.Controls.SetChildIndex(this.groupBoxSetup, 0);
|
||||
this.groupBoxSetup.ResumeLayout(false);
|
||||
this.groupBoxSetup.PerformLayout();
|
||||
this.groupBoxOptions.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void ButtonRunAccountWizard_Click(object sender, EventArgs e)
|
||||
=> _controller.GeneralPanel_RunAccountWizard();
|
||||
|
||||
private void ButtonRunAutoDetect_Click(object sender, EventArgs e)
|
||||
=> _controller.GeneralPanel_RunAutoDetect();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
@ -117,4 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="labelAutoDetect.Text" xml:space="preserve">
|
||||
<value>Open Live Writer can also reattempt to detect relevant configuration options for your static site. This may not result in a complete configuration, so please use the fields on the following pages to ensure all settings are set correctly.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OpenLiveWriter.ApplicationFramework.Preferences;
|
||||
using OpenLiveWriter.BlogClient;
|
||||
using OpenLiveWriter.BlogClient.Clients.StaticSite;
|
||||
using OpenLiveWriter.Localization;
|
||||
using OpenLiveWriter.PostEditor.Configuration.Wizard;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
|
||||
{
|
||||
public class PreferencesController
|
||||
{
|
||||
private TemporaryBlogSettings _temporarySettings;
|
||||
private PreferencesForm _form;
|
||||
|
||||
private GeneralPanel panelGeneral;
|
||||
|
||||
public PreferencesController(TemporaryBlogSettings blogSettings)
|
||||
{
|
||||
_temporarySettings = blogSettings;
|
||||
_form = new PreferencesForm();
|
||||
|
||||
panelGeneral = new GeneralPanel(this);
|
||||
}
|
||||
|
||||
private bool EditWeblogTemporarySettings(IWin32Window owner)
|
||||
{
|
||||
LoadFromStaticSiteConfig(CreateSiteConfig());
|
||||
|
||||
// Show form
|
||||
using (var preferencesForm = new StaticSitePreferencesForm())
|
||||
{
|
||||
using (BlogClientUIContextScope uiContextScope = new BlogClientUIContextScope(preferencesForm))
|
||||
{
|
||||
// Customize form title and behavior
|
||||
preferencesForm.Text = $"Static Site Configuration for '{_temporarySettings.BlogName}'"; //String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.WeblogSettings), blogSettings.BlogName);
|
||||
|
||||
// Add panels
|
||||
int iPanel = 0;
|
||||
preferencesForm.SetEntry(iPanel++, panelGeneral);
|
||||
|
||||
preferencesForm.SelectedIndex = 0;
|
||||
|
||||
// Show the dialog
|
||||
preferencesForm.ShowDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private StaticSiteConfig CreateSiteConfig()
|
||||
{
|
||||
var ssgConfig = new StaticSiteConfig();
|
||||
ssgConfig.LoadFromBlogSettings(_temporarySettings);
|
||||
return ssgConfig;
|
||||
}
|
||||
|
||||
private void LoadFromStaticSiteConfig(StaticSiteConfig ssgConfig)
|
||||
{
|
||||
// General
|
||||
panelGeneral.SiteTitle = ssgConfig.SiteTitle;
|
||||
panelGeneral.SiteUrl = ssgConfig.SiteUrl;
|
||||
panelGeneral.LocalSitePath = ssgConfig.LocalSitePath;
|
||||
}
|
||||
|
||||
public void GeneralPanel_RunAccountWizard()
|
||||
{
|
||||
WeblogConfigurationWizardController.EditTemporarySettings(_form, _temporarySettings);
|
||||
// Reload the settings into the form
|
||||
LoadFromStaticSiteConfig(CreateSiteConfig());
|
||||
}
|
||||
|
||||
public void GeneralPanel_RunAutoDetect()
|
||||
{
|
||||
var ssgConfig = CreateSiteConfig();
|
||||
var result = StaticSiteConfigDetector.AttmeptAutoDetect(ssgConfig);
|
||||
|
||||
if(result)
|
||||
{
|
||||
// Successful detection of parameters
|
||||
MessageBox.Show(
|
||||
string.Format(Res.Get(StringId.CWStaticSiteConfigDetection), Res.Get(StringId.ProductNameVersioned)),
|
||||
Res.Get(StringId.ProductNameVersioned),
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
|
||||
LoadFromStaticSiteConfig(ssgConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool EditTemporarySettings(IWin32Window owner, TemporaryBlogSettings settings)
|
||||
=> new PreferencesController(settings).EditWeblogTemporarySettings(owner);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
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 class StaticSitePreferencesForm : PreferencesForm
|
||||
{
|
||||
}
|
||||
}
|
|
@ -289,18 +289,12 @@
|
|||
<Compile Include="Configuration\Settings\WeblogSettingsPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\StaticSite\StaticSiteAdvancedConfigController.cs" />
|
||||
<Compile Include="Configuration\StaticSite\StaticSiteAdvancedConfigForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\StaticSite\StaticSiteAdvancedConfigForm.Designer.cs">
|
||||
<DependentUpon>StaticSiteAdvancedConfigForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\StaticSite\StaticSiteAdvancedConfigPanel.cs">
|
||||
<Compile Include="Configuration\StaticSiteAdvanced\GeneralPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\StaticSite\StaticSiteAdvancedConfigPanel.Designer.cs">
|
||||
<DependentUpon>StaticSiteAdvancedConfigPanel.cs</DependentUpon>
|
||||
<Compile Include="Configuration\StaticSiteAdvanced\PreferencesController.cs" />
|
||||
<Compile Include="Configuration\StaticSiteAdvanced\StaticSitePreferencesForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\TemporaryBlogSettings.cs" />
|
||||
<Compile Include="Configuration\Wizard\BlogProviderAccountWizard.cs" />
|
||||
|
@ -492,6 +486,11 @@
|
|||
</Compile>
|
||||
<Compile Include="ContentSources\IPublishTimeWorker.cs" />
|
||||
<Compile Include="ContentSources\SmartContentWorker.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SmartContentPersistedFileList.cs" />
|
||||
<Compile Include="PingPreferencesPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
|
@ -1046,11 +1045,9 @@
|
|||
<DependentUpon>WeblogSettingsPanel.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\StaticSite\StaticSiteAdvancedConfigForm.resx">
|
||||
<DependentUpon>StaticSiteAdvancedConfigForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\StaticSite\StaticSiteAdvancedConfigPanel.resx">
|
||||
<DependentUpon>StaticSiteAdvancedConfigPanel.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Configuration\StaticSiteAdvanced\GeneralPanel.resx">
|
||||
<DependentUpon>GeneralPanel.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\Wizard\Images\LiveID16.gif" />
|
||||
<EmbeddedResource Include="Configuration\Wizard\Images\WeblogWizardHeader.png" />
|
||||
|
@ -1501,6 +1498,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<DependentUpon>PrivacyPreferencesPanel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="RecentPostNotSynchronizedWarningForm.resx">
|
||||
<DependentUpon>RecentPostNotSynchronizedWarningForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenLiveWriter.PostEditor.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue