using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Database; using OnDoc.Klassen; using Syncfusion.Windows.Forms; using Syncfusion.Windows.Forms.Tools; using Syncfusion.WinForms.Controls; namespace OnDoc.Diverses { public partial class InputDialog : SfForm { public string result = ""; public string resulttext = ""; private bool isMaDialog = false; public InputDialog() { InitializeComponent(); this.Style.TitleBar.BackColor = Theaming.Titelbar(); this.Style.TitleBar.ForeColor = Theaming.TitelFontColor(); } public InputDialog(string caption, string description, string defaultvalue) { InitializeComponent(); this.Style.TitleBar.BackColor = Theaming.Titelbar(); this.Style.TitleBar.ForeColor = Theaming.TitelFontColor(); textBox1.Text = defaultvalue; this.Text= caption; this.label1.Text=description; this.cbboxMitarbeiter.Visible = false; } public InputDialog(bool Mitarbeiter,string description) { InitializeComponent(); this.textBox1.Visible = false; this.cbboxMitarbeiter.Visible = true; this.label1.Text = description; isMaDialog = true; } private void btnok_Click(object sender, EventArgs e) { if (isMaDialog) { result = cbboxMitarbeiter.SelectedValue.ToString(); DialogResult = DialogResult.OK; resulttext = cbboxMitarbeiter.Text; return; } if (textBox1.Text.Trim() != "") { result = textBox1.Text; result = textBox1.Text; DialogResult = DialogResult.OK; return; } } private void btncancel_Click(object sender, EventArgs e) { DialogResult= DialogResult.Cancel; } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (textBox1.Text.Trim().Length>0 ) btnok_Click(sender, e); } else { if (textBox1.Text.Trim().Length > 0) btnok.Enabled = true; else btnok.Enabled = false; } } private void InputDialog_Load(object sender, EventArgs e) { this.SetDesktopLocation(Cursor.Position.X, Cursor.Position.Y); textBox1.SelectionStart = 0; textBox1.SelectionLength = textBox1.Text.Length; if (isMaDialog) { DB db = new DB(AppParams.connectionstring); db.clear_parameter(); db.Get_Tabledata("SP_Dokumentbearbeitung_Mitarbeiter", true, false); cbboxMitarbeiter.DataSource = db.dsdaten.Tables[0]; cbboxMitarbeiter.DisplayMember = "name"; cbboxMitarbeiter.ValueMember = "mitarbeiternr"; db = null; cbboxMitarbeiter.Focus(); } } private void cbboxMitarbeiter_SelectedIndexChanged(object sender, EventArgs e) { btnok.Enabled = true; } } }