private void StartSaveOperation(SplitChannelSettings target) { if (Split_AreThereErrors) { return; } CommonSaveFileDialog dialog = new CommonSaveFileDialog { DefaultFileName = "Output", DefaultExtension = "png", Filters = { new CommonFileDialogFilter("PNG File", "png") } }; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { try { target.Cache.Save(dialog.FileName); MessageBox.Show("Image successfully saved."); } catch { MessageBox.Show("An error has occurred generating and saving the final image, no image was saved. Please check this application has the required permissions to read/write the images."); } } else { MessageBox.Show("Operation cancelled, no image was saved."); } }
//------------------------------------------------------------------------------------// /*---------------------------------- METHODS -----------------------------------------*/ //------------------------------------------------------------------------------------// private void Split_Initialize() { // Add Error Dependencies _split_errorDependencies.Add(new Tuple <string, ICanHaveErrors>("Image Picker", Split_ImagePicker)); // Subscribe To Their Changes Split_ImagePicker.StateChanged += (sender, args) => { Split_UpdateVisualElements(); OnMainStateChanged(); }; _split_r = new SplitChannelSettings(Split_RPreview, Split_RPreviewTooltip, Split_InvertCheckboxR, Split_SaveR, Split_ImagePicker, EChannel.R); _split_g = new SplitChannelSettings(Split_GPreview, Split_GPreviewTooltip, Split_InvertCheckboxG, Split_SaveG, Split_ImagePicker, EChannel.G); _split_b = new SplitChannelSettings(Split_BPreview, Split_BPreviewTooltip, Split_InvertCheckboxB, Split_SaveB, Split_ImagePicker, EChannel.B); _split_a = new SplitChannelSettings(Split_APreview, Split_APreviewTooltip, Split_InvertCheckboxA, Split_SaveA, Split_ImagePicker, EChannel.A); Split_InvertCheckboxR.Checked += (s, a) => { _split_r.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxR.Unchecked += (s, a) => { _split_r.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxG.Checked += (s, a) => { _split_g.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxG.Unchecked += (s, a) => { _split_g.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxB.Checked += (s, a) => { _split_b.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxB.Unchecked += (s, a) => { _split_b.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxA.Checked += (s, a) => { _split_a.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; Split_InvertCheckboxA.Unchecked += (s, a) => { _split_a.UpdateVisualElements(Split_Errors); OnMainStateChanged(); }; }