Example #1
0
        private void SaveUserPreferences()
        {
            UserPrefs prefs = new UserPrefs();

            prefs.Server          = txtServer.Text;
            prefs.ExportDirectory = txtExportRootDir.Text;

            UserPrefsRepository prefsRepository = new UserPrefsRepository();

            prefsRepository.SaveUserPrefs(prefs);
        }
        public virtual void SaveUserPrefs(UserPrefs prefs)
        {
            EnsureDirectoryExists();

            try
            {
                using (StreamWriter sr = new StreamWriter(ConfigFilePath))
                {
                    serializer.Serialize(sr, prefs);
                }
            }
            catch (UnauthorizedAccessException) { }
            catch (SecurityException) { }
        }
Example #3
0
        public virtual void SaveUserPrefs(UserPrefs prefs)
        {
            EnsureDirectoryExists();

            try
            {
                using (StreamWriter sr = new StreamWriter(ConfigFilePath))
                {
                    serializer.Serialize(sr, prefs);
                }
            }
            catch (UnauthorizedAccessException) { }
            catch (SecurityException) { }
        }
Example #4
0
        private void LoadUserPreferences()
        {
            UserPrefsRepository prefsRepository = new UserPrefsRepository();
            UserPrefs           prefs           = prefsRepository.LoadUserPrefs();

            if (!string.IsNullOrEmpty(prefs.ExportDirectory))
            {
                txtExportRootDir.Text = prefs.ExportDirectory;
            }
            else
            {
                txtExportRootDir.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            if (!string.IsNullOrEmpty(prefs.Server))
            {
                txtServer.Text = prefs.Server;
            }
            else
            {
                txtServer.Text = Environment.MachineName;
            }
        }
Example #5
0
        private void SaveUserPreferences()
        {
            var prefs = new UserPrefs();
            prefs.Server = txtServer.Text;
            prefs.ExportDirectory = txtExportRootDir.Text;

            _prefsRepository.SaveUserPrefs(prefs);
        }