private void New_Column_Button_Click(object sender, RoutedEventArgs e) { PopUpWindow window = new PopUpWindow("Enter:[column name] [column type]", "Create new column"); window.Title = "New Column"; // Shows PopUpWindow and waits for the user to input window.ShowDialog(); string[] input = window.GetInput().Split(); string table_name = GetSelectedItem(); string col_name = input[0]; string col_type = input[1]; try { if (col_name == "") { throw new Exception(); return; } AddColumn(col_name, col_type, table_name); }catch (Exception ex) { MessageLabel.Content = string.Format("Invalid column name. \"{0}\"", col_name); } }
/// <summary> /// Processes command inside textbox /// </summary> /// <param name="sender">Button which was clicked</param> /// <param name="e">Event object</param> /* private void RunButton_Click(object sender, RoutedEventArgs e) * { * // Open connection * database.OpenConnection(); * * // Create new data table * dataTable = new DataTable(); * * // Input text to make a commands * string query = new TextRange(InputText.Document.ContentStart, InputText.Document.ContentEnd).Text; * * // Create new data adapter * dataAdapter = new SQLiteDataAdapter(query, database.myConnection); * * // Fill table * dataAdapter.Fill(dataTable); * * // Sets default view for the table * OutputGrid.ItemsSource = dataTable.DefaultView; * * // Sample message * this.MessageLabel.Content = "Command executed"; * * UpdateTableList(); * * // Close connection * database.CloseConnection(); * } */ /// <summary> /// Creates a new table if one doesn't exist already /// </summary> private void New_Button_Click(object sender, RoutedEventArgs e) { PopUpWindow window = new PopUpWindow("Enter name of new table", "Create new table"); window.Title = "New Table"; // Shows PopUpWindow and waits for the user to input window.ShowDialog(); string tableName = window.GetInput(); try { if (tableName == "") { throw new Exception(); return; } CreateTable(tableName); }catch (Exception ex) { MessageLabel.Content = String.Format("Invalid table name. \"{0}\"", tableName); } }