Esempio n. 1
0
        public SeriesManagerElements(SeriesLogModel series_log)
        {
            InitializeComponent();

            this.series_log = series_log;
            Loaded         += SeriesManagerElements_Loaded1;
        }
Esempio n. 2
0
        private void CompleteSeries()
        {
            Application.Current.Dispatcher.BeginInvoke(new Action(
                                                           delegate
            {
                DownloadStatusPanel.Visibility = Visibility.Collapsed;
                ErrorMessageGrid.Visibility    = Visibility.Collapsed;

                if (!Settings.Instance.Model.AutoZip)
                {
                    DownloadState.Text = "다운로드 완료";
                }
                complete_download = true;
            }));

            List <string> archive  = new List <string>();
            List <string> subtitle = new List <string>();

            switch (manager.Type)
            {
            case ManagerType.SingleArticleSingleImage:
            {
            }
            break;

            case ManagerType.SingleArticleSingleMovie:
            {
            }
            break;

            case ManagerType.SingleArticleMultipleImages:
            {
                archive.AddRange(article.ImagesLink);
                subtitle.Add(title);
            }
            break;

            case ManagerType.SingleSeriesMultipleArticles:
            {
                archive.AddRange(series.Archive);
                series.Articles.ForEach(x => subtitle.Add(x.Title));
            }
            break;
            }

            if (series_log == null)
            {
                SeriesLog.Instance.Add(series_log = new SeriesLogModel
                {
                    URL              = url,
                    Title            = title,
                    Thumbnail        = thumbnail,
                    Archive          = archive.ToArray(),
                    Subtitle         = subtitle.ToArray(),
                    LatestUpdateTime = DateTime.Now
                });
                SeriesLog.Instance.Save();

                Application.Current.Dispatcher.BeginInvoke(new Action(
                                                               delegate
                {
                    LatestSyncDate.Text = MakeSyncDate(DateTime.Now - series_log.LatestUpdateTime);
                }));
            }
            else
            {
                SeriesLog.Instance.Model.Remove(series_log);

                var v = series_log.Archive.ToList();
                v.AddRange(archive);
                series_log.Archive = v.ToArray();

                var s = series_log.Subtitle.ToList();
                s.AddRange(subtitle);
                series_log.Subtitle = s.ToArray();

                series_log.LatestUpdateTime = DateTime.Now;

                SeriesLog.Instance.Add(series_log);
                SeriesLog.Instance.Save();

                Application.Current.Dispatcher.BeginInvoke(new Action(
                                                               delegate
                {
                    LatestSyncDate.Text  = MakeSyncDate(DateTime.Now - series_log.LatestUpdateTime);
                    SyncButton.IsEnabled = false;
                }));
            }
        }