public virtual void NewInformation(string p_sInformation, ClInformationSender.eInformationType p_eType) { if (p_eType != ClInformationSender.eInformationType.eNewAlgorithm) { return; } string[] nodes = p_sInformation.Split('\\'); System.Windows.Forms.TreeNode currentNode = null; bool firstSetUp = true; for (int i = 0; i < nodes.Length; i++) { System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(); node.Text = nodes[i]; node.Name = nodes[i]; System.Windows.Forms.TreeNode[] finded; if (firstSetUp) { finded = m_tree.Nodes.Find(nodes[i], false); } else { finded = currentNode.Nodes.Find(nodes[i], false); } if (finded.Length == 1) { currentNode = finded[0]; firstSetUp = false; } else { if (firstSetUp) { m_tree.Nodes.Add(node); firstSetUp = false; } else { currentNode.Nodes.Add(node); } currentNode = node; } } }
public virtual void NewInformation(string p_sInformation, ClInformationSender.eInformationType p_eType) { if (p_eType == ClInformationSender.eInformationType.eStartProcessing) { #if RENDER_1 ClRender.getInstance().StopRendering(); #endif } else if (p_eType == ClInformationSender.eInformationType.eStopProcessing) { #if RENDER_1 // ClRender.getInstance().StartRendering(); #endif } m_form.Invoke(d, new object[] { p_sInformation, p_eType }); }
public virtual void NewInformation(string p_sInformation, ClInformationSender.eInformationType p_eType) { mut.WaitOne(); try { if (p_sInformation != null) { if (p_eType == ClInformationSender.eInformationType.eDebugText) { p_sInformation = "\t" + p_sInformation; p_sInformation = p_sInformation.Replace("\n", "\n\t"); } if (m_HardLogging) { using (TextWriter tw = new StreamWriter(m_sFileName, true)) { string date = DateTime.Now.ToString(); tw.WriteLine(date + "\t" + p_sInformation); tw.Close(); } } else { string date = DateTime.Now.ToString(); m_LogMem += date + "\t" + p_sInformation + "\n"; m_logCount++; if (m_logCount >= m_logInterval) { using (TextWriter tw = new StreamWriter(m_sFileName, true)) { tw.Write(m_LogMem); tw.Close(); } m_logCount = 0; m_LogMem = ""; } } } } catch (Exception) {} mut.ReleaseMutex(); }
public virtual void NewInformation(string p_sInformation, ClInformationSender.eInformationType p_eType) { m_recognitionButton.DropDownItems.Add(p_sInformation); }
public void UpdateUI(string p_sInfo, ClInformationSender.eInformationType p_eType) { if (p_eType == ClInformationSender.eInformationType.eError || p_eType == ClInformationSender.eInformationType.eDebugText || p_eType == ClInformationSender.eInformationType.eTextInternal || p_eType == ClInformationSender.eInformationType.eTextExternal) { this.DebugTextBox.Text += "\n-> " + p_sInfo; } if (p_eType == ClInformationSender.eInformationType.eError) { MessageBox.Show(p_sInfo, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (p_eType == ClInformationSender.eInformationType.eTextExternal) { this.toolStripStatusLabel1.Text = p_sInfo; } if (p_eType == ClInformationSender.eInformationType.eTextInternal) { this.toolStripStatusLabel2.Text = p_sInfo; } if (p_eType == ClInformationSender.eInformationType.eProgress) { int proc = Convert.ToInt32(p_sInfo); this.toolStripProgressBar1.Value = proc; } if (p_eType == ClInformationSender.eInformationType.eStartProcessing) { this.toolStripButtonOpen.Enabled = false; this.toolStripButtonOpenFolder.Enabled = false; this.toolStripButtonOpen.Enabled = false; pictureCorrelationMatrix = null; } if (p_eType == ClInformationSender.eInformationType.eStopProcessing) { this.toolStripButtonOpen.Enabled = true; this.toolStripButtonOpenFolder.Enabled = true; this.toolStripButtonOpen.Enabled = true; MessageBox.Show("Processing has ended !", "END of processing", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (p_eType == ClInformationSender.eInformationType.eColorMapChanged) { //"ColorMap: Max: 2.343455 Min: -2.54333" string[] splitedInfo = p_sInfo.Split(' '); float MaxValue = Single.Parse(splitedInfo[2]); float MinValue = Single.Parse(splitedInfo[4]); Bitmap info = new Bitmap(200, 300); int WidthOfField = 40; int StartField = 20; for (int j = StartField; j < info.Height; j++) { Color newColor = Preprocessing.ClTools.GetColorRGB(((float)j - StartField) / (info.Height - StartField - 1), 1.0f); for (int i = 0; i < Math.Min(info.Width, WidthOfField); i++) { info.SetPixel(i, j, newColor); } } Graphics graphic = Graphics.FromImage(info); string NameOfPlot = splitedInfo[0]; graphic.DrawString(NameOfPlot, new Font("Arial", 10, FontStyle.Bold), new System.Drawing.SolidBrush(Color.Black), 5, 1); graphic.DrawString(MaxValue.ToString(), new Font("Arial", 10, FontStyle.Bold), new System.Drawing.SolidBrush(Preprocessing.ClTools.GetColorRGB(1.0f, 1.0f)), WidthOfField + 5, info.Height - 15); graphic.DrawString(MinValue.ToString(), new Font("Arial", 10, FontStyle.Bold), new System.Drawing.SolidBrush(Preprocessing.ClTools.GetColorRGB(0.0f, 1.0f)), WidthOfField + 5, StartField); int ZeroPosition = (int)(((0 - MinValue) / (MaxValue - MinValue)) * info.Height); if (ZeroPosition >= 0) { graphic.DrawString("0.0", new Font("Arial", 10, FontStyle.Bold), new System.Drawing.SolidBrush(info.GetPixel(0, ZeroPosition)), WidthOfField + 5, ZeroPosition); } pictureBoxAdditionalInfo.Image = info; } if (p_eType == ClInformationSender.eInformationType.eNextRecognitionScore) { string[] splitedInfo = p_sInfo.Split(' '); string[] score1 = splitedInfo[0].Split('/'); string[] score2 = splitedInfo[1].Split('/'); int x = Int32.Parse(score1[0]); int width = Int32.Parse(score1[1]); int y = Int32.Parse(score2[0]); int height = Int32.Parse(score2[1]); if (pictureCorrelationMatrix == null) { pictureCorrelationMatrix = new Bitmap(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { pictureCorrelationMatrix.SetPixel(i, j, Color.White); } } } pictureCorrelationMatrix.SetPixel(x, y, Color.Red); pictureBoxAdditionalInfo.Image = pictureCorrelationMatrix; } if (p_eType == ClInformationSender.eInformationType.eWindowInfo) { MessageBox.Show(p_sInfo, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }