/trunk/Winify/Settings/SettingsForm.Designer.cs |
@@ -110,7 +110,7 @@ |
this.tabPage2.Controls.Add(this.flowLayoutPanel2); |
this.tabPage2.Location = new System.Drawing.Point(4, 22); |
this.tabPage2.Name = "tabPage2"; |
this.tabPage2.Size = new System.Drawing.Size(521, 221); |
this.tabPage2.Size = new System.Drawing.Size(538, 243); |
this.tabPage2.TabIndex = 1; |
this.tabPage2.Text = "Application"; |
this.tabPage2.UseVisualStyleBackColor = true; |
@@ -121,7 +121,7 @@ |
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; |
this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0); |
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; |
this.flowLayoutPanel2.Size = new System.Drawing.Size(521, 221); |
this.flowLayoutPanel2.Size = new System.Drawing.Size(538, 243); |
this.flowLayoutPanel2.TabIndex = 0; |
// |
// groupBox3 |
@@ -137,8 +137,6 @@ |
// checkBox1 |
// |
this.checkBox1.AutoSize = true; |
this.checkBox1.Checked = global::Winify.Properties.Settings.Default.LaunchOnBoot; |
this.checkBox1.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::Winify.Properties.Settings.Default, "LaunchOnBoot", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); |
this.checkBox1.Dock = System.Windows.Forms.DockStyle.Fill; |
this.checkBox1.Location = new System.Drawing.Point(3, 16); |
this.checkBox1.Name = "checkBox1"; |
@@ -366,7 +364,7 @@ |
this.tabPage3.Controls.Add(this.tableLayoutPanel7); |
this.tabPage3.Location = new System.Drawing.Point(4, 22); |
this.tabPage3.Name = "tabPage3"; |
this.tabPage3.Size = new System.Drawing.Size(508, 241); |
this.tabPage3.Size = new System.Drawing.Size(538, 243); |
this.tabPage3.TabIndex = 2; |
this.tabPage3.Text = "Announcements"; |
this.tabPage3.UseVisualStyleBackColor = true; |
@@ -383,8 +381,8 @@ |
this.tableLayoutPanel7.Name = "tableLayoutPanel7"; |
this.tableLayoutPanel7.RowCount = 1; |
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); |
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); |
this.tableLayoutPanel7.Size = new System.Drawing.Size(508, 241); |
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 241F)); |
this.tableLayoutPanel7.Size = new System.Drawing.Size(538, 243); |
this.tableLayoutPanel7.TabIndex = 0; |
// |
// groupBox2 |
@@ -391,9 +389,9 @@ |
// |
this.groupBox2.Controls.Add(this.tableLayoutPanel10); |
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; |
this.groupBox2.Location = new System.Drawing.Point(257, 3); |
this.groupBox2.Location = new System.Drawing.Point(272, 3); |
this.groupBox2.Name = "groupBox2"; |
this.groupBox2.Size = new System.Drawing.Size(248, 235); |
this.groupBox2.Size = new System.Drawing.Size(263, 237); |
this.groupBox2.TabIndex = 3; |
this.groupBox2.TabStop = false; |
this.groupBox2.Text = "Announcement Settings"; |
@@ -413,7 +411,7 @@ |
this.tableLayoutPanel10.RowCount = 2; |
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); |
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); |
this.tableLayoutPanel10.Size = new System.Drawing.Size(242, 216); |
this.tableLayoutPanel10.Size = new System.Drawing.Size(257, 218); |
this.tableLayoutPanel10.TabIndex = 4; |
// |
// label4 |
@@ -420,9 +418,9 @@ |
// |
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
this.label4.AutoSize = true; |
this.label4.Location = new System.Drawing.Point(3, 47); |
this.label4.Location = new System.Drawing.Point(3, 48); |
this.label4.Name = "label4"; |
this.label4.Size = new System.Drawing.Size(54, 13); |
this.label4.Size = new System.Drawing.Size(58, 13); |
this.label4.TabIndex = 0; |
this.label4.Text = "App Id"; |
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; |
@@ -430,9 +428,9 @@ |
// appIdTextBox |
// |
this.appIdTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
this.appIdTextBox.Location = new System.Drawing.Point(63, 44); |
this.appIdTextBox.Location = new System.Drawing.Point(67, 44); |
this.appIdTextBox.Name = "appIdTextBox"; |
this.appIdTextBox.Size = new System.Drawing.Size(176, 20); |
this.appIdTextBox.Size = new System.Drawing.Size(187, 20); |
this.appIdTextBox.TabIndex = 1; |
// |
// label6 |
@@ -439,9 +437,9 @@ |
// |
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
this.label6.AutoSize = true; |
this.label6.Location = new System.Drawing.Point(3, 155); |
this.label6.Location = new System.Drawing.Point(3, 157); |
this.label6.Name = "label6"; |
this.label6.Size = new System.Drawing.Size(54, 13); |
this.label6.Size = new System.Drawing.Size(58, 13); |
this.label6.TabIndex = 2; |
this.label6.Text = "Timeout"; |
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; |
@@ -449,9 +447,9 @@ |
// lingerTimeTextBox |
// |
this.lingerTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
this.lingerTimeTextBox.Location = new System.Drawing.Point(63, 152); |
this.lingerTimeTextBox.Location = new System.Drawing.Point(67, 153); |
this.lingerTimeTextBox.Name = "lingerTimeTextBox"; |
this.lingerTimeTextBox.Size = new System.Drawing.Size(176, 20); |
this.lingerTimeTextBox.Size = new System.Drawing.Size(187, 20); |
this.lingerTimeTextBox.TabIndex = 3; |
// |
// tableLayoutPanel4 |
@@ -466,7 +464,7 @@ |
this.tableLayoutPanel4.RowCount = 2; |
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F)); |
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); |
this.tableLayoutPanel4.Size = new System.Drawing.Size(248, 235); |
this.tableLayoutPanel4.Size = new System.Drawing.Size(263, 237); |
this.tableLayoutPanel4.TabIndex = 4; |
// |
// tableLayoutPanel5 |
@@ -478,11 +476,11 @@ |
this.tableLayoutPanel5.Controls.Add(this.button4, 0, 0); |
this.tableLayoutPanel5.Controls.Add(this.button3, 2, 0); |
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; |
this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 202); |
this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 204); |
this.tableLayoutPanel5.Name = "tableLayoutPanel5"; |
this.tableLayoutPanel5.RowCount = 1; |
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); |
this.tableLayoutPanel5.Size = new System.Drawing.Size(242, 30); |
this.tableLayoutPanel5.Size = new System.Drawing.Size(257, 30); |
this.tableLayoutPanel5.TabIndex = 0; |
// |
// button4 |
@@ -499,7 +497,7 @@ |
// button3 |
// |
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
this.button3.Location = new System.Drawing.Point(165, 3); |
this.button3.Location = new System.Drawing.Point(180, 3); |
this.button3.Name = "button3"; |
this.button3.Size = new System.Drawing.Size(74, 23); |
this.button3.TabIndex = 0; |
@@ -513,7 +511,7 @@ |
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill; |
this.groupBox4.Location = new System.Drawing.Point(3, 3); |
this.groupBox4.Name = "groupBox4"; |
this.groupBox4.Size = new System.Drawing.Size(242, 193); |
this.groupBox4.Size = new System.Drawing.Size(257, 195); |
this.groupBox4.TabIndex = 4; |
this.groupBox4.TabStop = false; |
this.groupBox4.Text = "Application Id"; |
@@ -524,7 +522,7 @@ |
this.listBox2.FormattingEnabled = true; |
this.listBox2.Location = new System.Drawing.Point(3, 16); |
this.listBox2.Name = "listBox2"; |
this.listBox2.Size = new System.Drawing.Size(236, 174); |
this.listBox2.Size = new System.Drawing.Size(251, 176); |
this.listBox2.TabIndex = 0; |
this.listBox2.SelectedIndexChanged += new System.EventHandler(this.ListBox2_SelectedIndexChanged); |
// |
@@ -590,6 +588,7 @@ |
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
this.Name = "SettingsForm"; |
this.Text = "Winify: Settings"; |
this.Load += new System.EventHandler(this.SettingsForm_Load); |
this.tabControl1.ResumeLayout(false); |
this.tabPage2.ResumeLayout(false); |
this.flowLayoutPanel2.ResumeLayout(false); |
/trunk/Winify/Settings/SettingsForm.cs |
@@ -1,5 +1,6 @@ |
using System; |
using System.Linq; |
using System.Threading; |
using System.Windows.Forms; |
using Announcements; |
using Servers; |
@@ -23,25 +24,34 @@ |
|
private readonly BindingSource _serverBindingSource; |
|
private readonly global::Servers.Servers _servers; |
private readonly Servers.Servers _servers; |
|
private Announcement _announcement; |
|
private Server _server; |
private readonly MainForm _mainForm; |
private readonly CancellationToken _cancellationToken; |
|
#endregion |
|
#region Constructors, Destructors and Finalizers |
|
private SettingsForm() |
public SettingsForm() |
{ |
InitializeComponent(); |
} |
|
public SettingsForm(global::Servers.Servers servers, Announcements.Announcements announcements) : this() |
public SettingsForm(MainForm mainForm) : this() |
{ |
_mainForm = mainForm; |
} |
|
public SettingsForm(MainForm mainForm, Servers.Servers servers, Announcements.Announcements announcements, |
CancellationToken cancellationToken) : this(mainForm) |
{ |
_servers = servers; |
_server = _servers.Server.FirstOrDefault() ?? new Server(); |
_cancellationToken = cancellationToken; |
|
_serverBindingSource = new BindingSource(); |
_serverBindingSource.DataSource = _server; |
@@ -87,9 +97,12 @@ |
|
private void CheckBox1_CheckedChanged(object sender, EventArgs e) |
{ |
Properties.Settings.Default.LaunchOnBoot = ((CheckBox)sender).Checked; |
_mainForm.Configuration.LaunchOnBoot = ((CheckBox)sender).Checked; |
|
Miscellaneous.LaunchOnBootSet(Properties.Settings.Default.LaunchOnBoot); |
_mainForm.ChangedConfigurationContinuation.Schedule(TimeSpan.FromSeconds(1), |
async () => { await _mainForm.SaveConfiguration(); }, _cancellationToken); |
|
Miscellaneous.LaunchOnBootSet(_mainForm.Configuration.LaunchOnBoot); |
} |
|
private void Button1_Click(object sender, EventArgs e) |
@@ -152,9 +165,15 @@ |
private void Button5_Click(object sender, EventArgs e) |
{ |
Save?.Invoke(this, new SettingsSavedEventArgs(_servers, _announcements)); |
|
Close(); |
} |
|
private void SettingsForm_Load(object sender, EventArgs e) |
{ |
checkBox1.Checked = _mainForm.Configuration.LaunchOnBoot; |
} |
|
#endregion |
} |
} |