You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.4 KiB
150 lines
5.4 KiB
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 bool multiline = false;
|
|
public InputDialog()
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
|
|
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
|
}
|
|
|
|
public InputDialog(string caption, string description, string defaultvalue)
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
|
|
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
|
textBox1.Text = defaultvalue;
|
|
this.Text= caption;
|
|
this.label1.Text=description;
|
|
this.cbboxMitarbeiter.Visible = false;
|
|
}
|
|
|
|
public InputDialog(bool Mitarbeiter,string description, string caption)
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
|
|
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
|
this.textBox1.Visible = false;
|
|
this.cbboxMitarbeiter.Visible = true;
|
|
this.label1.Text = description;
|
|
this.Text = caption;
|
|
|
|
isMaDialog = true;
|
|
}
|
|
|
|
public InputDialog(string caption, string description, string defaultvalue, bool multiline)
|
|
{
|
|
InitializeComponent();
|
|
this.Style.TitleBar.BackColor = Theaming.Titelbar();
|
|
this.Style.TitleBar.ForeColor = Theaming.TitelFontColor();
|
|
this.Style.ShadowOpacity = Theaming.ShadowOpacity;
|
|
this.Style.InactiveShadowOpacity = Theaming.InactivShadowOpacity;
|
|
this.multiline = multiline;
|
|
int AddHeight = 100;
|
|
this.textBox1.Visible = true;
|
|
this.label1.Top = 5;
|
|
this.textBox1.Top = this.label1.Top + this.label1.Height + 5;
|
|
this.textBox1.Height = AddHeight;
|
|
this.textBox1.Multiline = true;
|
|
|
|
this.Height = this.textBox1.Top + this.textBox1.Height + this.btnok.Height + 50;
|
|
this.btnok.Top = this.textBox1.Top + this.textBox1.Height + 5;
|
|
this.btncancel.Top = this.btnok.Top;
|
|
this.Text= caption;
|
|
this.cbboxMitarbeiter.Visible = false;
|
|
this.label1.Text = description;
|
|
isMaDialog = false;
|
|
textBox1.Text = defaultvalue;
|
|
}
|
|
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;
|
|
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 && !multiline)
|
|
{
|
|
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;
|
|
}
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox1.Text.Trim().Length > 0) btnok.Enabled = true; else btnok.Enabled = false;
|
|
}
|
|
}
|
|
}
|