public void Init(int animeID, GroupFileSummaryVM gfs)
        {
            this.Cursor = Cursors.Wait;

            GroupFileSummary = gfs;
            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.GetFilesByGroup(AnimeID,
                    GroupFileSummary.GroupName, 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))
                            types.Add(tup.Item1, tup.Item2);
                    }
                    vids.Add(vid);
                }
                FileCount = vids.Count;
                lbFiles.ItemsSource = vids;

                GroupName = GroupFileSummary.GroupName;
                SummaryText = "";
                InitImportFolders(types);

            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
		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);
			}
		}
Esempio n. 3
0
		public void Init(int animeID, GroupFileSummaryVM gfs)
		{
			this.Cursor = Cursors.Wait;

			GroupFileSummary = gfs;
			AnimeID = animeID;

			// get the videos
			try
			{
				List<JMMServerBinary.Contract_VideoDetailed> vidContracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesByGroup(AnimeID,
					GroupFileSummary.GroupName, 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 = GroupFileSummary.GroupName;
				SummaryText = "";
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}

		}