Пример #1
0
		private void RefreshRecords()
		{
			try
			{
				IsDataLoading = true;
				IsDataFinishedLoading = false;

				VideoQualityRecords.Clear();
				GroupSummaryRecords.Clear();

				TotalFileCount = 0;

				AniDB_AnimeVM anime = this.DataContext as AniDB_AnimeVM;
				if (anime == null) return;

				if (IsGroupQualityDetails)
				{
					List<JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(anime.AnimeID);
					foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ)
					{
						GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract);
						TotalFileCount += vidQual.FileCountNormal + vidQual.FileCountSpecials;
						VideoQualityRecords.Add(vidQual);
					}
				}

				if (IsGroupSummary)
				{
					List<JMMServerBinary.Contract_GroupFileSummary> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupFileSummary(anime.AnimeID);
					foreach (JMMServerBinary.Contract_GroupFileSummary contract in summ)
					{
						GroupFileSummaryVM vidQual = new GroupFileSummaryVM(contract);
						TotalFileCount += vidQual.FileCountNormal + vidQual.FileCountSpecials;
						GroupSummaryRecords.Add(vidQual);
					}
				}

				IsDataLoading = false;
				IsDataFinishedLoading = true;
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
		}
        public void Init(int animeID, GroupVideoQualityVM gvq)
        {
            this.Cursor = Cursors.Wait;

            GroupVideoQuality = gvq;
            AnimeID = animeID;

            // get the videos
            try
            {
                JMMServerVM.Instance.RefreshCloudAccounts();
                dict = JMMServerVM.Instance.FolderProviders.ToDictionary(a => a.CloudID ?? 0, a=>new Tuple<string,BitmapImage>(a.Provider,a.Icon));
                chks = new Dictionary<string, bool>();
                Dictionary<string, BitmapImage> types=new Dictionary<string, BitmapImage>();

                List<JMMServerBinary.Contract_VideoDetailed> vidContracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesByGroupAndResolution(AnimeID,
                    GroupVideoQuality.GroupName, GroupVideoQuality.Resolution, GroupVideoQuality.VideoSource, GroupVideoQuality.VideoBitDepth, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                vids = new List<VideoDetailedVM>();
                foreach (JMMServerBinary.Contract_VideoDetailed contract in vidContracts)
                {
                    VideoDetailedVM vid = new VideoDetailedVM(contract);
                    foreach (VideoLocal_PlaceVM vv in vid.Places)
                    {
                        Tuple<string, BitmapImage> tup = dict[vv.ImportFolder.CloudID ?? 0];
                        if (!types.ContainsKey(tup.Item1))
                        {
                            chks[tup.Item1] = true;
                            types.Add(tup.Item1, tup.Item2);
                        }
                    }
                    vids.Add(vid);
                }

                FileCount = vids.Count;
                lbFiles.ItemsSource = vids;
                GroupName = GroupVideoQuality.GroupName;
                SummaryText = string.Format("{0} - {1}", GroupVideoQuality.VideoSource, GroupVideoQuality.Resolution);
                InitImportFolders(types);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
		void searchWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
		{
			try
			{
				List<TorrentLinkVM> links = e.Result as List<TorrentLinkVM>;
				TorrentCount = links.Count;

				foreach (TorrentLinkVM link in links)
					TorrentLinks.Add(link);

				ViewTorrentLinks.Refresh();

				List<GroupVideoQualityVM> vidQualListTemp = new List<GroupVideoQualityVM>();

				if (CurrentSearchCriteria.SearchType == DownloadSearchType.Episode)
				{
					AnimeEpisodeVM ep = CurrentSearchCriteria.SearchParameter as AnimeEpisodeVM;
					if (ep.AniDB_Anime == null) ep.RefreshAnime();
					if (ep.AniDB_Anime != null)
					{
						
						List<JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(ep.AniDB_Anime.AnimeID);
						foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ)
						{
							GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract);
							vidQualListTemp.Add(vidQual);
						}
					}
				}
				if (CurrentSearchCriteria.SearchType == DownloadSearchType.Series)
				{
					AniDB_AnimeVM anime = CurrentSearchCriteria.SearchParameter as AniDB_AnimeVM;
					if (anime != null)
					{
						List<JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(anime.AnimeID);
						foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ)
						{
							GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract);
							vidQualListTemp.Add(vidQual);
						}
					}
				}

				ShowSubGroupSuggestions(vidQualListTemp);

				TorrentSearchStatus = string.Format("{0} Results", links.Count);
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
				this.IsEnabled = true;
			}
		}
Пример #4
0
		public void Init(int animeID, GroupVideoQualityVM gvq)
		{
			this.Cursor = Cursors.Wait;

			GroupVideoQuality = gvq;
			AnimeID = animeID;

			// get the videos
			try
			{
				List<JMMServerBinary.Contract_VideoDetailed> vidContracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesByGroupAndResolution(AnimeID,
					GroupVideoQuality.GroupName, GroupVideoQuality.Resolution, GroupVideoQuality.VideoSource, GroupVideoQuality.VideoBitDepth, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
				vids = new List<VideoDetailedVM>();
				foreach (JMMServerBinary.Contract_VideoDetailed contract in vidContracts)
				{
					VideoDetailedVM vid = new VideoDetailedVM(contract);
					vids.Add(vid);
				}
				FileCount = vids.Count;
				lbFiles.ItemsSource = vids;

				GroupName = GroupVideoQuality.GroupName;
				SummaryText = string.Format("{0} - {1}", GroupVideoQuality.VideoSource, GroupVideoQuality.Resolution);
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}

		}