private void OnDeviceDisconnected(object sender, DeviceDataEventArgs e) { try { var disconnectedDeviceViewModel = new AndroidDeviceViewModel(e.Device); ThreadingExtensions.DispatchOnUIThread(() => AndroidDeviceViewModels.Remove(disconnectedDeviceViewModel)); } catch (Exception exception) { LoggingService.Logger.Error(exception.Message); } }
private void UpdateConnectedDevices() { // Here we're using adbclient to get devices instead of DeviceMonitor.GetDevices() because the latter // doesn't return the full DeviceData just the serial number IEnumerable <DeviceData> connectedDevices = _adbClient.GetDevices(); foreach (DeviceData device in connectedDevices) { var deviceViewModel = new AndroidDeviceViewModel(device); ThreadingExtensions.DispatchOnUIThread(() => AndroidDeviceViewModels.Add(deviceViewModel)); } }
public async Task UpdateVersions(ObservableCollection <BLVersion> versions) { await ThreadingExtensions.StartSTATask <int>(() => SetMSAUserToken()); versions.Clear(); LoadFromLocalCache(versions); await LoadFromURL(versions); LoadFromUserCache(versions); await LoadFromAPI(versions); await LoadFromAPI_Technical(); }
private void OnDeviceConnected(object sender, DeviceDataEventArgs e) { try { // Sleep for a few seconds otherwise device data not complete, this is a bug Thread.Sleep(1000); DeviceData connectedDevice = _adbClient.GetDevices().Find(device => device.Serial == e.Device.Serial); var connectedDeviceViewModel = new AndroidDeviceViewModel(connectedDevice); if (!AndroidDeviceViewModels.Contains(connectedDeviceViewModel)) { ThreadingExtensions.DispatchOnUIThread(() => AndroidDeviceViewModels.Add(connectedDeviceViewModel)); } } catch (Exception exception) { LoggingService.Logger.Error(exception.Message); } }
/// <summary> /// Loads the toolbars. /// </summary> /// <remarks>...</remarks> private void LoadToolbars() { StartBar = new StartBar(); if (Settings.Current.UseThumbailsBar) { ThumbnailsBar = new ThumbnailsBar(); } if (Settings.Current.UseThumbailsBar) { ThumbnailsBar.OpenToolbar(); } StartBar.OpenToolbar(); ThreadingExtensions.LazyInvokeThreadSafe(() => { if (Settings.Current.UseThumbailsBar) { ThumbnailsBar.CloseToolbar(); } StartBar.CloseToolbar(); }, 250); }
/// <summary> /// Toggles the wait dialog. /// </summary> /// <param name="circles">if set to <c>true</c> [circles].</param> /// <param name="text">The text.</param> /// <remarks>...</remarks> internal void ToggleWaitDialog(bool circles = true, string text = null) { if (WaitDialog == null || !WaitDialog.IsLoaded) { WaitDialog = new WaitWindow(); WaitDialog.Show(); if (!string.IsNullOrWhiteSpace(text)) { WaitDialog.Text.Text = text; } WaitDialog.Start(circles); } else { WaitDialog.Stop(); ThreadingExtensions.LazyInvokeThreadSafe(() => { WaitDialog.Hide(); WaitDialog.Close(); WaitDialog = null; }, 600); WinAPI.FlushMemory(); } }