public async Task InitializeStreamingAsync() { IsBusy = true; try { // Asks the view the UI element in which to start camera streaming. Messenger.Default.Send(new NotificationMessageAction <object>(Constants.InitializeStreaming, async(video) => { var successful = false; try { await streamingService.InitializeAsync(); await streamingService.StartStreamingAsync(Settings.CameraPanel, video); successful = (streamingService.CurrentState == ScenarioState.Streaming); } catch { } finally { if (!IsVisionServiceRegistered) { StatusMessage = AppResources.ServiceNotRegistered; await SpeechHelper.TrySpeechAsync(AppResources.ServiceNotRegistered); } else if (successful) { await this.NotifyCameraPanelAsync(); } else { await this.NotifyInitializationErrorAsync(); } } })); } catch { await this.NotifyInitializationErrorAsync(); } initialized = true; IsBusy = false; }
public async Task InitializeAsync() { try { // Retrieves tha authorization token for the translator service. var task = translatorService.InitializeAsync(); // Asks the view the UI element in which to start camera streaming. Messenger.Default.Send(new NotificationMessageAction <object>(Constants.InitializeStreaming, async(video) => { var successful = false; try { await streamingService.InitializeAsync(); await streamingService.StartStreamingAsync(Settings.CameraPanel, video); successful = (streamingService.CurrentState == ScenarioState.Streaming); } catch { } finally { if (successful) { await this.NotifyCameraPanelAsync(); } else { await this.NotifyInitializationErrorAsync(); } } })); } catch { await this.NotifyInitializationErrorAsync(); } }