예제 #1
0
        private void Button_Click_Watch(object sender, RoutedEventArgs e)
        {
            AnimeInfo selectedAnime = ListView.SelectedValue as AnimeInfo;

            if (ListView.SelectedValue != null)
            {
                if (string.IsNullOrEmpty(selectedAnime.Url))
                {
                    MessageBox.Show("This anime does not have a url associated with it! Please add one to use the watch feature.");
                    return;
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    var url = selectedAnime.Url.Replace("&", "^&");
                    Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")
                    {
                        CreateNoWindow = true
                    });
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    Process.Start("xdg-open", selectedAnime.Url);
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Process.Start("open", selectedAnime.Url);
                }
            }
            else
            {
                MessageBox.Show("Please select an anime");
            }
        }
        private void Button_Click_Watch(object sender, RoutedEventArgs e)
        {
            AnimeInfo selectedAnime = ListView.SelectedValue as AnimeInfo;

            if (selectedAnime.Url == "" || selectedAnime.Url == null)
            {
                return;
            }

            string           application = Environment.GetEnvironmentVariable("ProgramFiles(x86)") + @"\Google\Chrome\Application\chrome.exe";
            ProcessStartInfo info        = new ProcessStartInfo(application, selectedAnime.Url);


            Process.Start(info);
        }
예제 #3
0
        private void Button_Click_Watch(object sender, RoutedEventArgs e)
        {
            AnimeInfo selectedAnime = ListView.SelectedValue as AnimeInfo;

            if (ListView.SelectedValue != null)
            {
                string           application = Environment.GetEnvironmentVariable("ProgramFiles(x86)") + @"\Google\Chrome\Application\chrome.exe";
                ProcessStartInfo info        = new ProcessStartInfo(application, selectedAnime.Url);
                Process.Start(info);
            }
            else
            {
                MessageBox.Show("Please select an anime");
            }
        }
예제 #4
0
        private void Button_Click_Move_To(object sender, RoutedEventArgs e)
        {
            if (ListView.SelectedValue == null)
            {
                return;
            }

            MenuItem menuItem     = sender as MenuItem;
            int      selectedList = this.ComboBox.SelectedIndex;
            int      listToSendTo = -1;

            switch (menuItem.Header)
            {
            case "Currently Watching":
                listToSendTo = 0;
                break;

            case "Up To Date":
                listToSendTo = 1;
                break;

            case "Finished":
                listToSendTo = 2;
                break;

            case "Queue":
                listToSendTo = 3;
                break;
            }

            if (selectedList == listToSendTo)
            {
                return;
            }

            AnimeInfo animeToMove = ListView.SelectedValue as AnimeInfo;

            dict[selectedList].Remove(animeToMove);
            dict[listToSendTo].Add(animeToMove);

            this.ListView.Items.Refresh();
            JsonManager.Save(dict);
        }
        private void Button_Click_Up(object sender, RoutedEventArgs e)
        {
            if (ListView.SelectedValue == null)
            {
                return;
            }

            AnimeInfo selectedAnime = ListView.SelectedValue as AnimeInfo;

            List <AnimeInfo> animeInfo = dict[this.ComboBox.SelectedIndex];

            int index = animeInfo.FindIndex(x => x == selectedAnime) - 1;

            if (index >= 0)
            {
                animeInfo.Remove(ListView.SelectedItem as AnimeInfo);
                animeInfo.Insert(index, selectedAnime);
            }

            this.ListView.Items.Refresh();
            JsonManager.Save(dict);
        }
        private void Button_Click_Edit(object sender, RoutedEventArgs e)
        {
            if (ListView.SelectedValue == null)
            {
                return;
            }

            AnimeInfo animeInfo = ListView.SelectedValue as AnimeInfo;

            AddDialogBox addDialogBox = new AddDialogBox("Edit Anime", animeInfo.Name, animeInfo.SeasonCount, animeInfo.EpisodeCount, animeInfo.Url);

            addDialogBox.Owner = this;


            addDialogBox.ShowDialog();


            if (addDialogBox.DialogResult == false)
            {
                return;
            }


            AnimeInfo result = addDialogBox.AnimeResult;

            animeInfo.Name = result.Name;

            animeInfo.SeasonCount = result.SeasonCount;

            animeInfo.EpisodeCount = result.EpisodeCount;

            animeInfo.Url = result.Url;


            this.ListView.Items.Refresh();
            JsonManager.Save(dict);
        }
예제 #7
0
 private void okButton_Click(object sender, RoutedEventArgs e)
 {
     AnimeResult = new AnimeInfo(this.nameTextBox.Text, this.seasonCountTextBox.Text, this.episodeCountTextBox.Text, this.urlTextBox.Text);
     // Dialog box accepted
     DialogResult = true;
 }