private async void MenuItemRefreshUpdateList_Click(object sender, RoutedEventArgs e) { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); v.UpdateList = new ObservableCollection <VideoVM>(); foreach (ConfigVM c in v.ConfigList) { if (c.Selected) { ObservableCollection <VideoVM> list = new ObservableCollection <VideoVM>(await GetVideoList(c.Keyword, c.CategoryId, c.TeamId)); if (list != null) { c.LastRefresh = DateTime.Now.ToString("yyyy-MM-dd dddd HH:mm:ss"); if (list.Count > 0) { c.LastUpdate = list[0].PubDate; foreach (VideoVM item in list) { if (!this.db.VideoExisted(item)) { v.UpdateList.Add(item); } } } } } this.db.AddConfigWithRemove(c); } v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private async void MenuItemDownloadMagnetLink2_Click(object sender, RoutedEventArgs e) { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); if (v.SelectedVideo != null) { if (await DownloadVideo(v.SelectedVideo.MagnetLink)) { this.db.AddVideoWithCheck(v.SelectedVideo); v.UpdateList.Remove(v.SelectedVideo); } } v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private void MenuItemDeleteConfig_Click(object sender, RoutedEventArgs e) { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); if (v.SelectedConfig != null) { if (this.db.ConfigExisted(v.SelectedConfig)) { this.db.RemoveConfig(v.SelectedConfig); } if (v.ConfigList.Contains(v.SelectedConfig)) { v.ConfigList.Remove(v.SelectedConfig); } } v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private async void ButtonSearch_Click(object sender, RoutedEventArgs e) { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); ConfigVM c = v.CurrentConfig; List <VideoVM> list = await GetVideoList(c.Keyword, c.CategoryId, c.TeamId); if (list != null) { v.SearchResults = new ObservableCollection <VideoVM>(list); foreach (VideoVM item in v.SearchResults) { if (this.db.VideoExisted(item)) { item.Downloaded = true; } } } v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private void ButtonAddConfig_Click(object sender, RoutedEventArgs e) { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); ConfigVM config = new ConfigVM(v.CurrentConfig); if (v.ConfigList.Contains(config)) { if (MessageBox.Show("同名配置已存在,是否覆盖?", "警告", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes) { v.ConfigList.Remove(config); v.ConfigList.Add(config); this.db.AddConfigWithRemove(config); } } else { v.ConfigList.Add(config); this.db.AddConfigWithRemove(config); } v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private async Task UpdateAndDownloadVideo() { ConfigManageTabVM v = this.view.ConfigManageTab; v.SetStatus(ConfigManageTabVM.OpStatus.BUSY); LogUtil.Log("-> start."); foreach (ConfigVM c in v.ConfigList) { if (c.Selected) { List <VideoVM> list = await GetVideoList(c.Keyword, c.CategoryId, c.TeamId); if (list != null) { c.LastRefresh = DateTime.Now.ToString("yyyy-MM-dd dddd HH:mm:ss"); if (list.Count > 0) { c.LastUpdate = list[0].PubDate; foreach (VideoVM item in list) { if (!this.db.VideoExisted(item)) { if (await DownloadVideo(item.MagnetLink)) { this.db.AddVideoWithCheck(item); } } } } } } this.db.AddConfigWithRemove(c); } LogUtil.Log("-> complete."); v.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }