private async Task WatchTaskAsync(Task task) { try { await task; } catch (Exception ex) { _log.Error(ex); } OnPropertyChanged(nameof(Status)); OnPropertyChanged(nameof(IsCompleted)); OnPropertyChanged(nameof(IsNotCompleted)); if (task.IsCanceled) { OnPropertyChanged(nameof(IsCanceled)); } else if (task.IsFaulted) { OnPropertyChanged(nameof(IsFaulted)); OnPropertyChanged(nameof(Exception)); OnPropertyChanged(nameof(InnerException)); OnPropertyChanged(nameof(ErrorMessage)); } else { OnPropertyChanged(nameof(IsSuccessfullyCompleted)); OnPropertyChanged(nameof(Result)); } }
public async Task <UrlParseResult> Parse(string data, ParseResultType type) { var url = new Uri(data.Trim()); try { switch (url.DnsSafeHost) { case "youtu.be": url = new Uri(url.AbsoluteUri.Replace(@"youtu.be/", @"youtube.com/watch?v=")); return(await Parse(url, type)); case "www.youtube.com": return(await Parse(url, type)); default: return(new UrlParseResult(_log)); } } catch (Exception ex) { _log.Error(this, ex); return(new UrlParseResult(_log)); } }
public int Get(IList <ISequence> items) { var result = 0; if (items.Count > 0) { while (items.Any(p => p.Sequence == result)) { if (result == int.MaxValue) { _log.Error(Resources.MaxPlaylistCountReachedException); break; } result++; } } return(result); }