Remember last window state on closing the application

Implements #11
This commit is contained in:
Juergen Tem 2018-12-25 12:26:02 +01:00
parent 9dba94d6fa
commit 9d1bcff6bb
No known key found for this signature in database
GPG Key ID: 0A9625B1654DCE28
5 changed files with 36 additions and 4 deletions

View File

@ -71,8 +71,10 @@ namespace BDInfo
this.Icon = BDInfo.Properties.Resources.Bluray_disc;
Text += String.Format(" v{0}", Application.ProductVersion);
Size = BDInfo.Properties.Settings.Default.WindowSize;
Location = BDInfo.Properties.Settings.Default.WindowLocation;
WindowState = BDInfo.Properties.Settings.Default.WindowState;
}
private void FormMain_Load(object sender, EventArgs e)
@ -347,8 +349,20 @@ namespace BDInfo
FormClosingEventArgs e)
{
BDInfoSettings.LastPath = textBoxSource.Text;
BDInfo.Properties.Settings.Default.WindowLocation = Location;
BDInfo.Properties.Settings.Default.WindowSize = Size;
BDInfo.Properties.Settings.Default.WindowState = WindowState;
if (WindowState == FormWindowState.Normal)
{
BDInfo.Properties.Settings.Default.WindowSize = Size;
BDInfo.Properties.Settings.Default.WindowLocation = Location;
}
else
{
BDInfo.Properties.Settings.Default.WindowSize = RestoreBounds.Size;
BDInfo.Properties.Settings.Default.WindowLocation = RestoreBounds.Location;
}
BDInfoSettings.SaveSettings();
if (InitBDROMWorker != null &&

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.5.4")]
[assembly: AssemblyFileVersion("0.7.5.4")]
[assembly: AssemblyVersion("0.7.5.5")]
[assembly: AssemblyFileVersion("0.7.5.5")]

View File

@ -214,5 +214,17 @@ namespace BDInfo.Properties {
this["DisplayChapterCount"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Windows.Forms.FormWindowState WindowState {
get {
return ((global::System.Windows.Forms.FormWindowState)(this["WindowState"]));
}
set {
this["WindowState"] = value;
}
}
}
}

View File

@ -50,5 +50,8 @@
<Setting Name="DisplayChapterCount" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="WindowState" Type="System.Windows.Forms.FormWindowState" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -55,6 +55,9 @@
<setting name="DisplayChapterCount" serializeAs="String">
<value>False</value>
</setting>
<setting name="WindowState" serializeAs="String">
<value>Normal</value>
</setting>
</BDInfo.Properties.Settings>
</userSettings>
</configuration>