Exemplo n.º 1
0
        private void CommandBinding_UseThis(object sender, ExecutedRoutedEventArgs e)
        {
            Window parentWindow = Window.GetWindow(this);

            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            try
            {
                if (obj.GetType() == typeof(TVDBSeriesSearchResultVM))
                {
                    this.Cursor = Cursors.Wait;
                    TVDBSeriesSearchResultVM searchResult = obj as TVDBSeriesSearchResultVM;

                    // prompt to select season
                    Window wdw = Window.GetWindow(this);

                    this.Cursor = Cursors.Wait;
                    SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
                    frm.Owner = wdw;
                    frm.Init(AnimeID, AnimeName, EpisodeType.Episode, 1, searchResult.SeriesID, 1, 1, searchResult.SeriesName, Anime, null);
                    bool?result = frm.ShowDialog();
                    if (result.Value)
                    {
                        SelectedTvDBID    = searchResult.SeriesID;
                        this.DialogResult = true;
                        this.Cursor       = Cursors.Arrow;
                        this.Close();
                    }


                    //LinkAniDBToTVDB(searchResult.SeriesID, 1);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Exemplo n.º 2
0
        void btnUseThisExisting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int id = 0;
                int.TryParse(txtSeriesID.Text, out id);
                if (id <= 0)
                {
                    MessageBox.Show("Please enter a valid number as the series ID", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtSeriesID.Focus();
                    return;
                }

                this.Cursor = Cursors.Wait;

                // prompt to select season
                Window wdw = Window.GetWindow(this);

                this.Cursor = Cursors.Wait;
                SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
                frm.Owner = wdw;
                frm.Init(AnimeID, AnimeName, EpisodeType.Episode, 1, id, 1, 1, AnimeName, Anime, null);
                bool?result = frm.ShowDialog();
                if (result.Value)
                {
                    SelectedTvDBID    = id;
                    this.DialogResult = true;
                    this.Cursor       = Cursors.Arrow;
                    this.Close();
                }

                //LinkAniDBToTVDB(id, 1);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Exemplo n.º 3
0
		private void CommandBinding_UseThis(object sender, ExecutedRoutedEventArgs e)
		{
			Window parentWindow = Window.GetWindow(this);

			object obj = e.Parameter;
			if (obj == null) return;

			try
			{
				if (obj.GetType() == typeof(TVDBSeriesSearchResultVM))
				{
					this.Cursor = Cursors.Wait;
					TVDBSeriesSearchResultVM searchResult = obj as TVDBSeriesSearchResultVM;

					// prompt to select season
					Window wdw = Window.GetWindow(this);

					this.Cursor = Cursors.Wait;
					SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
					frm.Owner = wdw;
					frm.Init(AnimeID, AnimeName, EpisodeType.Episode, 1, searchResult.SeriesID, 1,1, searchResult.SeriesName, Anime, null);
					bool? result = frm.ShowDialog();
					if (result.Value)
					{
						SelectedTvDBID = searchResult.SeriesID;
						this.DialogResult = true;
						this.Cursor = Cursors.Arrow;
						this.Close();
					}


					//LinkAniDBToTVDB(searchResult.SeriesID, 1);
				}
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}
Exemplo n.º 4
0
		void btnUseThisExisting_Click(object sender, RoutedEventArgs e)
		{
			try
			{
				int id = 0;
				int.TryParse(txtSeriesID.Text, out id);
				if (id <= 0)
				{
					MessageBox.Show("Please enter a valid number as the series ID", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
					txtSeriesID.Focus();
					return;
				}

				this.Cursor = Cursors.Wait;

				// prompt to select season
				Window wdw = Window.GetWindow(this);

				this.Cursor = Cursors.Wait;
				SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
				frm.Owner = wdw;
				frm.Init(AnimeID, AnimeName, EpisodeType.Episode, 1, id, 1, 1, AnimeName, Anime, null);
				bool? result = frm.ShowDialog();
				if (result.Value)
				{
					SelectedTvDBID = id;
					this.DialogResult = true;
					this.Cursor = Cursors.Arrow;
					this.Close();
				}

				//LinkAniDBToTVDB(id, 1);
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}
Exemplo n.º 5
0
		private void CommandBinding_EditTvDBLink(object sender, ExecutedRoutedEventArgs e)
		{
			object obj = e.Parameter;
			if (obj == null) return;

			try
			{
				if (obj.GetType() == typeof(CrossRef_AniDB_TvDBVMV2))
				{
					CrossRef_AniDB_TvDBVMV2 link = obj as CrossRef_AniDB_TvDBVMV2;

					AniDB_AnimeVM anime = this.DataContext as AniDB_AnimeVM;
					if (anime == null) return;

					Window wdw = Window.GetWindow(this);

					this.Cursor = Cursors.Wait;
					SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
					frm.Owner = wdw;
					//TODO
					frm.Init(anime.AnimeID, anime.FormattedTitle, (EpisodeType)link.AniDBStartEpisodeType, link.AniDBStartEpisodeNumber, link.TvDBID,
						link.TvDBSeasonNumber, link.TvDBStartEpisodeNumber, link.TvDBTitle, anime, link.CrossRef_AniDB_TvDBV2ID);
					bool? result = frm.ShowDialog();
					if (result.Value)
					{
						// update info
						RefreshData();
					}
				}

			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}