コード例 #1
0
 private bool ValidateLayoutName(string name, out bool hadNameConflict)
 {
     name            = LayoutManagementUtilities.NormalizeName(name);
     hadNameConflict = false;
     if (LayoutManagementUtilities.IsUniqueName(name, _layoutStore))
     {
         return(true);
     }
     hadNameConflict = true;
     return(LayoutManagementDialogUserInput.TryGetOverwriteLayoutConfirmation(name));
 }
コード例 #2
0
        public void SaveWindowLayout()
        {
            var layoutNameFormat       = WindowManagement_Resources.SaveLayoutCommandDefinitionMessageBox_Default;
            var defaultLayoutNameIndex = GetDefaultLayoutNameIndex(layoutNameFormat);
            var defaultName            = string.Format(CultureInfo.CurrentUICulture, layoutNameFormat, new object[]
            {
                defaultLayoutNameIndex
            });
            var hadNameConflict = false;

            if (!LayoutManagementDialogUserInput.TryGetSavedLayoutName(defaultName,
                                                                       name => ValidateLayoutName(name, out hadNameConflict), out var layoutName))
            {
                return;
            }
            SaveWindowLayoutInternal(LayoutManagementUtilities.NormalizeName(layoutName), hadNameConflict);
        }