private void abbreviationsToolStripMenuItem_Click(object sender, EventArgs e) { var dict = new Dictionary <string, string>(); var ser = new JsonSerializer <Dictionary <string, string> >(); if (File.Exists("abbreviations.dict")) { try { using (var streamReader = File.OpenText("abbreviations.dict")) { dict = ser.DeserializeFromReader(streamReader); } } catch (Exception exception) { Console.WriteLine(exception); } } var abbreviationsDictForm = new SimpleReflectionForm <Dictionary <string, string> >(dict ?? new Dictionary <string, string>(), true, "Abbreviations"); var dialogResult = abbreviationsDictForm.ShowDialog(this); if (dialogResult != DialogResult.OK) { return; } dict = abbreviationsDictForm.Obj; using (var streamWriter = new StreamWriter("abbreviations.dict")) { ser.SerializeToWriter(dict, streamWriter); } }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { var settingsForm = new SimpleReflectionForm <Settings>(_config, false, "SqlTextCommand"); settingsForm.ShowDialog(this); _config.Save(); flushConnectionString(); }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { var settingsForm = new SimpleReflectionForm <GeneratorOptions>(getGeneratorOptions(), false, "SqlTextCommand"); settingsForm.ShowDialog(this); if (settingsForm.DialogResult == DialogResult.OK) { _generatorOptions = settingsForm.Obj; } SaveProject(_generatorOptions.ProjectFile, _generatorOptions); }