Esempio n. 1
0
        void btnUseThisExisting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int id = 0;
                int.TryParse(txtMALID.Text, out id);
                if (id <= 0)
                {
                    MessageBox.Show("Please enter a valid number as the MAL ID", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtMALID.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtMALTitle.Text.Trim()))
                {
                    MessageBox.Show("Please enter a title for the show", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtMALTitle.Focus();
                    return;
                }

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

                this.Cursor = Cursors.Wait;
                SelectMALStartForm frm = new SelectMALStartForm();
                frm.Owner = wdw;
                frm.Init(AnimeID, AnimeName_MAL, txtMALTitle.Text.Trim(), id, null, null);
                bool?result = frm.ShowDialog();
                if (result.Value)
                {
                    this.DialogResult = true;
                    this.Cursor       = Cursors.Arrow;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Esempio n. 2
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(MALSearchResultVM))
                {
                    this.Cursor = Cursors.Wait;
                    MALSearchResultVM searchResult = obj as MALSearchResultVM;

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

                    this.Cursor = Cursors.Wait;
                    SelectMALStartForm frm = new SelectMALStartForm();
                    frm.Owner = wdw;
                    frm.Init(AnimeID, AnimeName_MAL, searchResult.title, searchResult.id, null, null);
                    bool?result = frm.ShowDialog();
                    if (result.Value)
                    {
                        this.DialogResult = true;
                        this.Cursor       = Cursors.Arrow;
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Esempio 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(MALSearchResultVM))
				{
					this.Cursor = Cursors.Wait;
					MALSearchResultVM searchResult = obj as MALSearchResultVM;

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

					this.Cursor = Cursors.Wait;
					SelectMALStartForm frm = new SelectMALStartForm();
					frm.Owner = wdw;
					frm.Init(AnimeID, AnimeName_MAL, searchResult.title, searchResult.id, null, null);
					bool? result = frm.ShowDialog();
					if (result.Value)
					{
						this.DialogResult = true;
						this.Cursor = Cursors.Arrow;
						this.Close();

					}
				}
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}
Esempio n. 4
0
		private void CommandBinding_EditMALLink(object sender, ExecutedRoutedEventArgs e)
		{
			object obj = e.Parameter;
			if (obj == null) return;

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

				if (obj.GetType() == typeof(CrossRef_AniDB_MALVM))
				{
					this.Cursor = Cursors.Wait;
					CrossRef_AniDB_MALVM malLink = obj as CrossRef_AniDB_MALVM;

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

					SelectMALStartForm frm = new SelectMALStartForm();
					frm.Owner = wdw;
					frm.Init(malLink.AnimeID, anime.FormattedTitle, malLink.MALTitle, malLink.MALID, malLink.StartEpisodeType, malLink.StartEpisodeNumber);
					bool? result = frm.ShowDialog();
					if (result.Value)
					{
						// update info
						RefreshData();
					}
				}
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}
Esempio n. 5
0
		void btnUseThisExisting_Click(object sender, RoutedEventArgs e)
		{
			try
			{
				int id = 0;
				int.TryParse(txtMALID.Text, out id);
				if (id <= 0)
				{
					MessageBox.Show("Please enter a valid number as the MAL ID", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
					txtMALID.Focus();
					return;
				}

				if (string.IsNullOrEmpty(txtMALTitle.Text.Trim()))
				{
					MessageBox.Show("Please enter a title for the show", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
					txtMALTitle.Focus();
					return;
				}

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

				this.Cursor = Cursors.Wait;
				SelectMALStartForm frm = new SelectMALStartForm();
				frm.Owner = wdw;
				frm.Init(AnimeID, AnimeName_MAL, txtMALTitle.Text.Trim(), id, null, null);
				bool? result = frm.ShowDialog();
				if (result.Value)
				{
					this.DialogResult = true;
					this.Cursor = Cursors.Arrow;
					this.Close();

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