61 lines
2.3 KiB
C#
61 lines
2.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using DBToolControls;
|
|
|
|
namespace BeWoAdmin {
|
|
/// <summary>
|
|
/// Interaktionslogik für SqlInputWindow.xaml
|
|
/// </summary>
|
|
public partial class SqlInputWindow : Window {
|
|
public string SqlCommand {
|
|
get { return SqlInput.Text; }
|
|
}
|
|
|
|
public SqlInputWindow(Window owner, string initialText) {
|
|
InitializeComponent();
|
|
this.Owner = owner;
|
|
AddSQLSyntaxToSqlInputBox();
|
|
SqlInput.Text = initialText;
|
|
SqlInput.Focus();
|
|
}
|
|
|
|
private void OKButton_Click(object sender, RoutedEventArgs e) {
|
|
this.DialogResult = true;
|
|
Close();
|
|
}
|
|
|
|
private void AddSQLSyntaxToSqlInputBox() {
|
|
Syntax s;
|
|
|
|
s = new Syntax(false);
|
|
s.AddWords("alter", "and", "auto_increment", "as", "asc", "by", "create", "database", "delete", "desc", "distinct", "drop",
|
|
"from", "group", "having", "in", "insert", "is", "join", "key", "left", "like", "limit", "natural",
|
|
"not", "null", "or", "order", "primary", "right", "select", "set", "table", "update", "where");
|
|
s.AddFormatting(Control.ForegroundProperty, Brushes.Blue);
|
|
s.AddFormatting(Control.FontWeightProperty, FontWeights.Bold);
|
|
SqlInput.SyntaxProvider.AddSyntax(s);
|
|
|
|
s = new Syntax(false);
|
|
s.AddWords("tinyint", "smallint", "mediumint", "int", "integer", "bigint", "float",
|
|
"double", "real", "decimal", "numeric", "date", "datetime", "timestamp",
|
|
"time", "year", "char", "varchar", "blob", "text", "enum", "set");
|
|
s.AddFormatting(Control.ForegroundProperty, Brushes.DarkRed);
|
|
s.AddFormatting(Control.FontWeightProperty, FontWeights.Medium);
|
|
SqlInput.SyntaxProvider.AddSyntax(s);
|
|
}
|
|
|
|
private void StartDrag(object sender, MouseButtonEventArgs e) {
|
|
this.DragMove();
|
|
}
|
|
}
|
|
}
|