public void Refresh(DeviceBasicInfo devSimpleInfo) { Reset(); DeviceInfo = devSimpleInfo; if (DeviceState.None != DeviceInfo.State) { ConnectStatusText = App.Current.Resources["lbConnectedDevice"].ToString(); } DeviceStateText = App.Current.Resources[$"deviceState{devSimpleInfo.State}"].ToString(); switch (devSimpleInfo.State) { case DeviceState.Poweron: case DeviceState.Recovery: PoweronRefresh(devSimpleInfo); break; case DeviceState.Fastboot: Task.Run(() => { var product = new DeviceInfoGetterInFastboot(devSimpleInfo.Serial).GetProduct(); Dispatcher.Invoke(() => { DeviceName = product; }); }); break; case DeviceState.Unauthorized: case DeviceState.Offline: break; } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { new TBLoadingEffect(TBLoading).Start(); Task.Run(() => { try { DeviceSerialNumber serial = null; this.Dispatcher.Invoke(() => { serial = ShowInfo.Serial; }); var product = new DeviceInfoGetterInFastboot(serial).GetProduct(); this.Dispatcher.Invoke(() => { TBSerial.Text += product == null ? null : "--" + product; }); } catch (Exception ex) { Logger.Warn(this, "A exception happend when getting product info on fastboot", ex); } }); }