Exemplo n.º 1
0
 private static void UpdateWindowSize(WindowBaseViewModel model)
 {
     string key = model.GetType().AssemblyQualifiedName;
     var isSaveSize = model.GetType().GetCustomAttributes(typeof(SaveSizeAttribute), true).Length > 0;
     if (isSaveSize && Properties.Settings.Default.WindowSizeState.ContainsKey(key))
     {
         Rect rect = Rect.Parse(Properties.Settings.Default.WindowSizeState[key]);
         model.Surface.Top = rect.X;
         model.Surface.Left = rect.Y;
         model.Surface.Width = rect.Width;
         model.Surface.Height = rect.Height;
         model.Closed += SaveWindowSize;
     }
 }