public MainForm() { InitializeComponent(); // Initialize all local fields _preferenceLocations = new PreferenceLocations(); _globalPreferences = new GlobalPreferences(); _localPreferences = new LocalPreferences(); }
/** * Open GlobalPrefs.js (actual location is coming from LocationPreferences.js) * and de-serialize into local field. **/ private void LoadGlobalPreferences() { using (FileStream fileStream = new FileStream(_preferenceLocations.GlobalPreferenceLocation, FileMode.OpenOrCreate, FileAccess.Read)) { if (fileStream.Length == 0) return; DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(GlobalPreferences)); _globalPreferences = serializer.ReadObject(fileStream) as GlobalPreferences; } }