MainWnd size, location and maximized state saved.
This commit is contained in:
parent
99377ce3b9
commit
46861530a8
@ -59,17 +59,20 @@ namespace TBF
|
||||
|
||||
public int RightPaneHorizSplitterDistance;
|
||||
|
||||
///
|
||||
/// MainWnd
|
||||
public int MainWndLeft;
|
||||
public int MainWndTop;
|
||||
public int MainWndWidth;
|
||||
public int MainWndHeight;
|
||||
public bool ManiWndMaximized;
|
||||
|
||||
/// Components
|
||||
///
|
||||
public int ComponentsDlgLeft;
|
||||
public int ComponentsDlgTop;
|
||||
public int ComponentsDlgWidth;
|
||||
public int ComponentsDlgHeight;
|
||||
|
||||
///
|
||||
/// Paths
|
||||
///
|
||||
public int PathsDlgLeft;
|
||||
public int PathsDlgTop;
|
||||
public int PathsDlgWidth;
|
||||
@ -95,9 +98,7 @@ namespace TBF
|
||||
[XmlIgnore]
|
||||
public int MetersColumnCount { get { return (MetersColumnWidths != null) ? MetersColumnWidths.Length : 0; } }
|
||||
|
||||
///
|
||||
/// Transitions
|
||||
///
|
||||
public int TransitionsDlgLeft;
|
||||
public int TransitionsDlgTop;
|
||||
public int TransitionsDlgWidth;
|
||||
@ -108,25 +109,19 @@ namespace TBF
|
||||
[XmlIgnore]
|
||||
public int TransitionsColumnCount { get { return (TransitionsColumnWidths != null) ? TransitionsColumnWidths.Length : 0; } }
|
||||
|
||||
///
|
||||
/// Metrology
|
||||
///
|
||||
public int MetrologyDlgLeft;
|
||||
public int MetrologyDlgTop;
|
||||
public int MetrologyDlgWidth;
|
||||
public int MetrologyDlgHeight;
|
||||
|
||||
///
|
||||
/// Procedures
|
||||
///
|
||||
public int ProceduresDlgLeft;
|
||||
public int ProceduresDlgTop;
|
||||
public int ProceduresDlgWidth;
|
||||
public int ProceduresDlgHeight;
|
||||
|
||||
///
|
||||
/// OneProcedure
|
||||
///
|
||||
public int OneProcedureDlgLeft;
|
||||
public int OneProcedureDlgTop;
|
||||
public int OneProcedureDlgWidth;
|
||||
@ -145,22 +140,31 @@ namespace TBF
|
||||
if (ls != null)
|
||||
{
|
||||
Language = ls.Language;
|
||||
|
||||
testBenches = new DatabaseSettings[ls.BenchesCount];
|
||||
for (int i = 0; i < BenchesCount; i++)
|
||||
testBenches[i] = ls.testBenches[i];
|
||||
LastBenchName = ls.LastBenchName;
|
||||
LastProcedureName = ls.LastProcedureName;
|
||||
|
||||
MainWndLeft = ls.MainWndLeft;
|
||||
MainWndTop = ls.MainWndTop;
|
||||
MainWndWidth = ls.MainWndWidth;
|
||||
MainWndHeight = ls.MainWndHeight;
|
||||
ManiWndMaximized = ls.ManiWndMaximized;
|
||||
|
||||
RightPaneHorizSplitterDistance = ls.RightPaneHorizSplitterDistance;
|
||||
|
||||
ComponentsDlgLeft = ls.ComponentsDlgLeft;
|
||||
ComponentsDlgTop = ls.ComponentsDlgTop;
|
||||
ComponentsDlgWidth = ls.ComponentsDlgWidth;
|
||||
ComponentsDlgLeft = ls.ComponentsDlgLeft;
|
||||
ComponentsDlgTop = ls.ComponentsDlgTop;
|
||||
ComponentsDlgWidth = ls.ComponentsDlgWidth;
|
||||
ComponentsDlgHeight = ls.ComponentsDlgHeight;
|
||||
|
||||
PathsDlgLeft = ls.PathsDlgLeft;
|
||||
PathsDlgTop = ls.PathsDlgTop;
|
||||
PathsDlgWidth = ls.PathsDlgWidth;
|
||||
PathsDlgLeft = ls.PathsDlgLeft;
|
||||
PathsDlgTop = ls.PathsDlgTop;
|
||||
PathsDlgWidth = ls.PathsDlgWidth;
|
||||
PathsDlgHeight = ls.PathsDlgHeight;
|
||||
|
||||
FeedingColumnWidths = new int[ls.FeedingColumnCount];
|
||||
for (int i = 0; i < FeedingColumnCount; i++)
|
||||
FeedingColumnWidths[i] = ls.FeedingColumnWidths[i];
|
||||
@ -174,27 +178,28 @@ namespace TBF
|
||||
for (int i = 0; i < MetersColumnCount; i++)
|
||||
MetersColumnWidths[i] = ls.MetersColumnWidths[i];
|
||||
|
||||
TransitionsDlgLeft = ls.TransitionsDlgLeft;
|
||||
TransitionsDlgTop = ls.TransitionsDlgTop;
|
||||
TransitionsDlgWidth = ls.TransitionsDlgWidth;
|
||||
TransitionsDlgLeft = ls.TransitionsDlgLeft;
|
||||
TransitionsDlgTop = ls.TransitionsDlgTop;
|
||||
TransitionsDlgWidth = ls.TransitionsDlgWidth;
|
||||
TransitionsDlgHeight = ls.TransitionsDlgHeight;
|
||||
|
||||
TransitionsColumnWidths = new int[ls.TransitionsColumnCount];
|
||||
for (int i = 0; i < TransitionsColumnCount; i++)
|
||||
TransitionsColumnWidths[i] = ls.TransitionsColumnWidths[i];
|
||||
|
||||
MetrologyDlgLeft = ls.MetrologyDlgLeft;
|
||||
MetrologyDlgTop = ls.MetrologyDlgTop;
|
||||
MetrologyDlgWidth = ls.MetrologyDlgWidth;
|
||||
MetrologyDlgLeft = ls.MetrologyDlgLeft;
|
||||
MetrologyDlgTop = ls.MetrologyDlgTop;
|
||||
MetrologyDlgWidth = ls.MetrologyDlgWidth;
|
||||
MetrologyDlgHeight = ls.MetrologyDlgHeight;
|
||||
|
||||
ProceduresDlgLeft = ls.ProceduresDlgLeft;
|
||||
ProceduresDlgTop = ls.ProceduresDlgTop;
|
||||
ProceduresDlgWidth = ls.ProceduresDlgWidth;
|
||||
ProceduresDlgLeft = ls.ProceduresDlgLeft;
|
||||
ProceduresDlgTop = ls.ProceduresDlgTop;
|
||||
ProceduresDlgWidth = ls.ProceduresDlgWidth;
|
||||
ProceduresDlgHeight = ls.ProceduresDlgHeight;
|
||||
|
||||
OneProcedureDlgLeft = ls.OneProcedureDlgLeft;
|
||||
OneProcedureDlgTop = ls.OneProcedureDlgTop;
|
||||
OneProcedureDlgWidth = ls.OneProcedureDlgWidth;
|
||||
OneProcedureDlgLeft = ls.OneProcedureDlgLeft;
|
||||
OneProcedureDlgTop = ls.OneProcedureDlgTop;
|
||||
OneProcedureDlgWidth = ls.OneProcedureDlgWidth;
|
||||
OneProcedureDlgHeight = ls.OneProcedureDlgHeight;
|
||||
|
||||
ResultsConfigMeters = ls.ResultsConfigMeters;
|
||||
|
||||
@ -111,6 +111,24 @@ namespace TBF
|
||||
{
|
||||
Localize();
|
||||
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
WindowState = (ls.ManiWndMaximized ? FormWindowState.Maximized : FormWindowState.Normal);
|
||||
//if (WindowState != FormWindowState.Normal)
|
||||
//{
|
||||
// RestoreBounds = new Rectangle((ls.MainWndLeft != 0) ? ls.MainWndLeft : 75,
|
||||
// (ls.MainWndTop != 0) ? ls.MainWndTop : 5,
|
||||
// (ls.MainWndWidth > 0) ? ls.MainWndWidth : 1250,
|
||||
// (ls.MainWndHeight > 0) ? ls.MainWndHeight : 750);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
Width = (ls.MainWndWidth > 0) ? ls.MainWndWidth : 1250;
|
||||
Height = (ls.MainWndHeight > 0) ? ls.MainWndHeight : 750;
|
||||
Left = (ls.MainWndLeft != 0) ? ls.MainWndLeft : 75;
|
||||
Top = (ls.MainWndTop != 0) ? ls.MainWndTop : 5;
|
||||
}
|
||||
|
||||
|
||||
if (Program.CurrentBench.IsRealBench && !benchInitializationFailed)
|
||||
{
|
||||
try
|
||||
@ -364,6 +382,23 @@ namespace TBF
|
||||
|
||||
private void MainWnd_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Program.LocalSettings.ManiWndMaximized = (WindowState == FormWindowState.Maximized);
|
||||
if (WindowState != FormWindowState.Normal)
|
||||
{
|
||||
Program.LocalSettings.MainWndLeft = Location.X;
|
||||
Program.LocalSettings.MainWndTop = Location.Y;
|
||||
Program.LocalSettings.MainWndWidth = Size.Width;
|
||||
Program.LocalSettings.MainWndHeight = Size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.LocalSettings.MainWndLeft = RestoreBounds.Left;
|
||||
Program.LocalSettings.MainWndTop = RestoreBounds.Top;
|
||||
Program.LocalSettings.MainWndWidth = RestoreBounds.Width;
|
||||
Program.LocalSettings.MainWndHeight = RestoreBounds.Height;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
|
||||
if (DialogResult == DialogResult.None)
|
||||
{
|
||||
exitToolStripMenuItem_Click(sender, e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user