private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (Properties.Settings1.Default.SkipTutorial == false &&
         Properties.Settings1.Default.Done1 == false)
     {
         WizardMain wizardMain = new WizardMain(0, 0, false);
         wizardMain.Show();
         Properties.Settings1.Default.Done1 = true;
         Properties.Settings1.Default.Save();
     }
 }
        private void Worker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result is TwitchClip[] twitchClipsExist)
            {
                filterdpDateFrom.SelectedDate     = firstDate;
                filterdpDateFrom.DisplayDateStart = firstDate;
                filterdpDateFrom.DisplayDateEnd   = lastDate;
                filterdpDateTo.SelectedDate       = lastDate;
                filterdpDateTo.DisplayDateStart   = firstDate;
                filterdpDateTo.DisplayDateEnd     = lastDate;
                filtertbViewCountFrom.Text        = viewMinimum.ToString();
                prevCountFrom            = viewMinimum.ToString();
                filtertbViewCountTo.Text = viewMaximum.ToString();
                prevCountTo           = viewMaximum.ToString();
                mscbGames.ItemsSource = this.twitchGames;
                if (this.worker != null)
                {
                    this.worker.CancelAsync();
                }
                ThumbnailLength                 = (e.Result as TwitchClip[]).Count();
                ThumbnailCount                  = ThumbnailLength - listTwitchClipToThumbnail.Count;
                statusBarThumbnailPB.Value      = ThumbnailCount * 100 / ThumbnailLength;
                statusBarThumbnailTB.Text       = $"클립 미리보기 생성중 ({ThumbnailCount}/{ThumbnailLength}) ";
                statusBarThumbnailSP.Visibility = Visibility.Visible;
                this.worker = new BackgroundWorker();
                this.worker.WorkerReportsProgress = true;
                this.worker.DoWork             += Worker_DoWork;
                this.worker.ProgressChanged    += Worker_ProgressChanged;
                this.worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
                this.worker.RunWorkerAsync();

                this.twitchClips       = twitchClipsExist;
                filterDP.IsEnabled     = true;
                loadingGrid.Visibility = Visibility.Hidden;
                pressSearch.Visibility = Visibility.Visible;
                orderList.IsEnabled    = true;

                if (Properties.Settings1.Default.SkipTutorial == false &&
                    Properties.Settings1.Default.Done2 == false)
                {
                    WizardMain wizardMain = new WizardMain(1, 0, false);
                    wizardMain.Show();
                    Properties.Settings1.Default.Done2 = true;
                    Properties.Settings1.Default.Save();
                }
            }
        }
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            WizardMain wizardMain = new WizardMain(0, 0, true);

            wizardMain.Show();
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (twitchClips != null)
     {
         filterDP.IsEnabled = false;
         string   title    = filtertbTitle.Text;
         DateTime dateFrom = filterdpDateFrom.SelectedDate ?? this.firstDate;
         DateTime dateTo   = filterdpDateTo.SelectedDate ?? this.lastDate;
         if (dateFrom > dateTo)
         {
             DateTime temp = dateTo;
             dateTo   = dateFrom;
             dateFrom = temp;
             filterdpDateFrom.SelectedDate = dateFrom;
             filterdpDateTo.SelectedDate   = dateTo;
         }
         dateTo = dateTo.AddDays(1);
         string creator       = filtertbCreator.Text;
         int    viewCountFrom = viewMinimum;
         int.TryParse(filtertbViewCountFrom.Text.Replace(",", ""), out viewCountFrom);
         int viewCountTo = viewMaximum;
         int.TryParse(filtertbViewCountTo.Text.Replace(",", ""), out viewCountTo);
         if (viewCountFrom > viewCountTo)
         {
             int temp = viewCountFrom;
             viewCountFrom = viewCountTo;
             viewCountTo   = temp;
             filtertbViewCountFrom.Text = viewCountFrom.ToString();
             filtertbViewCountTo.Text   = viewCountTo.ToString();
         }
         pressSearch.Visibility  = Visibility.Hidden;
         duringSearch.Visibility = Visibility.Visible;
         BackgroundWorker workerSearch = new BackgroundWorker();
         workerSearch.DoWork += (sender, e) =>
         {
             Dictionary <string, TwitchGameStrict> selectedGames = new Dictionary <string, TwitchGameStrict>();
             foreach (TwitchGameStrict twitchGame in twitchGameSelected)
             {
                 selectedGames.Add(twitchGame.id, twitchGame);
             }
             twitchClipsFiltered = twitchClips.Where((twitchClip) =>
             {
                 if (String.IsNullOrEmpty(title) == false)
                 {
                     if (twitchClip.title.Contains(title, StringComparison.CurrentCultureIgnoreCase) == false)
                     {
                         return(false);
                     }
                 }
                 if (String.IsNullOrEmpty(creator) == false)
                 {
                     if (twitchClip.creator_name.Contains(creator, StringComparison.CurrentCultureIgnoreCase) == false)
                     {
                         return(false);
                     }
                 }
                 if (viewCountFrom <= twitchClip.view_count && twitchClip.view_count <= viewCountTo)
                 {
                 }
                 else
                 {
                     return(false);
                 }
                 if (dateFrom <= twitchClip.created_at.ToLocalTime() && twitchClip.created_at.ToLocalTime() <= dateTo)
                 {
                 }
                 else
                 {
                     return(false);
                 }
                 if (selectedGames.Count != 0)
                 {
                     if (selectedGames.ContainsKey(twitchClip.game_id) == false)
                     {
                         return(false);
                     }
                 }
                 return(true);
             }).ToArray();
             Sorting();
         };
         workerSearch.RunWorkerCompleted += (sender, e) =>
         {
             if (this.twitchClipsFiltered != null)
             {
                 statusBarSearchResult.Text = "검색된 클립: " + twitchClipsFiltered.Count().ToString() + "개";
                 duringSearch.Visibility    = Visibility.Hidden;
                 if (Properties.Settings1.Default.SkipTutorial == false)
                 {
                     if (Properties.Settings1.Default.Done3 == false)
                     {
                         WizardMain wizardMain = new WizardMain(2, 0, false);
                         wizardMain.Show();
                         Properties.Settings1.Default.Done3 = true;
                         Properties.Settings1.Default.Save();
                     }
                     else if (Properties.Settings1.Default.Done4 == false)
                     {
                         WizardMain wizardMain = new WizardMain(3, 0, false);
                         wizardMain.Show();
                         Properties.Settings1.Default.Done4 = true;
                         Properties.Settings1.Default.Save();
                     }
                 }
                 lv1.ItemsSource    = new ObservableCollection <TwitchClip>(this.twitchClipsFiltered);
                 filterDP.IsEnabled = true;
             }
         };
         workerSearch.RunWorkerAsync();
     }
     else
     {
     }
 }