private void SaveState()
{
Properties.Settings.Default.WindowPos = new Rect(this.Left, this.Top, this.Width, this.Height);
if (this.WindowState == System.Windows.WindowState.Maximized)
{
Properties.Settings.Default.IsMaximized = true;
}
else
{
Properties.Settings.Default.IsMaximized = false;
}
Properties.Settings.Default.Save();
}