public WalletViewModel(Guid id) { _id = id; this.Edit = new DelegateCommand(() => { WalletEdit.ShowEditWindow(this); }); this.Remove = new DelegateCommand(() => { if (this.Id == Guid.Empty) { return; } if (this.IsTestWallet) { return; } DialogWindow.ShowDialog(message: $"您确定删除{this.Name}钱包吗?", title: "确认", onYes: () => { Global.Execute(new RemoveWalletCommand(this.Id)); }, icon: "Icon_Confirm"); }); this.SortUp = new DelegateCommand(() => { WalletViewModel upOne = WalletViewModels.Current.WalletList.OrderByDescending(a => a.SortNumber).FirstOrDefault(a => a.CoinId == this.CoinId && a.SortNumber < this.SortNumber); if (upOne != null) { int sortNumber = upOne.SortNumber; upOne.SortNumber = this.SortNumber; Global.Execute(new UpdateWalletCommand(upOne)); this.SortNumber = sortNumber; Global.Execute(new UpdateWalletCommand(this)); CoinViewModel coinVm; if (CoinViewModels.Current.TryGetCoinVm(this.CoinId, out coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.Wallets)); } } }); this.SortDown = new DelegateCommand(() => { WalletViewModel nextOne = WalletViewModels.Current.WalletList.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.CoinId == this.CoinId && a.SortNumber > this.SortNumber); if (nextOne != null) { int sortNumber = nextOne.SortNumber; nextOne.SortNumber = this.SortNumber; Global.Execute(new UpdateWalletCommand(nextOne)); this.SortNumber = sortNumber; Global.Execute(new UpdateWalletCommand(this)); CoinViewModel coinVm; if (CoinViewModels.Current.TryGetCoinVm(this.CoinId, out coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.Wallets)); } } }); }