コード例 #1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            AddNewSQLNodeWindow addNewSQLNodeWindow = new AddNewSQLNodeWindow();
            SQLTreeItem         selected            = ((SQLTreeItem)MainTree.SelectedItem);

            addNewSQLNodeWindow.ViewModel.HeaderName = selected.Header.ToString();
            addNewSQLNodeWindow.ViewModel.SQLText    = selected.SQL;
            addNewSQLNodeWindow.ViewModel.SchemaSQL  = selected.SchemaSQL;

            if (selected.KeyFields != null)
            {
                string fields = "";
                foreach (string str in selected.KeyFields)
                {
                    if (str.Trim() != "")
                    {
                        fields = fields + str + "; ";
                    }
                }
                addNewSQLNodeWindow.ViewModel.KeyFields = fields;
            }

            addNewSQLNodeWindow.ShowDialog();

            selected.Header    = addNewSQLNodeWindow.ViewModel.HeaderName;
            selected.SQL       = addNewSQLNodeWindow.ViewModel.SQLText;
            selected.KeyFields = addNewSQLNodeWindow.ViewModel.KeyFields.Split(';');
            selected.SchemaSQL = addNewSQLNodeWindow.ViewModel.SchemaSQL;
            ViewModel.SaveTreeView(MainTree);
        }
コード例 #2
0
        private void btnAddNew_Click(object sender, RoutedEventArgs e)
        {
            AddNewSQLNodeWindow addNewSQLNodeWindow = new AddNewSQLNodeWindow();

            addNewSQLNodeWindow.ShowDialog();
            ViewModel.AddNewSQLNode(MainTree, addNewSQLNodeWindow.ViewModel.HeaderName, addNewSQLNodeWindow.ViewModel.SQLText, addNewSQLNodeWindow.ViewModel.KeyFields, addNewSQLNodeWindow.ViewModel.SchemaSQL);
            ViewModel.SaveTreeView(MainTree);
        }