| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | 
							- using System.Collections.Generic;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Windows;
 
- namespace MECF.Framework.UI.Client.ClientViews.Dialogs
 
- {
 
-     /// <summary>
 
-     /// PresetGroupSaveDialog.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class PresetGroupSaveDialog
 
-     {
 
-         #region Variables
 
-         private readonly IEnumerable<string> _existFileNames;
 
-         #endregion
 
-         #region Constructors
 
-         public PresetGroupSaveDialog(string title, IEnumerable<string> existFileNames, string defaultGroupName = "")
 
-         {
 
-             InitializeComponent();
 
-             Title = title;
 
-             _existFileNames = existFileNames;
 
-             if (!string.IsNullOrEmpty(defaultGroupName))
 
-                 txtGroupName.Text = defaultGroupName;
 
-         }
 
-         #endregion
 
-         #region Properties
 
-         public string GroupName => txtGroupName.Text;
 
-         #endregion
 
-         #region Methods
 
-         protected override void OnActivated(System.EventArgs e)
 
-         {
 
-             txtGroupName.SelectAll();
 
-             txtGroupName.Focus();
 
-         }
 
-         #endregion
 
-         #region Events
 
-         private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 
-         {
 
-             // 检查文件明是否为空
 
-             if (string.IsNullOrEmpty(GroupName))
 
-             {
 
-                 txtErrors.Text = "Group Name is Empty";
 
-                 txtGroupName.SelectAll();
 
-                 txtGroupName.Focus();
 
-                 return;
 
-             }
 
-             // 检查文件名是否包含非法字符
 
-             if (GroupName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
 
-             {
 
-                 txtErrors.Text = "illegal char(s) in Group Name";
 
-                 txtGroupName.SelectAll();
 
-                 txtGroupName.Focus();
 
-                 return;
 
-             }
 
-             if (_existFileNames != null && _existFileNames.Contains(GroupName))
 
-             {
 
-                 txtErrors.Text = "Group Name has existed";
 
-                 txtGroupName.SelectAll();
 
-                 txtGroupName.Focus();
 
-                 return;
 
-             }
 
-             this.DialogResult = true;
 
-         }
 
-         private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
 
-         {
 
-             DialogResult = false;
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |