private void menuExportChannels_Click(object sender, EventArgs e) { using (Channels dlgChannels = new Channels()) { if (dlgChannels.ShowDialog() == DialogResult.OK) { // Don't bypass dlg, since there's only 1 or 4 images being saved ExportChannelMediator(dlgChannels.colourChannel, false); } } }
private void menuBatchChannels_Click(object sender, EventArgs e) { using (Channels dlgChannels = new Channels()) { if (dlgChannels.ShowDialog() == DialogResult.OK) { // To return to after iterating int tmp = curImgIndex; curImgIndex = 0; // using for loop instead of foreach because the index is needed to get name, filetype etc. in other methods. // dlgChannels.Bypass is a bool that dictates whether to bypass dlg for (curImgIndex = 0; curImgIndex < listLoadedImg.Count; curImgIndex++) { UpdatePicbox(listLoadedImg[curImgIndex]); // Assign the export format choice to the class listLoadedImg[curImgIndex].UpdateExportFormat(dlgChannels.fileType); ExportChannelMediator(dlgChannels.colourChannel, dlgChannels.bypass); // Clear the format choice, to avoid polluting future usage listLoadedImg[curImgIndex].UpdateExportFormat(null); } curImgIndex = tmp; UpdatePicbox(listLoadedImg[curImgIndex]); } } }