Save size of main window between uses. Deal with minimized windows (do not save status when minimized)

This commit is contained in:
Tim Young 2015-08-08 15:10:18 -06:00
parent a31824cfae
commit ccbdafbc88
6 changed files with 104 additions and 10 deletions

View File

@ -22,6 +22,18 @@
<setting name="LanguageHasBeenChosen" serializeAs="String">
<value>False</value>
</setting>
<setting name="MainWindowX" serializeAs="String">
<value>-1</value>
</setting>
<setting name="MainWindowY" serializeAs="String">
<value>-1</value>
</setting>
<setting name="MainWindowWidth" serializeAs="String">
<value>-1</value>
</setting>
<setting name="MainWindowHeight" serializeAs="String">
<value>-1</value>
</setting>
</EduNetworkBuilder.Properties.Settings>
</userSettings>
</configuration>

View File

@ -105,7 +105,11 @@ namespace EduNetworkBuilder
else if (ToEdit.TheTest == NetTestType.ReadContextHelp)
{
cbSource.Items.Clear();
foreach (string ContextHelp in Enum.GetNames(typeof(HelpTopics)))
List<string> theNames = new List<string>();
theNames.AddRange(Enum.GetNames(typeof(HelpTopics)));
theNames.Sort();
theNames.Remove("None");
foreach (string ContextHelp in theNames)
{
cbSource.Items.Add(ContextHelp);
}

View File

@ -904,11 +904,14 @@ namespace EduNetworkBuilder
private void BuilderWindow_Resize(object sender, EventArgs e)
{
//size limits go here
int smallestX = 400;
int smallestY = 300;
if (Width < smallestX) Width = smallestX;
if (Height < smallestY) Height = smallestY;
if (WindowState == FormWindowState.Normal)
{
//size limits go here
int smallestX = 400;
int smallestY = 300;
if (Width < smallestX) Width = smallestX;
if (Height < smallestY) Height = smallestY;
}
}
private void BuilderWindow_ResizeEnd(object sender, EventArgs e)
@ -925,9 +928,7 @@ namespace EduNetworkBuilder
private void helpToolStripMenuItem1_Click(object sender, EventArgs e)
{
RTFWindow mywindow = new RTFWindow(RTFWindowContents.help);
mywindow.ShowDialog();
NB.ReadContextHelp(HelpTopics.None);
}
private void releaseNotesToolStripMenuItem_Click(object sender, EventArgs e)
@ -950,6 +951,13 @@ namespace EduNetworkBuilder
{
Properties.Settings.Default.ChosenLanguage = ChosenLanguage;
Properties.Settings.Default.LastPath = LastPath;
if (WindowState == FormWindowState.Normal)
{
Properties.Settings.Default.MainWindowHeight = Height;
Properties.Settings.Default.MainWindowWidth = Width;
Properties.Settings.Default.MainWindowX = Location.X;
Properties.Settings.Default.MainWindowY = Location.Y;
}
Properties.Settings.Default.Save();
}
@ -1103,6 +1111,15 @@ namespace EduNetworkBuilder
puzzlesToolStripMenuItem_Click(null, null);
}
}
if (Properties.Settings.Default.MainWindowX != -1 && Properties.Settings.Default.MainWindowY != -1)
{
Location = new Point(Properties.Settings.Default.MainWindowX, Properties.Settings.Default.MainWindowY);
}
if (Properties.Settings.Default.MainWindowHeight != -1 && Properties.Settings.Default.MainWindowWidth != -1)
{
Height = Properties.Settings.Default.MainWindowHeight;
Width = Properties.Settings.Default.MainWindowWidth;
}
}
private void btnHelp_Click(object sender, EventArgs e)

View File

@ -81,5 +81,53 @@ namespace EduNetworkBuilder.Properties {
this["LanguageHasBeenChosen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
public int MainWindowX {
get {
return ((int)(this["MainWindowX"]));
}
set {
this["MainWindowX"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
public int MainWindowY {
get {
return ((int)(this["MainWindowY"]));
}
set {
this["MainWindowY"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
public int MainWindowWidth {
get {
return ((int)(this["MainWindowWidth"]));
}
set {
this["MainWindowWidth"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
public int MainWindowHeight {
get {
return ((int)(this["MainWindowHeight"]));
}
set {
this["MainWindowHeight"] = value;
}
}
}
}

View File

@ -17,5 +17,17 @@
<Setting Name="LanguageHasBeenChosen" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="MainWindowX" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value>
</Setting>
<Setting Name="MainWindowY" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value>
</Setting>
<Setting Name="MainWindowWidth" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value>
</Setting>
<Setting Name="MainWindowHeight" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,7 +1,8 @@
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Courier New;}{\f2\fnil\fcharset0 Calibri;}{\f3\fmodern\fprq1\fcharset0 Consolas;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 6.3.9600}\viewkind4\uc1
\pard\widctlpar\sa200\sl276\slmult1\f0\fs22\lang9 This is a basic help document for EduNetworkBuilder\par
\pard\widctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Help:\b0\par
This is a basic help document for EduNetworkBuilder. You can get to this by going to "Help" -> "Help" from the main network-builder window. Or, if you are working on a puzzle, the number buttons on the right-side should open context help. (Help topics that somehow relate to the specific puzzle).\par
\b Overview\par
\b0 EduNetworkBuilder is meant to represent fairly truthfully how a network functions while removing the complexity of configuration. It focuses on IP addresses, Netmasks, Gateways, and Routes.\par
\b The Items & Terminology\b0\par