public static void ShowWindow(FormType formType, FileWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "文件书写器", FormType = formType, IsMaskTheParent = true, Width = 950, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FileWriter" }, ucFactory: (window) => { FileWriterViewModel vm = new FileWriterViewModel(source); window.AddCloseWindowOnecePath(vm.Id); return(new FileWriterEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, FileWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "文件书写器", FormType = formType, IsDialogWindow = true, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FileWriter" }, ucFactory: (window) => { FileWriterViewModel vm = new FileWriterViewModel(source) { CloseWindow = () => window.Close() }; return(new FileWriterEdit(vm)); }, fixedSize: true); }
public static void ShowWindow(FormType formType, FileWriterViewModel source) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "文件书写器", FormType = formType, IsMaskTheParent = true, Width = 950, CloseVisible = System.Windows.Visibility.Visible, IconName = "Icon_FileWriter" }, ucFactory: (window) => { FileWriterViewModel vm = new FileWriterViewModel(source); window.AddOnecePath <CloseWindowCommand>("处理关闭窗口命令", LogEnum.DevConsole, action: message => { window.Close(); }, pathId: vm.Id, location: typeof(FileWriterEdit)); return(new FileWriterEdit(vm)); }, fixedSize: true); }
private FileWriterViewModels() { #if DEBUG VirtualRoot.Stopwatch.Restart(); #endif this.Add = new DelegateCommand(() => { new FileWriterViewModel(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 <FileWriterAddedEvent>("添加了文件书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { FileWriterViewModel groupVm = new FileWriterViewModel(message.Source); _dicById.Add(message.Source.GetId(), groupVm); OnPropertyChangeds(); } }); On <FileWriterUpdatedEvent>("更新了文件书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { if (_dicById.ContainsKey(message.Source.GetId())) { FileWriterViewModel entity = _dicById[message.Source.GetId()]; entity.Update(message.Source); } }); On <FileWriterRemovedEvent>("删除了文件书写器后调整VM内存", LogEnum.DevConsole, action: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); }); Init(); #if DEBUG Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor"); #endif }
private FileWriterViewModels() { if (WpfUtil.IsInDesignMode) { return; } this.Add = new DelegateCommand(() => { new FileWriterViewModel(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 <FileWriterAddedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { if (!_dicById.ContainsKey(message.Source.GetId())) { FileWriterViewModel groupVm = new FileWriterViewModel(message.Source); _dicById.Add(message.Source.GetId(), groupVm); OnPropertyChangeds(); } }, location: this.GetType()); BuildEventPath <FileWriterUpdatedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { if (_dicById.TryGetValue(message.Source.GetId(), out FileWriterViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); BuildEventPath <FileWriterRemovedEvent>("调整VM内存", LogEnum.DevConsole, path: (message) => { _dicById.Remove(message.Source.GetId()); OnPropertyChangeds(); }, location: this.GetType()); Init(); }
public bool TryGetFileWriterVm(Guid groupId, out FileWriterViewModel groupVm) { return(_dicById.TryGetValue(groupId, out groupVm)); }
public FileWriterEdit(FileWriterViewModel vm) { this.DataContext = vm; InitializeComponent(); }
public FileWriterEditCommand(FormType formType, FileWriterViewModel source) { this.FormType = formType; this.Source = source; }