public MainForm() { InitializeComponent(); _dataStores = new[] { typeof (CommaSeperatedFileDataStore), typeof (FlatFileDataStore), typeof (SqlDataStore), typeof (MemoryDataStore) }; _settings = new Settings(); }
private void LoadButtonClick(object sender, EventArgs e) { using (var dialog = new OpenFileDialog()) { dialog.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath); dialog.Filter = "JSON (*.json)|*.json"; if (dialog.ShowDialog(this) != DialogResult.OK) { return; } var data = File.ReadAllText(dialog.FileName); _settings = Serializer.Deserialize<Settings>(data); ApplySettings(); } }