private void btnConfirm_Click(object sender, RoutedEventArgs e) { var code = this.battery_code.Text.Trim(); var result = BatteryManage.NgBatteryOutFromPack(code); if (result.IsSucceed) { tip.Background = new SolidColorBrush(Colors.Green); tip.Text = "移除成功"; tip.Visibility = Visibility.Visible; var sortPack = Current.SortPacks.FirstOrDefault(o => o.SortResult == sortResult); if (sortPack != null) { sortPack.Count = PackManage.GetPackCount(this.packId); } this.sort_result.Content = ""; this.pack_code.Content = ""; this.pack_battery_count.Content = ""; } else { tip.Background = new SolidColorBrush(Colors.Red); tip.Text = result.Msg; tip.Visibility = Visibility.Visible; } }
public void Comm() { lock (this) { if (BatteryManage.GetFirstBatteryNotUpload(out Battery battery).IsSucceed) { var result = BatteryManage.Upload(battery); if (result.IsFailed) { return; } this.RealtimeStatus = battery.Code + " OK"; } this.IsAlive = true; } }