//记录日志 private void write_log(String msg) { String time = DateTime.Now.ToLocalTime().ToString(); Log_Box.AppendText(Environment.NewLine + "[" + time + "] " + msg); Log_Box.ScrollToCaret(); }
private void Cut_Pic_Save_Click(object sender, EventArgs e) { if (Face_Name_Text.Text == "") { MessageBox.Show("必须输入人名!"); } else { if (Cut_Pic_Box.Image != null) { try { Cut_Pic_Box.Image.Save(Environment.CurrentDirectory + @"\FaceFile\" + Face_Name_Text.Text + @".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); MessageBox.Show("录入成功"); } catch (System.Exception ex) { Log_Box.AppendText("人脸数据添加失败!\r\n"); Log_Box.AppendText(ex.Message + "\r\n"); } } else { Log_Box.AppendText("未选择任何图片!\r\n"); } } }
void SortOutputHandler(object sender, DataReceivedEventArgs e) { Trace.WriteLine(e.Data); this.BeginInvoke(new MethodInvoker(() => { Log_Box.AppendText("\r\n" + DateTime.Now.ToLocalTime().ToString() + ": " + e.Data ?? string.Empty); })); }
private void button1_Click(object sender, EventArgs e) { Log_Box.AppendText("\r\n" + DateTime.Now.ToLocalTime().ToString() + ": 停止运行!"); Process Sp = new Process(); Sp = Process.GetProcessById(Pid); Sp.Kill(); Face_Stop.Enabled = false; Face_Start.Enabled = true; Log_Box.AppendText("\r\n" + DateTime.Now.ToLocalTime().ToString() + ": 系统已停止!"); }
private void Face_Local_CheckedChanged(object sender, EventArgs e) { if (Face_Local.Checked == true) { FaceCoreLocal = " 1 "; Log_Box.AppendText("\r\n" + DateTime.Now.ToLocalTime().ToString() + ": 本地模式开启"); } else { FaceCoreLocal = " 0 "; Log_Box.AppendText("\r\n" + DateTime.Now.ToLocalTime().ToString() + ": 本地模式关闭"); } }
//加载自动执行 private void Form1_Load(object sender, EventArgs e) { InitComList(); reset_view(); Log_Box.AppendText("[" + DateTime.Now.ToLocalTime().ToString() + "] 系统启动"); }
private void button1_Click_1(object sender, EventArgs e) { Log_Box.AppendText(@FaceCorePath + FaceCoreDebug + FaceCoreReact); }