Пример #1
0
 private static Result SavePosition(this Window window, ApplicationSettingsBase settings, string name = "")
 {
     try
     {
         var prefix      = name.IsEmpty() ? window.Name : name;
         var settingName = prefix + "_Position";
         settings.SaveSetting(settingName, new Point(window.Left, window.Top));
         return(Result.Success());
     }
     catch (Exception ex)
     {
         return(Result.Failure(ex));
     }
 }
Пример #2
0
        private static Result SaveSize(this Window window, ApplicationSettingsBase settings, string name = "")
        {
            try
            {
                var prefix = name.IsEmpty() ? window.Name : name;

                var settingName = prefix + "_Size";
                settings.SaveSetting(settingName, new Size(window.Width, window.Height));
                return(Result.Success());
            }
            catch (Exception ex)
            {
                return(Result.Failure(ex));
            }
        }