private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Filter = "JSON files (*.json)|*.json" }; using (ofd) { DialogResult ofdResult = ofd.ShowDialog(this); if (ofdResult == DialogResult.OK && File.Exists(ofd.FileName)) { if (service.AreParametersChanged) { ExitForm exitForm = new ExitForm(service); DialogResult result = exitForm.ShowDialog(this); } service.ReadNewParameters(ofd.FileName); selectedTemplate = service.Templates.FirstOrDefault(); SyncUIParams(true); } } }