コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: hkedjour/sqlcequery
        /*
         *      public void RenameObject(object treeViewItem)
         *      {
         *          var window = new RenameObjectWindow();
         *
         *          if (treeViewItem is Table)
         *              window.ViewModel = new RenameObjectViewModel(database, treeViewItem as Table);
         *          else if (treeViewItem is Column)
         *              window.ViewModel = new RenameObjectViewModel(database, treeViewItem as Column);
         *
         *          if (window.ViewModel != null)
         *              window.ShowDialog();
         *      }
         */

        private void CreateNewDatabase()
        {
            var window       = new CreateDatabaseWindow();
            var dialogResult = window.ShowDialog();

            if (!dialogResult.GetValueOrDefault())
            {
                return;
            }

            var viewModel = window.DataContext as CreateDatabaseViewModel;

            if (viewModel == null)
            {
                return;
            }

            Text = "SQL Compact Query Analyzer";
            Tree = null;
            ResetTableData();
            ResultsContainer.Clear();
            ResultSetMessages = ResultSetErrors = ResultSetXml.Text = Query.Text = string.Empty;
            RaisePropertyChanged("Tree");
            RaisePropertyChanged("Query");
            RaisePropertyChanged("ResultSetXml");
            CurrentMainTabIndex = 0;
            lastSelectedTable   = null;
            database            = null;

            dataSource = viewModel.Filename;
            password   = viewModel.Password;
            AnalyzeDatabase();
        }
コード例 #2
0
        private void ShowCreateDatabaseWindow()
        {
            var createDatabaseWindow = new CreateDatabaseWindow
            {
                DataContext = new CreateDatabaseWindowViewModel(_container)
            };

            createDatabaseWindow.ShowDialog();
            DatabasesListViewModel.LoadDatabases();
        }