private void btnSetting_Click(object sender, RoutedEventArgs e)
 {
     // 传递GUID给设置窗口
     if (viewModel.Id != null)
     {
         ConnectionModifyWindow modifyWindow = new ConnectionModifyWindow();
         modifyWindow.Owner = App.Current.MainWindow;
         modifyWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         modifyWindow.IsUpdate = true;
         if (viewModel.Id == Guid.Empty)
         {
             MessageBox.Show("此连接未保存");
             modifyWindow.SetConnection(viewModel);
         }
         else
         {
             modifyWindow.SetConnection(viewModel.Id);
         }
         modifyWindow.ShowDialog();
         if (modifyWindow.IsSave)
         {
             SetViewModel(modifyWindow.ConnectionInfo);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加新连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNewConnection_Click(object sender, RoutedEventArgs e)
        {
            ConnectionModifyWindow window = new ConnectionModifyWindow();

            window.Owner = App.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
            if (window.IsSave)
            {
                //SaveConnection(window.ConnectionInfo);
                AddConnectionControl(window.ConnectionInfo);
            }
        }