private static void RangeChangedCallback(DependencyObject o, DependencyPropertyChangedEventArgs e) { var wpfAxis = o as Axis; if (wpfAxis == null) { return; } wpfAxis.OnRangeChanged(); UpdateChart()(o, e); }
private void button1_Click(object sender, EventArgs e) { if (ImageOpenFileDialog.ShowDialog() == DialogResult.OK) { using Bitmap openedBitmap = Bitmap.FromFile(ImageOpenFileDialog.FileName) as Bitmap; RecognitionPictureBox.Image = DrawingRoutines.DrawZonds(openedBitmap, Zonds); char?recognitionResult = RecognitionRoutines.TryRecognizeClassDistance(openedBitmap, RecognitionDictionary, Zonds); RecognitionResultLabel.Text = recognitionResult.HasValue ? recognitionResult.Value.ToString() : string.Empty; var crossCount = RecognitionRoutines.GetCrossCount(openedBitmap, Zonds); UpdateChart(chart2, (crossCount[Zonds[0]], crossCount[Zonds[1]], recognitionResult.Value)); } }
private void DownClick2() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(DownClick2); Invoke(uc); } else { if (!m_bIsDownClick) { InitPicLoad(false); btn_PageDown.Enabled = false; m_tGetdata.Abort(); m_tGetdata = null; return; } fourChart1.DownClick(); fourChart2.DownClick(); fourChart3.DownClick(); InitPicLoad(false); setBtnEnabled(btn_PageUp, depthTimeChart.isPageUp); setBtnEnabled(btn_PageDown, depthTimeChart.isPageDown); setBtnEnabled(btn_Up, depthTimeChart.isUp); setBtnRP(); showLable(m_lMin, m_lMax); } m_tGetdata.Abort(); m_tGetdata = null; }
/// <summary> /// 初始化运行时变量 /// </summary> /// <param name="multiInfo"></param> public void Restet(MultiPasteInfo multiInfo) { RUN_CamMarkIsDone = false; RUN_CamBadmarkIsDone = false; RUN_CamPanelIsDone = false; RUN_CamCodeIsDone = false; RUN_NzData = new ConcurrentDictionary <Nozzle, NZ_RunData>(); RUN_PCBData = new List <Board_RunData>(); for (Nozzle nz = Nozzle.Nz1; nz <= Nozzle.Nz4; ++nz) { RUN_NzData.TryAdd(nz, new NZ_RunData()); } for (int i = 0; i < multiInfo.PasteInfos.Count; ++i) { RUN_PCBData.Add(new Board_RunData()); RUN_PCBData[i].MarkData = new Mark_RunData(); RUN_PCBData[i].PcsData = new Pcs_RunData[multiInfo.PasteInfos[i].PasteList.Count]; for (int j = 0; j < multiInfo.PasteInfos[i].PasteList.Count; ++j) { RUN_PCBData[i].PcsData[j] = new Pcs_RunData(); if (!multiInfo.PasteInfos[i].PasteList[j].CanPaste) { RUN_PCBData[i].PcsData[j].iPasteState = 3; } RUN_PCBData[i][j].UpPastePt = multiInfo.PasteInfos[i].PasteList[j].Pos; } } ChangePasteRegion?.Invoke(this.module); UpdateChart?.Invoke(this.module); }
private void query() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(query); Invoke(uc); } else { setBtnTF(); fourChart1.setTimeMaxmin(m_lMin, m_lMax); fourChart1.queryHis(); fourChart2.setTimeMaxmin(m_lMin, m_lMax); fourChart2.queryHis(); fourChart3.setTimeMaxmin(m_lMin, m_lMax); fourChart3.queryHis(); InitPicLoad(false); if (!depthTimeChart.ViewHistory) { btn_Real.Text = "Pause"; } else { btn_Real.Text = "R/T"; } showLable(m_lMin, m_lMax); } m_tGetdata.Abort(); m_tGetdata = null; }
private static void LabelsVisibilityChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var axis = (AxisNew)dependencyObject; if (axis.Model == null) { return; } foreach (var separator in axis.Model.CurrentSeparators) { var s = (AxisSeparatorElement)separator.View; s.TextBlock.Visibility = axis.ShowLabels ? Visibility.Visible : Visibility.Collapsed; } UpdateChart()(dependencyObject, dependencyPropertyChangedEventArgs); }
private void NarrClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(NarrClick); Invoke(uc); } else { //depthChart.Narrow(); //depthChart.getMaxMin(ref m_lMax, ref m_lMin); //getData(m_lMin, m_lMax); fourChart1.timeNow = depthChart.d_now; fourChart2.timeNow = depthChart.d_now; fourChart3.timeNow = depthChart.d_now; fourChart1.Narrow(); fourChart2.Narrow(); fourChart3.Narrow(); depthChart.Narrow(); if (depthChart.isEnlarge) { radButton4.Enabled = false; } else { radButton4.Enabled = true; } if (depthChart.isNarrow) { radButton5.Enabled = false; } else { radButton5.Enabled = true; } if (!depthChart.ViewHistory) { radButton3.Text = "Pause"; } else { radButton3.Text = "R/T"; } t_narr.Abort(); t_narr = null; } }
private void RealClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(RealClick); Invoke(uc); } else { if (depthTimeChart.ViewHistory) { InitPicLoad(false); fourChart1.RealTimeClick(); fourChart2.RealTimeClick(); fourChart3.RealTimeClick(); btn_Up.Enabled = true; btn_Down.Enabled = true; btn_PageUp.Enabled = true; btn_PageDown.Enabled = true; depthTimeChart.ViewHistory = false; showLable(m_lMin, m_lMax); } else { depthTimeChart.ViewHistory = true; fourChart1.setVeiwHistroy(true); fourChart2.setVeiwHistroy(true); fourChart3.setVeiwHistroy(true); } if (!depthTimeChart.ViewHistory) { depthTimeChart.setReal(true); btn_Real.Text = "Pause"; } else { depthTimeChart.setReal(false); btn_Real.Text = "R/T"; } m_tGetdata.Abort(); m_tGetdata = null; } }
private void DownClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(DownClick); Invoke(uc); } else { //depthChart.clearChart(); //depthChart.DownClick(); //depthChart.getMaxMin(ref m_lMax, ref m_lMin); //getData(m_lMin, m_lMax); fourChart1.DownClick(); fourChart2.DownClick(); fourChart3.DownClick(); depthChart.DownClick(); if (depthChart.isUp) { radButton1.Enabled = false; } else { radButton1.Enabled = true; } if (depthChart.isDown) { radButton2.Enabled = false; } else { radButton2.Enabled = true; } if (!depthChart.ViewHistory) { radButton3.Text = "Pause"; } else { radButton3.Text = "R/T"; } t_down.Abort(); t_down = null; } }
public Form1() { InitializeComponent(); this.Icon = Icon.FromHandle(Properties.Resources.um24c2.GetHicon()); this.fc = this.ucFilter1.GetFilterConfig(); myDelegate = new UpdateChart(updatechart); Properties.Settings.Default.Reload(); if (!string.IsNullOrEmpty(Properties.Settings.Default.port)) { SerialCom.Connect(Properties.Settings.Default.port); } this.updateConnectStatus(); }
private void NarrClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(NarrClick); Invoke(uc); } else { fourChart1.timeNow = depthTimeChart1.d_now; fourChart2.timeNow = depthTimeChart1.d_now; fourChart1.Narrow(); fourChart2.Narrow(); depthTimeChart1.Narrow(); if (depthTimeChart1.isEnlarge) { btn_add.Enabled = false; } else { btn_add.Enabled = true; } if (depthTimeChart1.isNarrow) { btn_jian.Enabled = false; } else { btn_jian.Enabled = true; } if (!depthTimeChart1.ViewHistory) { btn_zhong.Text = "Pause"; } else { btn_zhong.Text = "R/T"; } } t_narr.Abort(); t_narr = null; }
private void NarrClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(NarrClick); Invoke(uc); } else { fourChart1.Narrow(); fourChart2.Narrow(); fourChart3.Narrow(); InitPicLoad(false); setBtnEnabled(btn_Enlarge, depthTimeChart.isEnlarge); setBtnEnabled(btn_Narrow, depthTimeChart.isNarrow); setBtnRP(); showLable(m_lMin, m_lMax); } m_tGetdata.Abort(); m_tGetdata = null; }
private void UpClick() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(UpClick); Invoke(uc); } else { fourChart1.UpClick(); fourChart2.UpClick(); depthTimeChart1.UpClick(); if (depthTimeChart1.isUp) { btn_up.Enabled = false; } else { btn_up.Enabled = true; } if (depthTimeChart1.isDown) { btn_down.Enabled = false; } else { btn_down.Enabled = true; } if (!depthTimeChart1.ViewHistory) { btn_zhong.Text = "Pause"; } else { btn_zhong.Text = "R/T"; } } t_up.Abort(); t_up = null; }
private void UpClick2() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(UpClick2); Invoke(uc); } else { fourChart1.UpClick(); fourChart2.UpClick(); fourChart3.UpClick(); InitPicLoad(false); setBtnEnabled(btn_PageUp, depthTimeChart.isPageUp); setBtnEnabled(btn_PageDown, depthTimeChart.isPageDown); setBtnEnabled(btn_Down, depthTimeChart.isDown); setBtnRP(); showLable(m_lMin, m_lMax); } m_tGetdata.Abort(); m_tGetdata = null; }
private void query() { if (this.InvokeRequired) { UpdateChart uc = new UpdateChart(query); Invoke(uc); } else { setBtnTF(); fourChart1.setTimeMaxmin(m_lMin, m_lMax); fourChart1.queryHis(); fourChart2.setTimeMaxmin(m_lMin, m_lMax); fourChart2.queryHis(); fourChart3.setTimeMaxmin(m_lMin, m_lMax); fourChart3.queryHis(); InitPicLoad(false); setBtnRP(); showLable(m_lMin, m_lMax); } m_tGetdata.Abort(); m_tGetdata = null; }
/// <summary> /// 贴附信息标志 /// -2: 已吸标需要贴标 /// -1: 已抛料需要补料 /// 0: 需要贴附 /// 2: 已贴附 /// 3: BadmarkFail /// 4: MarkFail /// </summary> //public ConcurrentDictionary<int, int[]> iPasteState = new ConcurrentDictionary<int, int[]>(); /// <summary> /// 设置状态 /// </summary> /// <param name="pcbIndex"></param> /// <param name="pcsIndex"></param> /// <param name="flag"></param> public void SetPasteState(int pcbIndex, int pcsIndex, int flag) { this.RUN_PCBData[pcbIndex].PcsData[pcsIndex].iPasteState = flag; UpdateChart?.Invoke(this.module); }
// Background reading private void ThreadWork() { while (run) { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells["address"].Value != null && row.Cells["IsValid"].Value.ToString() == "1") { // Read row string idrow = row.Cells["idrow"].Value.ToString(); string addr = row.Cells["address"].Value.ToString(); string format = row.Cells["format"].Value.ToString(); string GraphName = addr; // Raw byte from PLC byte[] resbyte = _plc.GetValue(addr); // Formated user output string resvalue = ""; // Read in format switch (format.ToUpper()) { case "BOOL": resvalue = _plc.GetBooltS(resbyte); break; case "DEC": resvalue = _plc.GetDecS(resbyte); break; case "BIN": resvalue = _plc.GetBinS(resbyte); break; case "FLOAT": resvalue = _plc.GetFloatS(resbyte); break; case "CHAR": resvalue = _plc.GetCharS(resbyte); break; default: resvalue = "Data type error"; break; } // Update datagridview SendResult dResult = new SendResult(ShowResult); this.Invoke(dResult, idrow, resvalue); if (Convert.ToBoolean(row.Cells["check"].Value)) { // Insert into chart if (format.ToUpper() != "BIN" & format.ToUpper() != "CHAR") { PlotResult dPlot = new PlotResult(InsertPlotPoint); this.Invoke(dPlot, GraphName, resvalue, format.ToUpper()); } } } } Thread.Sleep(100); // Update chart UpdateChart dupdate = new UpdateChart(UpdateChartPoints); this.Invoke(dupdate); } }