async void BtnNext_Click(object sender, RoutedEventArgs e) { var supportsPin = true; if (supportsPin) { await _nav.Navigate(new StartupWizardPage2(_nav, _connectionManager, _presentation, _logger)); } else { Dispatcher.InvokeAsync(() => _presentation.ShowModalLoadingAnimation()); try { var connectionResult = await _connectionManager.Connect(CancellationToken.None); Dispatcher.InvokeAsync(() => _presentation.HideModalLoadingAnimation()); if (connectionResult.State == ConnectionState.Unavailable) { await _nav.Navigate(new StartupPageServerEntry(_nav, _connectionManager, _presentation, _logger)); } else { App.Instance.NavigateFromConnectionResult(connectionResult); } } catch (Exception) { Dispatcher.InvokeAsync(() => _presentation.HideModalLoadingAnimation()); } } }
private async void GoNext() { StopPinTimer(); _presentation.ShowModalLoadingAnimation(); try { var connectionResult = await _connectionManager.Connect(CancellationToken.None); _presentation.HideModalLoadingAnimation(); if (connectionResult.State == ConnectionState.Unavailable) { connectionResult.State = ConnectionState.ServerSelection; } App.Instance.NavigateFromConnectionResult(connectionResult); return; } catch (Exception) { _presentation.HideModalLoadingAnimation(); } await _nav.Navigate(new StartupPageServerEntry(_nav, _connectionManager, _presentation, _logger)); }
async void BtnApply_Click(object sender, RoutedEventArgs e) { if (ValidateInput()) { var serverAddress = string.Format("http://{0}", TxtHost.Text); if (!string.IsNullOrEmpty(TxtPort.Text)) { serverAddress += ":" + TxtPort.Text; } _presentationManager.ShowModalLoadingAnimation(); try { using (var client = new HttpClient()) { var json = await client.GetStringAsync(serverAddress + "/mediabrowser"); } _apiClient.ChangeServerLocation(serverAddress); _config.Configuration.ServerAddress = serverAddress; _config.SaveConfiguration(); _presentationManager.HideModalLoadingAnimation(); _presentationManager.ShowMessage(new MessageBoxInfo { Button = MessageBoxButton.OK, Caption = "Connection Confirmed", Icon = MessageBoxIcon.Information, Text = "The new server location has been confirmed. Press OK to login." }); await _session.Logout(); } catch (Exception) { _presentationManager.HideModalLoadingAnimation(); _presentationManager.ShowMessage(new MessageBoxInfo { Button = MessageBoxButton.OK, Caption = "Error", Icon = MessageBoxIcon.Error, Text = "Unable to establish a connection with the server. Please check your connection information and try again." }); } } }
private async void WaitForServerToRestart() { PresentationManager.ShowModalLoadingAnimation(); try { await WaitForServerToRestartInternal(); } finally { PresentationManager.HideModalLoadingAnimation(); } }
private async void WaitForServerToRestart(IApiClient apiClient) { PresentationManager.ShowModalLoadingAnimation(); try { await WaitForServerToRestartInternal(apiClient); } finally { PresentationManager.HideModalLoadingAnimation(); FocusElement(); } }