Пример #1
0
        public MainForm()
        {
            InitializeComponent();

            _dataStores = new[]
            {
                typeof (CommaSeperatedFileDataStore),
                typeof (FlatFileDataStore),
                typeof (SqlDataStore),
                typeof (MemoryDataStore)
            };

            _settings = new Settings();
        }
Пример #2
0
        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();
            }
        }