private void OnAddRecordClick(object sender, EventArgs e) { var record = (TrackedDayRecordViewModel)BindingContext; OnAddRecord?.Invoke(record); PopupNavigation.Instance.PopAsync(); }
protected override void Run() { try { // 创建目录 var now = DateTime.Now; var folder = $"{Global.gRecordingsFolder}/{now.Year}-{now.Month}-{now.Day}"; var filename = $"{folder}/{now.ToString("yyyyMMddHHmmss")}.h264"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } encoder.Stop(); encoder.Start(filename); OnAddRecord?.Invoke(filename); } catch (Exception e) { Tracker.LogE(e); return; } while (!IsTerminated()) { try { IntPtr addr = imageGCHandle.AddrOfPinnedObject(); encoder.Encode(addr, addr + imageSize, addr + imageSize + imageSize / 4); } catch (Exception e) { Tracker.LogE(e); encoder.Stop(); return; } Thread.Sleep(1000 / cell.mCell.mIRCameraVideoFrameRate); } try { encoder.Encode(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); encoder.Stop(); } catch (Exception e) { Tracker.LogE(e); } }