Example #1
0
        private void CommandBinding_CreateSeriesFromAnime(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;
            if (obj == null) return;

            try
            {
                if (obj.GetType() == typeof(AniDB_AnimeVM) || obj.GetType() == typeof(AniDB_Anime_SimilarVM))
                {
                    AniDB_AnimeVM anime = null;

                    if (obj.GetType() == typeof(AniDB_AnimeVM))
                        anime = (AniDB_AnimeVM)obj;

                    if (obj.GetType() == typeof(AniDB_Anime_SimilarVM))
                        anime = ((AniDB_Anime_SimilarVM)obj).AniDB_Anime;

                    // check if a series already exists
                    bool seriesExists = JMMServerVM.Instance.clientBinaryHTTP.GetSeriesExistingForAnime(anime.AnimeID);
                    if (seriesExists)
                    {
                        MessageBox.Show(Properties.Resources.ERROR_SeriesExists, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    NewSeries frmNewSeries = new NewSeries();
                    frmNewSeries.Owner = this;
                    frmNewSeries.Init(anime, anime.FormattedTitle);

                    bool? result = frmNewSeries.ShowDialog();
                    if (result.HasValue && result.Value == true)
                    {

                    }
                }
                else
                {
                    NewSeries frm = new NewSeries();
                    frm.Owner = this;
                    frm.Init(0, "");
                    bool? result = frm.ShowDialog();
                    if (result.HasValue && result.Value == true)
                    {

                    }
                }

            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
        void btnAddSeries_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                NewSeries frm = new NewSeries();
                frm.Owner = GetTopParent();
                frm.Init(0, "");
                bool? result = frm.ShowDialog();
                if (result.HasValue && result.Value == true)
                {
                    RefreshSeries();

                    AnimeSeriesVM ser = frm.AnimeSeries;
                    txtSeriesSearch.Text = ser.AniDB_Anime.FormattedTitle;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }