private void OnDeviceConnected(object sender, DeviceDataEventArgs e) { Thread.Sleep(500); // Giving time for thinking to device Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { if (connectWindow != null) { CloseConnectWindow(); } switch (AdbClient.Instance.GetDevices().First().State) { case DeviceState.Online: try { GrantPermission(); } catch { // ignored } break; case DeviceState.Unauthorized: device = AdbClient.Instance.GetDevices().First(); //Showing help window to authorize server authorizeWindow = new AuthorizeWindow() { Owner = Application.Current.MainWindow }; authorizeWindow.Show(); AdbClient.Instance.GetDevices(); authorizeWindow.ContentRendered += AuthorizeWindowContentRendered; break; default: OpenConnectWindow(); break; } })); }
private void CloseAuthorizeWindow() { authorizeWindow.Close(); authorizeWindow = null; }