laatzen/Common/CordonelAssemblyLine/MainWindow.xaml.cs

172 lines
6.2 KiB
C#

using System;
using System.Linq;
using System.Threading;
using System.Windows;
namespace CordonelAssemblyLine
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private CancellationTokenSource cancellation = new CancellationTokenSource();
private Picking PickingWindow;
private Leak LeakWindow;
private Marriage MarriageWindow;
//public String PickingSlot { get; set; }
//public String PickingBarcode { get; set; }
//public String LeakSlot { get; set; }
//public String LeakStationId { get; set; }
//public String MarriageSlot { get; set; }
//public String MarriageBarcode { get; set; }
public MainWindow()
{
InitializeComponent();
//PickingSlot = System.Configuration.ConfigurationManager.AppSettings["PickingSlot"].ToString();
//PickingBarcode = System.Configuration.ConfigurationManager.AppSettings["PickingBarcode"].ToString();
//LeakSlot = System.Configuration.ConfigurationManager.AppSettings["LeakSlot"].ToString();
//LeakStationId = System.Configuration.ConfigurationManager.AppSettings["LeakStationId"].ToString();
//MarriageSlot = System.Configuration.ConfigurationManager.AppSettings["MarriageSlot"].ToString();
//MarriageBarcode = System.Configuration.ConfigurationManager.AppSettings["MarriageBarcode"].ToString();
//txtPickingBarcode.Text = PickingBarcode;
//txtPickingSlot.Text = PickingSlot;
//txtLeakStation.Text = LeakStationId;
//txtLeakSlot.Text = LeakSlot;
//txtMarrieageBarcode.Text = MarriageBarcode;
//txtMarrieageSlot.Text = MarriageSlot;
}
private void Button_Click(Object sender, RoutedEventArgs e)
{
if (PickingWindow?.Title == "")
{
PickingWindow = null;
}
if (PickingWindow == null)
{
var tmp = 0;
if (int.TryParse(txtPickingSlot.Text, out tmp))
{
PickingWindow = new Picking(cancellation.Token, txtPickingBarcode.Text, tmp);
PickingWindow.Show();
}
}
else
{
PickingWindow.Focus();
}
}
private void Button_Click_1(Object sender, RoutedEventArgs e)
{
if (LeakWindow?.Title == "")
{
LeakWindow = null;
}
if (LeakWindow == null)
{
var tmpSlot = 0;
var tmpStation = 0;
if (int.TryParse(txtLeakSlot.Text, out tmpSlot) && int.TryParse(txtLeakStation.Text, out tmpStation))
{
if (txtTester.Text == "")
{
MessageBox.Show("Bitte den Namen im Feld Tester eingeben!");
}
else
{
LeakWindow = new Leak(cancellation.Token, tmpSlot, tmpStation, txtTester.Text);
LeakWindow.Show();
}
}
}
else
{
LeakWindow.Focus();
}
}
private void Button_Click_2(Object sender, RoutedEventArgs e)
{
if (MarriageWindow?.Title == "")
{
MarriageWindow = null;
}
if (MarriageWindow == null)
{
var tmp = 0;
if (int.TryParse(txtMarrieageSlot.Text, out tmp))
{
MarriageWindow = new Marriage(cancellation.Token, tmp, txtMarrieageBarcode.Text);
MarriageWindow.Show();
}
}
else
{
MarriageWindow.Focus();
}
}
private System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement> progressbars = new System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement>();
String el1 = "nicht so lang";
String el2 = "Maximal dreißig zeichen 30!!!";
String el3 = "viel zu viele zeichen man kann auch nicht alles haben3";
private void Btn1_Click(Object sender, RoutedEventArgs e)
{
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Cloud, Name = el1});
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Compare, Name = el2});
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Irda, Name = el3 });
progressBar.AddRange(progressbars);
progressbars.Where(n => n.Name == el1).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Btn2_Click(Object sender, RoutedEventArgs e)
{
progressbars.Where(n => n.Name == el1).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Btn3_Click(Object sender, RoutedEventArgs e)
{
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
progressbars.Where(n => n.Name == el3).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e)
{
if (PickingWindow != null)
{
PickingWindow.Close();
}
if (LeakWindow != null)
{
LeakWindow.Close();
}
if (MarriageWindow != null)
{
MarriageWindow.Close();
}
}
private void TxtTester_TextChanged(Object sender, System.Windows.Controls.TextChangedEventArgs e)
{
}
}
}