| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | 
							- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
 
- using MECF.Framework.UI.Client.ClientBase;
 
- using System.Collections.ObjectModel;
 
- using System.Linq;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- namespace MECF.Framework.UI.Client.CenterViews.Dialogs
 
- {
 
-     public class ItemsSelectDialogViewModel : ModuleUiViewModelBase
 
-     {
 
-         #region properties
 
-         public bool IsRadio { get; set; } = false;//默认支持多选
 
-         public bool IsSpin { get; set; } = false;//Spin module 选择时需要特殊处理
 
-         public int ColumnsCount { get; set; } = 1;
 
-         public ObservableCollection<Option> Items { get; set; } = new ObservableCollection<Option>();
 
-         public int ButtonHeight { get; set; } = 50;
 
-         public int ButtonWidth { get; set; } = 200;
 
-         public int ButtonMargin { get; set; } = 5;
 
-         public bool IsSingleModule { get; set; } = false;
 
-         public string Result
 
-         {
 
-             get
 
-             {
 
-                 string strRet = string.Empty;
 
-                 foreach (var item in Items.Where(x => x.IsChecked))
 
-                 {
 
-                     strRet += $",{item.Name}";
 
-                 }
 
-                 return strRet.Trim(',');
 
-             }
 
-         }
 
-         #endregion
 
-         #region Function
 
-         public void SelectItem(Option option)
 
-         {
 
-             if (IsSpin)
 
-             {
 
-                 var obj = Items.FirstOrDefault(x => x.IsChecked);
 
-                 if (obj != null)
 
-                 {
 
-                     string[] firstElement = obj.Name.Split(' ');
 
-                     if (option.Name.Split(' ')[0] != firstElement[0])
 
-                         return;
 
-                     //resist和rrc 同时只能选择一个
 
-                     if(firstElement.Length>1 && obj!=option)
 
-                     {
 
-                         string[] conflictModuleName = { "resist","rrc" };
 
-                         if(firstElement[1].ToLower().Contains("resist")||firstElement[1].ToLower().Contains("rrc"))
 
-                         {
 
-                             if (option.Name.ToLower().Contains("resist") || option.Name.ToLower().Contains("rrc"))
 
-                                 return;
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             option.IsChecked = !option.IsChecked;
 
-             if (IsRadio)
 
-             {
 
-                 foreach (var item in Items.Where(x => x != option))
 
-                 {
 
-                     item.IsChecked = false;
 
-                 }
 
-             }
 
-             try
 
-             {
 
-                 if (IsSingleModule)
 
-                 {
 
-                     foreach (var item in Items.Where(x => x.Name.Split(' ')[0] != option.Name.Split(' ')[0]))
 
-                     {
 
-                         item.IsChecked = false;
 
-                     }
 
-                 }
 
-             }
 
-             catch (System.Exception)
 
-             {
 
-             }
 
-         }
 
-         public void OK()
 
-         {
 
-             (this.GetView() as Window).DialogResult = true;
 
-         }
 
-         public void Cancel()
 
-         {
 
-             (this.GetView() as Window).DialogResult = false;
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |