Skip to content

Commit

Permalink
this should now really fix #1787
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Feb 27, 2015
1 parent 4a50d06 commit ada352b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 10 additions & 4 deletions MahApps.Metro/Controls/WindowSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,21 @@ public WINDOWPLACEMENT? Placement {
}
}

private bool upgradeSettings = true;

/// <summary>
/// Upgrades the application settings on loading.
/// </summary>
[UserScopedSetting]
public bool UpgradeSettings
{
get { return upgradeSettings; }
set { upgradeSettings = value; }
get
{
if (this["UpgradeSettings"] != null)
{
return (bool)this["UpgradeSettings"];
}
return true;
}
set { this["UpgradeSettings"] = value; }
}
}

Expand Down
9 changes: 9 additions & 0 deletions samples/MetroDemo/ExampleWindows/FlyoutDemo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public FlyoutDemo()
e.Cancel = true;
}
};

var mainWindow = (MetroWindow)this;
var windowPlacementSettings = mainWindow.GetWindowPlacementSettings();
if (windowPlacementSettings.UpgradeSettings)
{
windowPlacementSettings.Upgrade();
windowPlacementSettings.UpgradeSettings = false;
windowPlacementSettings.Save();
}
}

public void Launch()
Expand Down

0 comments on commit ada352b

Please sign in to comment.