public MainUI() : base("http://zip.app.local/index.html") { InitializeComponent(); int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; using (Graphics graphics = Graphics.FromHwnd(IntPtr.Zero)) { SW = (int)(SW * 96 / graphics.DpiX); SH = (int)(SH * 96 / graphics.DpiY); } if (SW < 1400) { GlobDef.globle_scale = 2.0; } this.WindowState = FormWindowState.Maximized; LoadHandler.OnLoadEnd += LoadHandler_OnLoadEnd; RegisterJSFunc(); if (adbWrapper == null) { adbWrapper = new AdbWrapper(); adbWrapper.Init(); adbWrapper.prjDataCallBack += UpdateFlow; } ImgMgr.Get().dataChangedHandler += UpdateVideo; CellPhoneProxy.Instance.notifyUpdateHoverRect += UpdateHoverRect; CellPhoneProxy.Instance.notifyEnanleAddFlowItem += EnableAddFlowItem; }
public bool EndAddFlowItem(string obj) { if (obj == null || obj.Length == 0) { return(false); } var data = JsonConvert.DeserializeObject <NewFlowDataOrg>(obj); string ret; string inputParam = null; if (data.param.Length != 0) { NewValData newVal = new NewValData(); newVal.lineNumber = -1; newVal.value = data.param; var newValParam = JsonConvert.SerializeObject(newVal); ret = ScreenClient.AddVar(stPort, newValParam); if (ret.Length == 0) { return(false); } var ret2 = JsonConvert.DeserializeObject <NewValRet>(ret); if (null == ret2 || ret2.result.code != 1) { return(false); } inputParam = JsonConvert.SerializeObject(ret2.config); } NewFlowData newFlowData = new NewFlowData(); if (inputParam != null) { newFlowData.@params = new List <string>(); [email protected](inputParam); } var newImageName = ImgMgr.Get().NewSaveImage(); if (null == newImageName) { return(false); } newFlowData.point = GlobDef.GetDevPoint(data.pt); newFlowData.type = data.type; newFlowData.preLineNumber = data.preLineNumber; newFlowData.serial = newImageName; string flowItem = JsonConvert.SerializeObject(newFlowData); string addFlowItemRetStr = ScreenClient.AddProcess(stPort, flowItem); if (addFlowItemRetStr.Length == 0) { return(false); } notifyEnanleAddFlowItem?.Invoke(); return(true); }
public override void Execute(byte[] bytes) { if (bytes.Length == 0) { return; } var aa = Thread.CurrentThread.ManagedThreadId.ToString(); Console.WriteLine($"DecodeDataImpl {aa} ==> {bytes.Length}"); if (null == stream) { stream = new MemoryStream(); } else { try { stream.Seek(0, SeekOrigin.Begin); } catch (Exception ex) { stream = new MemoryStream(); Console.WriteLine($"Execute {ex.ToString()}"); } } stream.Write(bytes, 0, bytes.Length); stream.Seek(0, SeekOrigin.Begin); if (null == media) { media = new MediaReader(stream); decoder = media.Decoders.OfType <VideoDecoder>().First(); decoder.OutFormat = new VideoFormat(decoder.InFormat.Width, decoder.InFormat.Height, AVPixelFormat.Bgr24, 4); } if (null == frame) { frame = new VideoFrame(); } if (media.NextFrame(frame, decoder.StreamIndex)) { Bitmap image = new Bitmap(frame.Format.Width, frame.Format.Height, frame.Format.Strides[0], PixelFormat.Format24bppRgb, frame.Scan0); ImgMgr.Get().SetImg("live.png", image); } }
private void OnProcessRequest(object sender, Chromium.Event.CfxProcessRequestEventArgs e) { /* * System.Reflection.Assembly Asmb = System.Reflection.Assembly.GetExecutingAssembly(); * string strName = Asmb.GetName().Name + ".WebUI.logo512.png"; * System.IO.Stream ManifestStream = Asmb.GetManifestResourceStream(strName); * * byte[] StreamData = new byte[ManifestStream.Length]; * ManifestStream.Read(StreamData, 0, (int)ManifestStream.Length); */ var uri = new System.Uri(e.Request.Url); webResource = new WebResource(ImgMgr.Get().GetImg(uri.AbsolutePath.TrimStart('/'))); e.Callback.Continue(); e.SetReturnValue(true); }