private void btnLoad_Click(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog(); of.Title = "Open a Kaede Translation file..."; of.Filter = "Kaede Translation File (*.ktf)|*.ktf"; if (of.ShowDialog() == DialogResult.OK) { try { stringList.Items.Clear(); localeSelectionBox.Items.Clear(); localeSelectionBox.Text = ""; k = Kaede.FromFile(of.FileName); refreshBoxStates(); updateButtonStates(); localeSelectionBox.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(string.Format("An internal error has occured while opening your translation file.\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnCreate_Click(object sender, EventArgs e) { SaveFileDialog of = new SaveFileDialog(); of.Title = "Create a new Kaede Translation file..."; of.Filter = "Kaede Translation File (*.ktf)|*.ktf"; if (of.ShowDialog() == DialogResult.OK) { try { stringList.Items.Clear(); localeSelectionBox.Items.Clear(); localeSelectionBox.Text = ""; k = new Kaede() { TranslationFilePath = of.FileName }; updateButtonStates(); } catch (Exception ex) { MessageBox.Show(string.Format("An internal error has occured while opening your translation file.\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnUnload_Click(object sender, EventArgs e) { if (k != null) { if (MessageBox.Show("Do you want to save your translation file before unloading?", "Unloading process", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { k.SaveTranslationFile(); } } k = null; stringList.Items.Clear(); localeSelectionBox.Items.Clear(); localeSelectionBox.Text = ""; updateButtonStates(); }