bool ValidateData(ItemsControl items) { if (!Validator.IsValid(items)) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Amount")); return(false); } if (_regexRule == null) { _regexRule = new RegexRule(); } if (!SendItems.Any(x => _regexRule.MatchAll(x.Address, _addressPattern))) { ShowMessage(LanguageService.Default.GetLanguageValue(ValidationType.Error_Address.ToString())); return(false); } if (SendItems.Any(x => string.IsNullOrEmpty(x.PayAmountStr))) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Amount")); return(false); } //if (SendItems.Any(x => x.PayAmount < Fee)) //{ // ShowMessage(LanguageService.Default.GetLanguageValue(MessageKeys.Error_SendOverMinFee)); // return false; //} var allAmount = SendItems.Sum(x => x.Amount); if (allAmount > OverMoney) { ShowMessage(LanguageService.Default.GetLanguageValue(MessageKeys.Error_SendOverMax)); return(false); } return(true); }
bool ValidateData(ItemsControl items) { //if (!AmountMonitor.Default.IsSyncComplete) //{ // ShowMessage(LanguageService.Default.GetLanguageValue("Error_Sync")); // return false; //} if (!Validator.IsValid(items)) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Amount")); return(false); } if (_regexRule == null) { _regexRule = new RegexRule(); } if (SendItems.Any(x => string.IsNullOrEmpty(x.Address) || !_regexRule.MatchAll(x.Address.Trim(), _addressPattern))) { ShowMessage(LanguageService.Default.GetLanguageValue(ValidationType.Error_Address.ToString())); return(false); } if (SendItems.Any(x => string.IsNullOrEmpty(x.PayAmountStr))) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Amount")); return(false); } var sendAmount = SendItems.Sum(x => x.Amount); //需要重新选择UTXO if (StaticViewModel.GlobalViewModel.IsEnableProfessional) { var utxo = StaticViewModel.GlobalViewModel.ProfessionalSetting.UTXO; if (utxo == null) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Utxo")); return(false); } var amount = StaticViewModel.GlobalViewModel.ProfessionalSetting.UTXO.Sum(x => x.Amount); if (amount < sendAmount) { ShowMessage(LanguageService.Default.GetLanguageValue("Error_Utxo")); return(false); } } else { if (sendAmount > OverMoney) { ShowMessage(LanguageService.Default.GetLanguageValue(MessageKeys.Error_SendOverMax)); return(false); } } SendItems.ToList().ForEach(x => x.Address = x.Address.Trim()); return(true); }