/// <summary> /// Call this function instead of ShowDialog, to check for remembered /// result. /// </summary> /// <returns></returns> public MemoryBoxResult ShowMemoryDialog() { result = MemoryBoxResult.Cancel; if (lastResult == MemoryBoxResult.NoToAll) { result = MemoryBoxResult.No; } else if (lastResult == MemoryBoxResult.YesToAll) { result = MemoryBoxResult.Yes; } else { base.ShowDialog(); } return(result); }
/// <summary> /// Call this function instead of ShowDialog, to check for remembered /// result. /// </summary> /// <returns></returns> public MemoryBoxResult ShowMemoryDialog() { result = MemoryBoxResult.Cancel; if (lastResult == MemoryBoxResult.NoToAll) { result = MemoryBoxResult.No; } else if (lastResult == MemoryBoxResult.YesToAll) { result = MemoryBoxResult.Yes; } else { base.ShowDialog(); } return result; }
private void CSharpLibraryForm_FormClosing(object sender, FormClosingEventArgs e) { if (StatusLabel_FileName.Text.EndsWith("*")) { MemoryBox box = new MemoryBox(); MemoryBoxResult rt = box.ShowCloseMemoryDialog(StatusLabel_FileName.Text.TrimEnd('*'), true); if (rt == MemoryBoxResult.Yes) { Button_Save_Click(sender, e); } else if (rt == MemoryBoxResult.Cancel) { e.Cancel = true; return; } else if (rt == MemoryBoxResult.NoToAll) { return; } } }
private void buttonCancel_Click(object sender, EventArgs e) { result = MemoryBoxResult.Cancel; lastResult = MemoryBoxResult.Cancel; DialogResult = DialogResult.Cancel; }
private void buttonNotoAll_Click(object sender, EventArgs e) { result = MemoryBoxResult.No; lastResult = MemoryBoxResult.NoToAll; DialogResult = DialogResult.No; }
private void buttonYestoAll_Click(object sender, EventArgs e) { result = MemoryBoxResult.Yes; lastResult = MemoryBoxResult.YesToAll; DialogResult = DialogResult.Yes; }
private void btnSave_Click(object sender, EventArgs e) { Bitmap[] currentBitmaps = tbViewer.GetSelectedBitmaps(); if (currentBitmaps.Count() == 1) { if (sfdSprite.ShowDialog() == DialogResult.OK) { currentBitmaps[0].Save(sfdSprite.FileName, System.Drawing.Imaging.ImageFormat.Bmp); } } else if (currentBitmaps.Count() > 1) { if (fbdSprites.ShowDialog() == DialogResult.OK) { MemoryBoxResult result = MemoryBoxResult.Null; for (int i = 0; i < currentBitmaps.Count(); i++) { string filename = String.Format("{0}\\Sprite_{1}.bmp", fbdSprites.SelectedPath, i.ToString("000")); if (File.Exists(filename)) { if (result == MemoryBoxResult.Null) { MemoryBox memoryBox = new MemoryBox(); result = memoryBox.ShowMemoryDialog( String.Format("The file \"Sprite_{0}.bmp\" already exists, overwrite?", i.ToString("000")), "Overwrite Files?"); } else { if (result == MemoryBoxResult.Cancel) { break; } switch ((MemoryBoxResult)result) { case MemoryBoxResult.Yes: currentBitmaps[i].Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); result = MemoryBoxResult.Null; break; case MemoryBoxResult.YesToAll: currentBitmaps[i].Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); break; case MemoryBoxResult.No: result = MemoryBoxResult.Null; break; } } } else { currentBitmaps[i].Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); } // End - if (File.Exists(filename)) } // End - for (int i = 0; i < currentBitmaps.Count(); i++) { } // End - if (fbdSprites.ShowDialog() == DialogResult.OK) } // End - else if (currentBitmaps.Count() > 1) }
private void buttonYes_Click(object sender, EventArgs e) { result = MemoryBoxResult.Yes; lastResult = MemoryBoxResult.Yes; DialogResult = DialogResult.Yes; }
private void buttonNo_Click(object sender, EventArgs e) { result = MemoryBoxResult.No; lastResult = MemoryBoxResult.No; DialogResult = DialogResult.No; }