예제 #1
0
        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!unselectAll)
            {
                image1.Source = null;           //This image field is for pictures where the width is bigger than the height
                image2.Source = null;           //This image field is for pictures where the width is smaller than the height

                string tmp = ((sender as System.Windows.Controls.ListBox).SelectedItem.ToString());

                Anime anime = animeList.getAnimeByTitle(tmp);
                try
                {
                    if (anime.getPathImg().Contains("png") || anime.getPathImg().Contains("jpg"))
                    {
                        try
                        {
                            BitmapImage img = new BitmapImage(new Uri(anime.getPathImg()));
                            if (img.Width > img.Height)
                            {
                                image1.Source = img;
                            }
                            else
                            {
                                image2.Source = img;
                            }
                        }
                        catch (DirectoryNotFoundException)
                        {
                            image2.Source = new BitmapImage(new Uri(("pack://application:,,,/Resources/NewNoImageFound1.PNG")));
                        }
                    }
                    else
                    {
                        image2.Source = new BitmapImage(new Uri(("pack://application:,,,/Resources/NewNoImageFound1.PNG")));
                    }
                }
                catch (UriFormatException)
                {
                }
                fansub.Text      = anime.buildStringOfFansubs();
                episode.Text     = anime.getEpisode().ToString();
                title.Text       = anime.getTitle();
                subtitle.Text    = anime.buildStringOfSub();
                voice.Text       = anime.buildStringOfVoice();
                source.Text      = anime.buildStringOfSource();
                description.Text = anime.getDescription();
                if (anime.getPathOfEpisode().Length != 0)
                {
                    listBoxOfEpisode.ItemsSource = pathRemover.removeFullPathFromFiles(anime.getPathOfEpisode());   //remove full path from media files
                }
                else
                {
                    listBoxOfEpisode.ItemsSource = anime.getPathOfEpisode();
                }
            }
        }