コード例 #1
0
 private async void CoverGridMouseUp(Episode episode)
 {
     if (!isScrolling && !(await EpisodeViewMouseLeftUp(series, episode)))
     {
         EpisodeView.RightClickEvent(seriesEpisodes, episode);
     }
 }
コード例 #2
0
 private async void SearchClickEvent(Episode episode)
 {
     if (!(await SeasonView.EpisodeViewMouseLeftUp(series, episode)))
     {
         EpisodeView.RightClickEvent(this, episode);
     }
 }
コード例 #3
0
 private async void Grid_Loaded(object sender, RoutedEventArgs e)
 {
     await Task.Run(async() => {
         foreach (Episode ep in episodes)
         {
             bool isLoaded = true;
             Dispatcher.Invoke(() => { isLoaded = IsLoaded; });
             if (isLoaded)
             {
                 Episode episode = Database.GetEpisode(series.id, ep.id, true);
                 BitmapImage bmp = await Database.GetEpisodeThumbnail(series.id, ep.id);
                 Dispatcher.Invoke(() => {
                     EpisodeView epv                  = new EpisodeView(episode, true, seriesEpisodes);
                     epv.Width                        = 230;
                     epv.Height                       = 175;
                     epv.VerticalAlignment            = VerticalAlignment.Top;
                     epv.CoverGrid.MouseLeftButtonUp += (s, ev) => CoverGridMouseUp(episode);
                     epv.Opacity                      = 0;
                     if (bmp != null)
                     {
                         epv.ThumbImage.Source = bmp;
                     }
                     epv.Margin = new Thickness(5, 0, 10, 0);
                     Panel.Children.Add(epv);
                     Storyboard sb = (Storyboard)FindResource("OpacityUp");
                     sb.Begin(epv);
                 });
             }
         }
     });
 }
コード例 #4
0
        private async void Search()
        {
            SearchResultPanel.Children.Clear();
            string text = MainWindow.GetSearchBarText().ToLower();

            if (searchTask != null && searchTask.Status != TaskStatus.RanToCompletion)
            {
                isRunning = true;
                await Task.Run(() => {
                    Thread.Sleep(10);
                });
            }
            isRunning  = false;
            searchTask = Task.Run(async() => {
                text = text.Trim();
                if (!String.IsNullOrEmpty(text))
                {
                    Dispatcher.Invoke(() => {
                        SearchResultPanel.Visibility = Visibility.Visible;
                        SecondPanel.Visibility       = Visibility.Collapsed;
                    });
                    var eps = GoThroughValues(text);
                    List <UIElement> list = new List <UIElement>();
                    foreach (var ep in eps)
                    {
                        if (isRunning)
                        {
                            list = new List <UIElement>();
                            Dispatcher.Invoke(() => {
                                SearchResultPanel.Children.Clear();
                            }, DispatcherPriority.Send);
                            break;
                        }
                        Episode episode = Database.GetEpisode(series.id, ep.id, true);
                        Dispatcher.Invoke(() => {
                            EpisodeSearchResult esr = new EpisodeSearchResult(episode);
                            esr.PlayIcon.PreviewMouseLeftButtonUp += (s, ev) => SearchClickEvent(episode);
                            esr.Clickable.PreviewMouseUp          += (s, ev) => SearchClickEvent(episode);
                            esr.QuestionIcon.PreviewMouseUp       += (s, ev) => EpisodeView.RightClickEvent(this, episode);
                            esr.Height = 60;
                            SearchResultPanel.Children.Add(esr);
                        }, DispatcherPriority.Send);
                    }
                }
                else
                {
                    Dispatcher.Invoke(() => {
                        SearchResultPanel.Visibility = Visibility.Collapsed;
                        SecondPanel.Visibility       = Visibility.Visible;
                    });
                }
            });
        }