using System.Windows;

namespace QC.QTMApplication;

public class WPFMainWindowSettings
{
	private double top;

	private double left;

	private double width;

	private double height;

	private WindowState winState;

	public double Top
	{
		get
		{
			return top;
		}
		set
		{
			top = value;
		}
	}

	public double Left
	{
		get
		{
			return left;
		}
		set
		{
			left = value;
		}
	}

	public double Width
	{
		get
		{
			return width;
		}
		set
		{
			width = value;
		}
	}

	public double Height
	{
		get
		{
			return height;
		}
		set
		{
			height = value;
		}
	}

	public WindowState WinState
	{
		get
		{
			return winState;
		}
		set
		{
			winState = value;
		}
	}

	public void SaveSettings(Window window)
	{
		if (window.WindowState != WindowState.Minimized)
		{
			top = window.Top;
			left = window.Left;
			width = window.Width;
			height = window.Height;
			winState = window.WindowState;
		}
	}

	public void LoadSettings(Window window)
	{
		if (top < 0.0)
		{
			top = 0.0;
		}
		if (left < 0.0)
		{
			left = 0.0;
		}
		window.Height = height;
		window.Width = width;
		window.Left = left;
		window.Top = top;
		window.WindowState = winState;
	}
}
