예제 #1
0
        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);
            }
        }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }
예제 #5
0
 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);
 }
예제 #6
0
        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);
        }
예제 #7
0
 public SysDicItemEdit(SysDicItemViewModel vm)
 {
     this.Vm          = vm;
     this.DataContext = vm;
     InitializeComponent();
 }
예제 #8
0
파일: Messages.cs 프로젝트: vebin/ntminer
 public SysDicItemEditCommand(FormType formType, SysDicItemViewModel source)
 {
     this.FormType = formType;
     this.Source   = source;
 }
예제 #9
0
 public bool TryGetValue(Guid id, out SysDicItemViewModel vm)
 {
     return(_dicById.TryGetValue(id, out vm));
 }
예제 #10
0
            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
            }
예제 #11
0
 public SysDicItemEdit(SysDicItemViewModel vm)
 {
     this.DataContext = vm;
     InitializeComponent();
     ResourceDictionarySet.Instance.FillResourceDic(this, this.Resources);
 }
예제 #12
0
 public AlgoSelectItem(SysDicItemViewModel sysDicItemVm, bool isChecked)
 {
     _sysDicItemVm = sysDicItemVm;
     _isChecked    = isChecked;
 }