private void ExSlide(object sender, EventArgs e) { DateTime time = DateTime.Now; string timel = time.ToLongTimeString(); //lTgl.Text = time.ToShortDateString(); jam.Content = timel; if (ch2 == 3) { if (Field.derror) { Field.defstatus = "Reloading data ..."; data.getAllData(Field.dreset); } Field.setStatus(defst ? Field.defstatus : Field.secstatus, !defst); defst = !defst; ch2 = 0; } ch2++; if (Field.dataLoaded) { if (Field.shift.next && Field.shift.allow) { if (timel == Field.shift.start) { data.getAllData(true); } } else if (Field.shift.allow) { if (Field.debug || timel == Field.shift.stop) { Field.getData = false; Field.setStatus("Reload data ...", false); Application.Current.Dispatcher.Invoke(() => { Field.web.getAllData(true); }); Field.getData = true; return; } } if (Field.machine.Count < 1) { return; } ch++; if (ch == 8) { if (a >= (Field.mdown.Count < 1 ? (Field.statind.Count < 1 ? Field.machine.Count : Field.statind.Count) : Field.mdown.Count)) { a = 0; } changeDisplay(a); a++; ch = 0; } } }
public MainWindow() { InitializeComponent(); Field.status = status; data = new WEB(this); Field.web = data; per.LabelFormatter = x => x + "%"; otr.LabelFormatter = x => x + "%"; qr.LabelFormatter = x => x + "%"; oee.LabelFormatter = x => x + "%"; try { slide.Interval = TimeSpan.FromSeconds(1); slide.Tick += ExSlide; slide.Start(); data.getAllData(false); } catch (Exception e) { MessageBox.Show(e.Message); } }