| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using Common;
- using MeterPlugInLibrary;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace CarMeterSystem
- {
- public partial class frmVoice : Form
- {
- public frmVoice()
- {
- InitializeComponent();
- }
- List<CamerEs> lc = new List<CamerEs>();
- private void LoadVoice(List<loginParam> lt)
- {
- int i = 1;
- foreach (loginParam lp in lt)
- {
- CamerEs c = new CamerEs(lp);
- PictureBox pb = new PictureBox();
- pb.Name = $"pb{i++}";
- pb.Height = 100;
- pb.BackColor = Color.Black;
- pb.Dock = DockStyle.Top;
- flowLayoutPanel1.Controls.Add(pb);
- c.Login(pb);
- lc.Add(c);
- }
- }
- public void LogOut()
- {
- foreach (CamerEs lp in lc)
- {
- lp.LoginOut();
- }
- }
- /// <summary>
- /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
- /// </summary>
- /// <param name="imgUrl"></param>
- /// <param name="ip"></param>
- public void CapturePictrue(string actualFirstNo, string imgUrl = default, string ip = default)
- {
- string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
- lc[0]?.CapturePictrue(strUrl);
- /*
- * 只截取第一张图片
- if (!string.IsNullOrEmpty(ip))
- {
- string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
- lc.Where(s => s._lg?.ip == ip).FirstOrDefault()?.CapturePictrue(strUrl);
- }
- else
- {
- string strUrl = imgUrl ?? $"{Environment.CurrentDirectory}/imgShort/formalImg";
- int i = 1;
- foreach (CamerEs lp in lc)
- {
- //lp.CapturePictrue($"{strUrl}/{DateTime.Now.ToString("yyyyMMddHHmmss")}_{i++}.jpg");
- }
- }
- */
- }
- /// <summary>
- /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
- /// </summary>
- /// <param name="imgUrl"></param>
- /// <param name="ip"></param>
- public void SaveRealData(string actualFirstNo)
- {
- string strUrl = PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.3gp", PbCache.sportInfo.baseSpotNo, "V" + actualFirstNo, 1);
- lc[0]?.SaveRealData(strUrl);
-
- }
- /// <summary>
- /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
- /// </summary>
- /// <param name="imgUrl"></param>
- /// <param name="ip"></param>
- public void StopRealData()
- {
- lc[0]?.StopRealData();
- }
- internal void LoadVoiceInfo()
- {
- List<MeterBaseVideoChild> lt = PbCache.videoChild;
- List<loginParam> lp = new List<loginParam>();
-
- lp.Add(new loginParam { ip = lt[0].p_ip, port = int.Parse(lt[0].vdo_port), userId = lt[0].vdo_user, pwd = lt[0].vdo_pwd });
-
- LoadVoice(lp);
- this.Hide();
- }
- private void frmVoice_Load(object sender, EventArgs e)
- {
-
- }
- private void frmVoice_FormClosing(object sender, FormClosingEventArgs e)
- {
- try
- {
- LogOut();
- }
- catch { }
- }
- }
- }
|