Exemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

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