private void SysDicItemDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { DataGrid dg = (DataGrid)sender; if (dg.SelectedItem != null) { SysDicItemViewModel poolVm = (SysDicItemViewModel)dg.SelectedItem; poolVm.Edit.Execute(null); } }
public static void ShowEditWindow(SysDicItemViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { IsDialogWindow = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_SysDic" }, ucFactory: (window) => { SysDicItemViewModel vm = new SysDicItemViewModel(source); vm.CloseWindow = () => window.Close(); return(new SysDicItemEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, SysDicItemViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "系统字典项", FormType = formType, Width = 520, IsMaskTheParent = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_SysDic" }, ucFactory: (window) => { SysDicItemViewModel vm = new SysDicItemViewModel(source); window.AddCloseWindowOnecePath(vm.Id); return(new SysDicItemEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, SysDicItemViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "系统字典项", FormType = formType, Width = 520, IsMaskTheParent = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_SysDic" }, ucFactory: (window) => { SysDicItemViewModel vm = new SysDicItemViewModel(source); window.AddOnecePath <CloseWindowCommand>("处理关闭窗口命令", LogEnum.DevConsole, action: message => { window.Close(); }, pathId: vm.Id, location: typeof(SysDicItemEdit)); return(new SysDicItemEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, SysDicItemViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "系统字典项", FormType = formType, Width = 520, IsDialogWindow = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_SysDic" }, ucFactory: (window) => { SysDicItemViewModel vm = new SysDicItemViewModel(source) { CloseWindow = () => window.Close() }; return(new SysDicItemEdit(vm)); }, fixedSize: true); }
public static void ShowEditWindow(SysDicItemViewModel source) { string title; if (!DevMode.IsDevMode) { title = "字典项详情"; } else { if (NTMinerRoot.Current.SysDicItemSet.ContainsKey(source.Id)) { title = "编辑字典项"; } else { title = "添加字典项"; } } ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = title, IsDialogWindow = true, SaveVisible = System.Windows.Visibility.Visible, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_SysDic", OnOk = (uc) => { var vm = ((SysDicItemEdit)uc).Vm; if (NTMinerRoot.Current.SysDicItemSet.ContainsKey(source.Id)) { Global.Execute(new UpdateSysDicItemCommand(vm)); } else { Global.Execute(new AddSysDicItemCommand(vm)); } return(true); } }, ucFactory: (window) => { SysDicItemViewModel vm = new SysDicItemViewModel(source.Id).Update(source); return(new SysDicItemEdit(vm)); }, fixedSize: true); }
public SysDicItemEdit(SysDicItemViewModel vm) { this.Vm = vm; this.DataContext = vm; InitializeComponent(); }
public SysDicItemEditCommand(FormType formType, SysDicItemViewModel source) { this.FormType = formType; this.Source = source; }
public bool TryGetValue(Guid id, out SysDicItemViewModel vm) { return(_dicById.TryGetValue(id, out vm)); }
private SysDicItemViewModels() { #if DEBUG Write.Stopwatch.Restart(); #endif VirtualRoot.BuildEventPath <ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole, action: message => { _dicById.Clear(); Init(); }); VirtualRoot.BuildEventPath <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole, action: message => { OnPropertyChangeds(); }); AppContextEventPath <SysDicItemAddedEvent>("添加了系统字典项后调整VM内存", LogEnum.DevConsole, action: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { _dicById.Add(message.Source.GetId(), new SysDicItemViewModel(message.Source)); OnPropertyChangeds(); SysDicViewModel sysDicVm; if (AppContext.Instance.SysDicVms.TryGetSysDicVm(message.Source.DicId, out sysDicVm)) { sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItems)); sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItemsSelect)); } } }); AppContextEventPath <SysDicItemUpdatedEvent>("更新了系统字典项后调整VM内存", LogEnum.DevConsole, action: (message) => { if (_dicById.ContainsKey(message.Source.GetId())) { SysDicItemViewModel entity = _dicById[message.Source.GetId()]; int sortNumber = entity.SortNumber; entity.Update(message.Source); if (sortNumber != entity.SortNumber) { SysDicViewModel sysDicVm; if (AppContext.Instance.SysDicVms.TryGetSysDicVm(entity.DicId, out sysDicVm)) { sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItems)); sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItemsSelect)); } } } }); AppContextEventPath <SysDicItemRemovedEvent>("删除了系统字典项后调整VM内存", LogEnum.DevConsole, action: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); SysDicViewModel sysDicVm; if (AppContext.Instance.SysDicVms.TryGetSysDicVm(message.Source.DicId, out sysDicVm)) { sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItems)); sysDicVm.OnPropertyChanged(nameof(sysDicVm.SysDicItemsSelect)); } }); Init(); #if DEBUG Write.DevTimeSpan($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor"); #endif }
public SysDicItemEdit(SysDicItemViewModel vm) { this.DataContext = vm; InitializeComponent(); ResourceDictionarySet.Instance.FillResourceDic(this, this.Resources); }
public AlgoSelectItem(SysDicItemViewModel sysDicItemVm, bool isChecked) { _sysDicItemVm = sysDicItemVm; _isChecked = isChecked; }