mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 07:15:31 +00:00
Fixed a problem, where the MainForm location and size was lost when the application is started minimized and exited without ever showing the form. This caused MainForm_Load to be never called (location and size was not loaded), but the default size and location were still saved. The new implementation only saves the location and size when one of the two is changed.
This commit is contained in:
@@ -338,13 +338,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
private void SaveConfiguration() {
|
||||
if (WindowState != FormWindowState.Minimized) {
|
||||
settings.SetValue("mainForm.Location.X", Bounds.X);
|
||||
settings.SetValue("mainForm.Location.Y", Bounds.Y);
|
||||
settings.SetValue("mainForm.Width", Bounds.Width);
|
||||
settings.SetValue("mainForm.Height", Bounds.Height);
|
||||
}
|
||||
|
||||
foreach (TreeColumn column in treeView.Columns)
|
||||
settings.SetValue("treeView.Columns." + column.Header + ".Width",
|
||||
column.Width);
|
||||
@@ -559,5 +552,14 @@ namespace OpenHardwareMonitor.GUI {
|
||||
sensor.ResetMax();
|
||||
}));
|
||||
}
|
||||
|
||||
private void MainForm_MoveOrResize(object sender, EventArgs e) {
|
||||
if (WindowState != FormWindowState.Minimized) {
|
||||
settings.SetValue("mainForm.Location.X", Bounds.X);
|
||||
settings.SetValue("mainForm.Location.Y", Bounds.Y);
|
||||
settings.SetValue("mainForm.Width", Bounds.Width);
|
||||
settings.SetValue("mainForm.Height", Bounds.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user