/// <summary> /// 选择数据库连接字符串 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChoiceDB_Click(object sender, RoutedEventArgs e) { //打开对话框 DBSelectDialog dialog = new DBSelectDialog(this.ViewModel.DBTypeSelectIndex); bool?result = dialog.ShowDialog(); if (result != null && result.Value == true) { this.ViewModel.ConnectionString = dialog.ConnectionString; } }
private void DBSelectButton_Click(object sender, EventArgs e) { DBSelectDialog.ShowDialog(); var filepath = DBSelectDialog.FileName; var db = new DB(); try { db.Connect(filepath, new List <String>() { "koordinat" }); ErrorLabel.Text = ""; this.Hide(); new RouteMap(db).ShowDialog(); this.Close(); } catch (Exception ex) { ErrorLabel.Text = ex.Message; } }