I have a small out-of-browser app, and want to save and restore its window width+height+state between sessions using IsolatedStorageSettings.ApplicationSettings.
I'm trying to save settings like this (on Application_Exit):
IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
Window mainWindow = Application.Current.MainWindow;
appSettings["WindowTop"] = mainWindow.Top;
appSettings["WindowLeft"] = mainWindow.Left;
appSettings["WindowWidth"] = mainWindow.Width;
appSettings["WindowHeight"] = mainWindow.Height;
appSettings["WindowState"] = (UInt32)mainWindow.WindowState;
The bad thing is when an app is maximized, this code stores the Width, Height, Left and Top of maximized window, not the normal size/position (before maximization).
Can I get the normal window size and position somewhere?
If I'll have that values on Application_Startup, I can set normal size/position and then set WindowState, so the window position will be restored correctly after returning from maximized state.