Beispiel #1
0
 private void NewEnum(object sender, ExecutedRoutedEventArgs e)
 {
     InputDialogBox.Show("New Enum Name", "Enter a name for the Enum collection.", "", value => {
         var new_enum  = new Enumeration();
         new_enum.Name = value;
         _DatabaseExplorer.SelectedDatabase.Enumeration.Add(new_enum);
         NetTypes.Add(value);
     });
 }
 private void _TreDatabaseLayout_New(object sender, ExecutedRoutedEventArgs e)
 {
     if (selected_type == Selection.Tables || selected_type == Selection.TableItem)
     {
         InputDialogBox.Show("Table Name", "Enter a new name for the table.", "", (value) => {
             var table = new Table()
             {
                 Name = value
             };
             selected_database.Table.Add(table);
             Refresh();
         });
     }
 }
        /// <summary>
        /// Create a new database and prompt the user for a name.
        /// </summary>
        public void CreateDatabase()
        {
            var dialog = new InputDialogBox()
            {
                Title       = "New Database",
                Description = "Enter a name for the new database."
            };
            var result = dialog.ShowDialog();

            if (result.HasValue == false || result.Value == false)
            {
                return;
            }

            CreateDatabase(dialog.Value);
        }
 private void _TreDatabaseLayout_Rename(object sender, ExecutedRoutedEventArgs e)
 {
     if (selected_type == Selection.TableItem)
     {
         InputDialogBox.Show("Rename Table", "Enter a new name for the table.", selected_table.Name, (value) => {
             selected_table.Rename(selected_database, value);
             Refresh();
         });
     }
     else if (selected_type == Selection.Database)
     {
         InputDialogBox.Show("Rename Database", "Enter a new name for the database.", selected_database.Name, (value) => {
             selected_database.Name = value;
             Refresh();
         });
     }
 }
        public static InputDialogBox Show(string title, string description, string default_value, Action <string> success)
        {
            var dialog = new InputDialogBox()
            {
                Title       = title,
                Description = description,
                Value       = default_value
            };

            dialog._TxtValue.SelectAll();
            var result = dialog.ShowDialog();

            if (result.HasValue == true && result.Value != false)
            {
                success(dialog.Value);
            }

            return(dialog);
        }
        private void _TreDatabaseLayout_Paste(object sender, ExecutedRoutedEventArgs e)
        {
            switch (selected_type)
            {
            case Selection.Tables:
            case Selection.TableItem:
                var table = Utilities.XmlDeserializeString <Table>(Clipboard.GetText());
                if (table == null)
                {
                    return;
                }

                InputDialogBox.Show("Table Name", "Enter a new name for the table.", table.Name, (value) => {
                    table.Name = value;
                    selected_database.Table.Add(table);
                    Refresh();
                });
                break;
            }
        }
Beispiel #7
0
        private void _DagColumnDefinitions_Paste(object sender, ExecutedRoutedEventArgs e)
        {
            Column[] columns     = Utilities.XmlDeserializeString <DtronixModeler.Ddl.Column[]>(Clipboard.GetText()) as Column[];
            var      all_columns = _DatabaseExplorer.SelectedTable.Column;

            if (columns == null)
            {
                return;
            }

            if (_MiValidateColumnsOnPaste.IsChecked)
            {
                foreach (var column in columns)
                {
                    var found_column = all_columns.FirstOrDefault(col => col.Name.ToLower() == column.Name.ToLower());

                    if (found_column != null)
                    {
                        InputDialogBox.Show("Column Naming Collision", "Enter a new name for the old \"" + found_column.Name + "\" Column.", found_column.Name, value => {
                            column.Name = value;
                        });

                        continue;
                    }
                }
            }

            // Add in reverse order to allow for insertion in logical order.
            for (int i = columns.Length - 1; i >= 0; i--)
            {
                if (_DagColumnDefinitions.Items.Count > _DagColumnDefinitions.SelectedIndex + 1)
                {
                    _DatabaseExplorer.SelectedTable.Column.Insert(_DagColumnDefinitions.SelectedIndex + 1, columns[i]);
                }
                else
                {
                    _DatabaseExplorer.SelectedTable.Column.Add(columns[i]);
                }
            }
        }