private void Init() { foreach (var item in NTMinerRoot.Instance.ServerContext.FragmentWriterSet.AsEnumerable()) { FragmentWriterViewModel groupVm = new FragmentWriterViewModel(item); _dicById.Add(item.GetId(), groupVm); } }
private void Init() { foreach (var item in NTMinerRoot.Instance.FragmentWriterSet) { FragmentWriterViewModel groupVm = new FragmentWriterViewModel(item); _dicById.Add(item.GetId(), groupVm); } }
private FragmentWriterViewModels() { if (WpfUtil.IsInDesignMode) { return; } #if DEBUG NTStopwatch.Start(); #endif this.Add = new DelegateCommand(() => { new FragmentWriterViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add); }); VirtualRoot.AddEventPath <ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole, action: message => { _dicById.Clear(); Init(); }, location: this.GetType()); VirtualRoot.AddEventPath <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole, action: message => { OnPropertyChangeds(); }, location: this.GetType()); AddEventPath <FragmentWriterAddedEvent>("添加了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { FragmentWriterViewModel groupVm = new FragmentWriterViewModel(message.Source); _dicById.Add(message.Source.GetId(), groupVm); OnPropertyChangeds(); } }, location: this.GetType()); AddEventPath <FragmentWriterUpdatedEvent>("更新了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (_dicById.TryGetValue(message.Source.GetId(), out FragmentWriterViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); AddEventPath <FragmentWriterRemovedEvent>("删除了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); }, location: this.GetType()); Init(); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public static void ShowWindow(FormType formType, FragmentWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "命令行片段书写器", FormType = formType, IsMaskTheParent = true, Width = 950, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FragmentWriter" }, ucFactory: (window) => { FragmentWriterViewModel vm = new FragmentWriterViewModel(source); window.AddCloseWindowOnecePath(vm.Id); return(new FragmentWriterEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, FragmentWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "命令行片段书写器", FormType = formType, IsDialogWindow = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FragmentWriter" }, ucFactory: (window) => { FragmentWriterViewModel vm = new FragmentWriterViewModel(source) { CloseWindow = () => window.Close() }; return(new FragmentWriterEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, FragmentWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "命令行片段书写器", FormType = formType, IsMaskTheParent = true, Width = 950, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FragmentWriter" }, ucFactory: (window) => { FragmentWriterViewModel vm = new FragmentWriterViewModel(source); window.AddOnecePath <CloseWindowCommand>("处理关闭窗口命令", LogEnum.DevConsole, action: message => { window.Close(); }, pathId: vm.Id, location: typeof(FragmentWriterEdit)); return(new FragmentWriterEdit(vm)); }, fixedSize: true); }
private FragmentWriterViewModels() { #if DEBUG Write.Stopwatch.Restart(); #endif this.Add = new DelegateCommand(() => { new FragmentWriterViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add); }); VirtualRoot.On <ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole, action: message => { _dicById.Clear(); Init(); }); VirtualRoot.On <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole, action: message => { OnPropertyChangeds(); }); On <FragmentWriterAddedEvent>("添加了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { FragmentWriterViewModel groupVm = new FragmentWriterViewModel(message.Source); _dicById.Add(message.Source.GetId(), groupVm); OnPropertyChangeds(); } }); On <FragmentWriterUpdatedEvent>("更新了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (_dicById.ContainsKey(message.Source.GetId())) { FragmentWriterViewModel entity = _dicById[message.Source.GetId()]; entity.Update(message.Source); } }); On <FragmentWriterRemovedEvent>("删除了命令行片段书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); }); Init(); #if DEBUG Write.DevTimeSpan($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor"); #endif }
private FragmentWriterViewModels() { if (WpfUtil.IsInDesignMode) { return; } this.Add = new DelegateCommand(() => { new FragmentWriterViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add); }); VirtualRoot.BuildEventPath <ServerContextReInitedEvent>("刷新VM内存", LogEnum.DevConsole, path: message => { _dicById.Clear(); Init(); }, location: this.GetType()); VirtualRoot.BuildEventPath <ServerContextReInitedEventHandledEvent>("刷新视图界面", LogEnum.DevConsole, path: message => { OnPropertyChangeds(); }, location: this.GetType()); BuildEventPath <FragmentWriterAddedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { FragmentWriterViewModel vm = new FragmentWriterViewModel(message.Source); _dicById.Add(message.Source.GetId(), vm); OnPropertyChangeds(); } }, location: this.GetType()); BuildEventPath <FragmentWriterUpdatedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { if (_dicById.TryGetValue(message.Source.GetId(), out FragmentWriterViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); BuildEventPath <FragmentWriterRemovedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); }, location: this.GetType()); Init(); }
public FragmentWriterEditCommand(FormType formType, FragmentWriterViewModel source) { this.FormType = formType; this.Source = source; }
public FragmentWriterEdit(FragmentWriterViewModel vm) { this.DataContext = vm; InitializeComponent(); }
public bool TryGetFragmentWriterVm(Guid groupId, out FragmentWriterViewModel groupVm) { return(_dicById.TryGetValue(groupId, out groupVm)); }