public async Task RemoveLivestream() { if (StreamsModel.SelectedLivestream == null) { return; } var dialogResult = await this.ShowMessageAsync("Remove livestream", $"Are you sure you want to remove livestream '{StreamsModel.SelectedLivestream.DisplayName}'?", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Remove" }); if (dialogResult == MessageDialogResult.Affirmative) { try { await StreamsModel.RemoveLivestream(StreamsModel.SelectedLivestream.ChannelIdentifier); } catch (Exception ex) { await this.ShowMessageAsync("Error Removing Stream", $"Error removing '{StreamsModel.SelectedLivestream.DisplayName}': {ex.Message}" + Environment.NewLine + Environment.NewLine + $"TIP: You may have to remove the livestream directly from the livestreams.json file... :("); } } // return focus to the datagrid after showing the remove livestream dialog this.SetFocus("LivestreamListDataGrid"); }
public ActionResult Streams(int gameId) { TwitchApi twitch = new TwitchApi(_key); StreamsModel games = twitch.GetStreams(_clientId, gameId); StreamsViewModel gamesVm = _mapper.Map <StreamsViewModel>(games); return(View(gamesVm)); }
public async Task RefreshLivestreams() { refreshTimer.Stop(); try { await StreamsModel.RefreshLivestreams(); refreshErrorCount = 0; // only reactive the timer if we're still on this screen if (IsActive) { refreshTimer.Start(); } } catch (Exception ex) { if (!IsActive) { return; } refreshErrorCount++; // keep trying to refresh until we hit too many consecutive errors if (refreshErrorCount >= 3) { Execute.OnUIThread(async() => { await this.ShowMessageAsync("Error refreshing livestreams", ex.ExtractErrorMessage()); refreshTimer.Start(); }); } else { refreshTimer.Start(); } } }
public async Task RefreshLivestreams() { refreshTimer.Stop(); try { await StreamsModel.RefreshLivestreams(); refreshErrorCount = 0; // only reactive the timer if we're still on this screen if (IsActive) { refreshTimer.Start(); } } catch (AggregateException aggregateException) { if (!IsActive) { return; } refreshErrorCount++; // keep trying to refresh until we hit too many consecutive errors unless it's our first query if (refreshCount == 0 || refreshErrorCount >= 3) { foreach (var ex in aggregateException.InnerExceptions) { var messageDialogResult = await this.ShowMessageAsync( "Error refreshing livestreams", ex.ExtractErrorMessage(), MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { NegativeButtonText = "Ignore" }); if (messageDialogResult == MessageDialogResult.Negative) { StreamsModel.IgnoreQueryFailure(ex.Message); } } refreshTimer.Start(); } else { refreshTimer.Start(); } } catch (Exception ex) { if (!IsActive) { return; } refreshErrorCount++; await this.ShowMessageAsync("Error refreshing livestreams", ex.ExtractErrorMessage()); } refreshCount++; }