public void mnuExportImage_Click(object sender, EventArgs e) { var file = FileDialog.ShowSave(FileDialog.Context.Image, "*.png|*.png"); if (string.IsNullOrEmpty(file)) { return; } pnlImagePreview.Image.Save(file); }
private static void mnuSaveText_Click(object sender, EventArgs e) { if (MessageBox.Show("This saves a copy of the strings.txt file with the English replaced by the current translated text. Where the text is not translated the line is indicated with \'>>\' before the ID.", RootApplication.AppName, MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } string filename = FileDialog.ShowSave(FileDialog.Context.Translation); if (!string.IsNullOrEmpty(filename)) { Strings.SaveList(filename, false); } }
private static void mnuSaveUntranslatedText_Click(object sender, EventArgs e) { if (MessageBox.Show("This saves a file containing any items in strings.txt which do not appear in the local language file(s)", RootApplication.AppName, MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } string filename = FileDialog.ShowSave(FileDialog.Context.Translation); if (string.IsNullOrEmpty(filename)) { return; } Strings.SaveList(filename, true); }
private static void mnuKeyTable_Click(object sender, EventArgs e) { // Generate the list of key shortcuts in HTML string filename = FileDialog.ShowSave(FileDialog.Context.OtherTechnical, "*.html|*.html"); if (string.IsNullOrEmpty(filename)) { return; } System.Text.StringBuilder output = new System.Text.StringBuilder(); output.AppendLine("<HTML>").AppendLine("<HEAD></HEAD><BODY><TABLE>"); output.AppendLine("<tr><th>Key</th><th>-</th><th>+Shift</th><th>+Control</th><th>+Shift+Control</th></tr>"); Keys previousKey = Keys.None; // some keys seem to get reported more than once; filter this out foreach (Keys key in Enum.GetValues(typeof(Keys))) { // hopefully they will come out in some sort of sensible order if (key != previousKey) { string line = GenerateKeyLine(key); if (!string.IsNullOrEmpty(line)) { output.Append(line); } line = GenerateKeyLine(key | Keys.Alt); if (!string.IsNullOrEmpty(line)) { output.Append(line); } } previousKey = key; } output.AppendLine("</TABLE></BODY></HTML>"); System.IO.StreamWriter fs = new System.IO.StreamWriter(filename, false); fs.Write(output.ToString()); fs.Close(); // I wanted to put it on the clipboard, but it turns out that HTML on the clipboard is complicated (and largely undocumented) MessageBox.Show("Saved"); }