Programm_Wirl/AA-Forms/FormMSAuswahl.cs

64 lines
1.6 KiB
C#

using DatenDB;
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 System.Windows.Media.TextFormatting;
namespace Deckungsbeitrag
{
public partial class FormMSAuswahl : Form
{
public int s;
public Maschine maschine;
public int? id;
public FormMSAuswahl()
{
InitializeComponent();
}
private void FormMSAuswahl_Load(object sender, EventArgs e)
{
foreach (RadioButton btn in this.Controls.OfType<RadioButton>())
{
if (btn.Text == "1") btn.Tag = Maschine.GetMaschine(null, "Waschstrasse 1");
if (btn.Text == "2") btn.Tag = Maschine.GetMaschine(null, "Waschstrasse 2");
}
this.textBox1.Location = new Point(this.label2.Right + 10, textBox1.Location.Y);
}
private void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
if (rb.Checked)
{
rb.BackColor = Color.Green;
maschine = (Maschine)rb.Tag;
id = maschine.MaschineID;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
private void TextBox1_KeyDown(object sender, KeyEventArgs e)
{
TextBox txtScan = (TextBox)sender;
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
if (int.TryParse(txtScan.Text.Substring(4).Trim(), out int i)) id = i;
this.DialogResult |= DialogResult.OK;
this.Close();
}
}
}
}