Skip to content

Commit

Permalink
helper will now store its position and size on close and reopen in th…
Browse files Browse the repository at this point in the history
…e same place, way
  • Loading branch information
Valkirie committed Dec 14, 2021
1 parent cbd40b8 commit 3c125b4
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 20 deletions.
19 changes: 6 additions & 13 deletions ControllerHelper/ControllerHelper.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions ControllerHelper/ControllerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -130,6 +131,11 @@ public ControllerHelper(string[] Arguments, ILogger logger)
cB_CloseMinimizes.Checked = CloseMinimises = Properties.Settings.Default.CloseMinimises;
cB_touchpad.Checked = HookMouse = Properties.Settings.Default.HookMouse;

// update Position and Size
Size = new Size(Properties.Settings.Default.MainWindowWidth, Properties.Settings.Default.MainWindowHeight);
Location = new Point(Properties.Settings.Default.MainWindowX, Properties.Settings.Default.MainWindowY);
WindowState = (FormWindowState)Properties.Settings.Default.WindowState;

if (StartMinimized)
{
WindowState = FormWindowState.Minimized;
Expand Down Expand Up @@ -299,11 +305,20 @@ private void ControllerHelper_Resize(object sender, EventArgs e)

private void ControllerHelper_Close(object sender, FormClosingEventArgs e)
{
// position and size settings
Properties.Settings.Default.MainWindowX = Location.X;
Properties.Settings.Default.MainWindowY = Location.Y;
Properties.Settings.Default.MainWindowWidth = Size.Width;
Properties.Settings.Default.MainWindowHeight = Size.Height;
Properties.Settings.Default.WindowState = (int)WindowState;

if (CloseMinimises && e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
}

Properties.Settings.Default.Save();
}

private void notifyIcon1_DoubleClick(object sender, EventArgs e)
Expand Down
70 changes: 65 additions & 5 deletions ControllerHelper/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions ControllerHelper/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,20 @@
<Setting Name="FirstStart" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="MainWindowX" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="MainWindowY" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="MainWindowWidth" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="MainWindowHeight" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WindowState" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions ControllerService/AssemblyInfo1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
// Numéro de build
// Révision
//
[assembly: AssemblyVersion("0.8.1.5")]
[assembly: AssemblyFileVersion("0.8.1.5")]
[assembly: AssemblyVersion("0.8.1.6")]
[assembly: AssemblyFileVersion("0.8.1.6")]

0 comments on commit 3c125b4

Please sign in to comment.