private void CommandBinding_DeleteSeries(object sender, ExecutedRoutedEventArgs e)
		{
			AnimeSeriesVM ser = e.Parameter as AnimeSeriesVM;
			if (ser == null) return;

			Window parentWindow = Window.GetWindow(this);

			try
			{
				DeleteSeriesGroupForm frm = new DeleteSeriesGroupForm();
				frm.Owner = parentWindow;
				bool? result = frm.ShowDialog();

				if (result.HasValue && result.Value == true)
				{
					//bool deleteFiles = frm.DeleteFiles;

					this.Cursor = Cursors.Wait;
					JMMServerVM.Instance.clientBinaryHTTP.DeleteAnimeSeries(ser.AnimeSeriesID.Value, frm.DeleteFiles, frm.DeleteGroups);

					MainListHelperVM.Instance.RefreshGroupsSeriesData();
					MainListHelperVM.Instance.ShowChildWrappers(MainListHelperVM.Instance.CurrentWrapper);

					MissingSeriesCollection.Remove(ser);
					ViewSeries.Refresh();

					this.Cursor = Cursors.Arrow;
				}
			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}
			finally
			{
				this.Cursor = Cursors.Arrow;
			}
		}
Ejemplo n.º 2
0
        private void CommandBinding_DeleteGroup(object sender, ExecutedRoutedEventArgs e)
        {
            EnableDisableGroupControls(false);

            try
            {
                AnimeGroupVM grp = e.Parameter as AnimeGroupVM;
                if (grp == null) return;

                DeleteSeriesGroupForm frm = new DeleteSeriesGroupForm();
                frm.Owner = this;
                bool? result = frm.ShowDialog();

                if (result.HasValue && result.Value == true)
                {
                    bool deleteFiles = frm.DeleteFiles;

                    this.Cursor = Cursors.Wait;
                    JMMServerVM.Instance.clientBinaryHTTP.DeleteAnimeGroup(grp.AnimeGroupID.Value, deleteFiles);

                    MainListHelperVM.Instance.RefreshGroupsSeriesData();
                    MainListHelperVM.Instance.ShowChildWrappers(MainListHelperVM.Instance.CurrentWrapper);
                    SetDetailBinding(null);
                    this.Cursor = Cursors.Arrow;
                }

            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableGroupControls(true);
        }