public DataSourceWindow() { this.InheritanceBehavior = InheritanceBehavior.SkipAllNow; InitializeComponent(); // Attempt to read encrypted storage string xmlData = EncryptedStorage.ReadEncryptedString("C_DATA"); if (xmlData != null && xmlData != "") { ConnectionInfo = ConnectionParams.FromXML(xmlData); if (ConnectionInfo == null) { return; } // Populate text boxes directoryBox.Text = ConnectionInfo.Directory; } else { ConnectionInfo = null; } }
private void acceptButton_Click(object sender, RoutedEventArgs e) { // Update connection params this.ConnectionInfo = new ConnectionParams() { Directory = directoryBox.Text, Username = "" }; this.ConnectionInfo.Source = ConnectionSource.RSMLDirectory; // Save connection params EncryptedStorage.SaveEncryptedString("C_DATA", this.ConnectionInfo.ToXML()); this.DialogResult = true; this.Close(); }
private void acceptButton_Click(object sender, RoutedEventArgs e) { // Update connection params this.ConnectionInfo = new ConnectionParams() { Server = serverBox.Text, Port = portBox.Text, Database = databaseBox.Text, Directory = directoryBox.Text, Password = passwordBox.Password, Username = userBox.Text }; this.ConnectionInfo.Source = (bool)this.databaseRadioButton.IsChecked ? ConnectionSource.MySQLDatabase : ConnectionSource.RSMLDirectory; // Save connection params EncryptedStorage.SaveEncryptedString("C_DATA", this.ConnectionInfo.ToXML()); this.DialogResult = true; this.Close(); }
public DataSourceWindow() { this.InheritanceBehavior = InheritanceBehavior.SkipAllNow; InitializeComponent(); // Attempt to read encrypted storage string xmlData = EncryptedStorage.ReadEncryptedString("C_DATA"); if (xmlData != null && xmlData != "") { ConnectionInfo = ConnectionParams.FromXML(xmlData); if (ConnectionInfo == null) { return; } // Populate text boxes serverBox.Text = ConnectionInfo.Server; portBox.Text = ConnectionInfo.Port.ToString(); databaseBox.Text = ConnectionInfo.Database; userBox.Text = ConnectionInfo.Username; passwordBox.Password = ConnectionInfo.Password; directoryBox.Text = ConnectionInfo.Directory; // Correct source selection if (ConnectionInfo.Source == ConnectionSource.RSMLDirectory) { rsmlRadioButton.IsChecked = true; } } else { ConnectionInfo = null; } }