private void TextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         DatabaseLayerInfoViewModel <MsSqlFeatureLayer> viewModel = DataContext as DatabaseLayerInfoViewModel <MsSqlFeatureLayer>;
         if (viewModel != null)
         {
             viewModel.ConnectToDatabaseCommand.Execute(null);
         }
     }
 }
示例#2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DatabaseLayerInfoViewModel <MsSqlFeatureLayer> viewModel = DataContext as DatabaseLayerInfoViewModel <MsSqlFeatureLayer>;
            MsSql2008FeatureLayerInfo info = new MsSql2008FeatureLayerInfo();

            info.Password                  = viewModel.Password;
            info.ServerName                = viewModel.ServerName;
            info.UserName                  = viewModel.UserName;
            info.UseTrustAuthority         = viewModel.UseTrustAuthentication;
            viewModel.IsServerConnected    = true;
            DataRepositoryTree.DataContext = new DatabaseTreeViewModel(info);
        }
示例#3
0
        private void TreeViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MsSqlTableDataRepositoryItem currentItem = sender.GetDataContext <MsSqlTableDataRepositoryItem>();

            if (currentItem != null && currentItem.IsLeaf)
            {
                DataRepositoryItem databaseItem = currentItem.Parent.Parent.Parent.Parent as DataRepositoryItem;
                DatabaseLayerInfoViewModel <MsSqlFeatureLayer> viewModel = DataContext as DatabaseLayerInfoViewModel <MsSqlFeatureLayer>;
                viewModel.Model.DatabaseName = databaseItem.Name;
                viewModel.CurrentItem        = currentItem;
                DropdownButton.IsChecked     = false;
            }
        }
示例#4
0
        public void SetSource <T>(DatabaseLayerInfo <T> model) where T : FeatureLayer
        {
            Messenger.Default.Unregister(this);

            DatabaseLayerInfoViewModel <T> viewModel = new DatabaseLayerInfoViewModel <T>(model);

            DataContext = viewModel;
            UpdateLayout();

            Messenger.Default.Register <bool>(this, viewModel, msg => DialogResult = true);
            Messenger.Default.Register <NotificationMessage <Exception> >(this, viewModel, msg =>
            {
                System.Windows.Forms.MessageBox.Show(msg.Content.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            });

            Closing -= WindowClosing;
            Closing += WindowClosing;
        }