Beispiel #1
0
 private void WriteSettings(Settings settings)
 {
     // Serialize the Settings object and write to isolated storage
     using (var store = IsolatedStorageFile.GetUserStoreForApplication())
     {
         using (var file = new IsolatedStorageFileStream("settings.json", System.IO.FileMode.OpenOrCreate, store))
         {
             settings.Serialize(file);
         }
     }
 }
Beispiel #2
0
        public SettingsPage()
        {
            InitializeComponent();

            Settings settings;
            try
            {
                settings = ReadSettings();
            }
            catch (NoSettings)
            {
                settings = new Settings();
            }
            this.ConnectionName.Text = settings.ConnectionName;
            this.Host.Text = settings.Host;
            this.Port.Text = Convert.ToString(settings.Port);
            this.User.Text = settings.User;
            this.Password.Password = settings.Password;
        }
Beispiel #3
0
 private void Save(object sender, EventArgs e)
 {
     // Instantiate a new Settings object from the form data
     var settings = new Settings()
     {
         ConnectionName = this.ConnectionName.Text,
         Host = this.Host.Text,
         Port = Convert.ToInt32(this.Port.Text),
         User = this.User.Text,
         Password = this.Password.Password
     };
     WriteSettings(settings);
     App.ViewModel.IsDataLoaded = false;
     NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
 }