修改录屏方式
This commit is contained in:
parent
e79cdae0da
commit
dcd6200e54
|
@ -4,6 +4,7 @@
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -31,8 +31,8 @@ Global
|
||||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.Build.0 = Debug|x86
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.Build.0 = Debug|x86
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.Build.0 = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.Build.0 = Debug|x64
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.Build.0 = Debug|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
|
<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
|
||||||
<add key="stopRecord" value="180"/>
|
<add key="stopRecord" value="180"/>
|
||||||
|
|
||||||
<add key="gridConnectionString" value="MYSQL; Database=xiangtan_mazuike_xx; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
|
<add key="gridConnectionString" value="MYSQL; Database=xiangtanTest; Password=root; Port=3306; Server=192.168.50.84; User=root;"/>
|
||||||
<!-- 查询处方是orderNo还是orderGroupNo -->
|
<!-- 查询处方是orderNo还是orderGroupNo -->
|
||||||
<add key="OrderNoName" value="orderNo" />
|
<add key="OrderNoName" value="orderNo" />
|
||||||
<!-- 后门耗材板地址 没有则填写0-->
|
<!-- 后门耗材板地址 没有则填写0-->
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
<!-- 指纹机号码 -->
|
<!-- 指纹机号码 -->
|
||||||
<add key="machineNumber" value="1"/>
|
<add key="machineNumber" value="1"/>
|
||||||
<!-- 指纹机ip -->
|
<!-- 指纹机ip -->
|
||||||
<add key="fingerIp" value="192.168.50.201"/>
|
<add key="fingerIp" value="192.168.50.59"/>
|
||||||
|
|
||||||
<!-- 多处方取药 0:不启用 1:启用-->
|
<!-- 多处方取药 0:不启用 1:启用-->
|
||||||
<add key="MultiOrder" value="1"/>
|
<add key="MultiOrder" value="1"/>
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
<PackageReference Include="NModbus4.NetCore" Version="2.0.1" />
|
<PackageReference Include="NModbus4.NetCore" Version="2.0.1" />
|
||||||
<PackageReference Include="Polly" Version="8.4.1" />
|
<PackageReference Include="Polly" Version="8.4.1" />
|
||||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||||
<PackageReference Include="ScreenRecorderLib" Version="6.5.1" />
|
|
||||||
<PackageReference Include="SharpPromise" Version="1.7.0" />
|
<PackageReference Include="SharpPromise" Version="1.7.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||||
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
|
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace DM_Weight.ViewModels
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Type = 55,
|
Type = 55,
|
||||||
InvoiceId = "手术间补药",
|
InvoiceId = "手术间补药入库",
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
_socketHelper.OpenStatus = true;
|
_socketHelper.OpenStatus = true;
|
||||||
//_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
//_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
|
|
@ -456,11 +456,13 @@ namespace DM_Weight.ViewModels
|
||||||
if (baseQty > _ChannelList.BaseQuantity)
|
if (baseQty > _ChannelList.BaseQuantity)
|
||||||
{
|
{
|
||||||
//基数变大,需要补药
|
//基数变大,需要补药
|
||||||
_ChannelList.channelStocks[0].NeedNum = _ChannelList.channelStocks[0].NeedNum+ baseQty - _ChannelList.BaseQuantity;
|
//_ChannelList.channelStocks[0].NeedNum = _ChannelList.channelStocks[0].NeedNum + baseQty - _ChannelList.BaseQuantity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ChannelList.channelStocks[0].NeedNum = 0;
|
//_ChannelList.channelStocks[0].NeedNum = 0;
|
||||||
|
_ChannelList.channelStocks.ForEach(cs => cs.State = 0);
|
||||||
|
SqlSugarHelper.Db.Updateable(_ChannelList.channelStocks).UpdateColumns(cs => new { cs.State }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
int oldBaseQty = _ChannelList.BaseQuantity;
|
int oldBaseQty = _ChannelList.BaseQuantity;
|
||||||
_ChannelList.BaseQuantity = baseQty;
|
_ChannelList.BaseQuantity = baseQty;
|
||||||
|
@ -468,10 +470,10 @@ namespace DM_Weight.ViewModels
|
||||||
//int iUpdate = SqlSugarHelper.Db.Updateable<ChannelStock>(_ChannelList.channelStocks[0]).ExecuteCommand();
|
//int iUpdate = SqlSugarHelper.Db.Updateable<ChannelStock>(_ChannelList.channelStocks[0]).ExecuteCommand();
|
||||||
_ChannelList.channelStocks.ForEach(cs => cs.BaseQuantity = baseQty);
|
_ChannelList.channelStocks.ForEach(cs => cs.BaseQuantity = baseQty);
|
||||||
int iBaseUpdate = SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(cs => new ChannelStock(){ BaseQuantity= _ChannelList.channelStocks[0].BaseQuantity }).Where(cs=>cs.Chnguid==_ChannelList.Id).ExecuteCommand();
|
int iBaseUpdate = SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(cs => new ChannelStock(){ BaseQuantity= _ChannelList.channelStocks[0].BaseQuantity }).Where(cs=>cs.Chnguid==_ChannelList.Id).ExecuteCommand();
|
||||||
if (iBaseUpdate > 0)
|
//if (iBaseUpdate > 0)
|
||||||
{
|
//{
|
||||||
iBaseUpdate = SqlSugarHelper.Db.Updateable(_ChannelList.channelStocks[0]).UpdateColumns(cs => new { cs.NeedNum }).ExecuteCommand();
|
// iBaseUpdate = SqlSugarHelper.Db.Updateable(_ChannelList.channelStocks[0]).UpdateColumns(cs => new { cs.NeedNum }).ExecuteCommand();
|
||||||
}
|
//}
|
||||||
//更新ChannelList表中的BaseQuantity
|
//更新ChannelList表中的BaseQuantity
|
||||||
int iUpdateChannelList = SqlSugarHelper.Db.Updateable<ChannelList>()
|
int iUpdateChannelList = SqlSugarHelper.Db.Updateable<ChannelList>()
|
||||||
.SetColumns(it => new ChannelList() { BaseQuantity = baseQty })
|
.SetColumns(it => new ChannelList() { BaseQuantity = baseQty })
|
||||||
|
|
|
@ -626,12 +626,13 @@ namespace DM_Weight.ViewModels
|
||||||
ManuNo = cs.ManuNo,
|
ManuNo = cs.ManuNo,
|
||||||
EffDate = cs.EffDate,
|
EffDate = cs.EffDate,
|
||||||
YQuantity = 0,
|
YQuantity = 0,
|
||||||
ManuStock = oi._OrderDetail.Quantity,
|
ManuStock =nowChannels.Sum(it => it.Quantity), //oi._OrderDetail.Quantity,
|
||||||
TotalStock = oi._OrderDetail.Quantity,
|
TotalStock = oi._OrderDetail.Quantity,
|
||||||
UserId1 = HomeWindowViewModel.Operator?.Id,
|
UserId1 = HomeWindowViewModel.Operator?.Id,
|
||||||
UserId2 = HomeWindowViewModel.Reviewer?.Id,
|
UserId2 = HomeWindowViewModel.Reviewer?.Id,
|
||||||
MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
|
MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
|
||||||
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
CreateTime=DateTime.Now,
|
||||||
InvoiceNo = "日结存"
|
InvoiceNo = "日结存"
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
if (iDayResult <= 0)
|
if (iDayResult <= 0)
|
||||||
|
@ -664,6 +665,7 @@ namespace DM_Weight.ViewModels
|
||||||
UserId2 = HomeWindowViewModel.Reviewer?.Id,
|
UserId2 = HomeWindowViewModel.Reviewer?.Id,
|
||||||
MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
|
MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
|
||||||
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
InvoiceNo = "总结存"
|
InvoiceNo = "总结存"
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
if (iTotalResult <= 0)
|
if (iTotalResult <= 0)
|
||||||
|
@ -748,7 +750,7 @@ namespace DM_Weight.ViewModels
|
||||||
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
machineRecord.OperationTime = DateTime.Now;
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
machineRecord.Type = 55;
|
machineRecord.Type = 55;
|
||||||
machineRecord.InvoiceId = $"打开{DrawerNo + 1}号手术间";
|
machineRecord.InvoiceId = $"管理员核对单,打开{DrawerNo + 1}号手术间";
|
||||||
|
|
||||||
|
|
||||||
if (DrawerNo >= 0)
|
if (DrawerNo >= 0)
|
||||||
|
|
|
@ -783,7 +783,7 @@ namespace DM_Weight.ViewModels
|
||||||
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
machineRecord.OperationTime = DateTime.Now;
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
machineRecord.Type = 55;
|
machineRecord.Type = 55;
|
||||||
machineRecord.InvoiceId = $"打开{DrawerNo}号手术间";
|
machineRecord.InvoiceId = $"麻醉师核对单,打开{DrawerNo}号手术间";
|
||||||
|
|
||||||
|
|
||||||
if (DrawerNo > 0)
|
if (DrawerNo > 0)
|
||||||
|
@ -1059,12 +1059,12 @@ namespace DM_Weight.ViewModels
|
||||||
if (oi.DmStatus == 0)
|
if (oi.DmStatus == 0)
|
||||||
{
|
{
|
||||||
//查询该药箱是否有该批次的药品,没有则无法确认(避免管理进行确认时确认不过去)
|
//查询该药箱是否有该批次的药品,没有则无法确认(避免管理进行确认时确认不过去)
|
||||||
if(oi.OrderDetailList!=null)
|
if(oi._OrderDetail != null)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < oi.OrderDetailList.Count; j++)
|
//for (int j = 0; j < oi.OrderDetailList.Count; j++)
|
||||||
{
|
//{
|
||||||
oi._OrderDetail = oi.OrderDetailList[j];
|
// oi._OrderDetail = oi.OrderDetailList[j];
|
||||||
int drawerNo = DrawerNo + 1;
|
int drawerNo = DrawerNo;
|
||||||
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.DrugId == oi._OrderDetail.DrugId
|
.Where(cs => cs.DrugId == oi._OrderDetail.DrugId
|
||||||
&& cs.ManuNo == oi._OrderDetail.SetManuNo
|
&& cs.ManuNo == oi._OrderDetail.SetManuNo
|
||||||
|
@ -1080,7 +1080,7 @@ namespace DM_Weight.ViewModels
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ namespace DM_Weight.ViewModels
|
||||||
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
machineRecord.OperationTime = DateTime.Now;
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
machineRecord.Type = 55;
|
machineRecord.Type = 55;
|
||||||
machineRecord.InvoiceId = $"打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
machineRecord.InvoiceId = $"交换药品明细{_ChannelStock?.DrawerNo},打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
||||||
|
|
||||||
|
|
||||||
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
||||||
|
|
|
@ -76,10 +76,10 @@ namespace DM_Weight.ViewModels
|
||||||
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
machineRecord.OperationTime = DateTime.Now;
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
machineRecord.Type = 55;
|
machineRecord.Type = 55;
|
||||||
machineRecord.InvoiceId = $"打开{DrawerNo+1}号手术间";
|
machineRecord.InvoiceId = $"交换药品,打开{DrawerNo+1}号手术间";
|
||||||
|
|
||||||
|
|
||||||
if (DrawerNo > 0)
|
if (DrawerNo+1 > 0)
|
||||||
{
|
{
|
||||||
RequestData();
|
RequestData();
|
||||||
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
|
|
@ -12,7 +12,6 @@ using Prism.Commands;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using ScreenRecorderLib;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -29,10 +28,10 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 录屏相关
|
#region 录屏相关
|
||||||
public Recorder _recorder;
|
//public Recorder _recorder;
|
||||||
private string _outputFolder;
|
private string _outputFolder;
|
||||||
private string _outputFilePath;
|
private string _outputFilePath;
|
||||||
public static MainWindowViewModel vm;
|
//public static MainWindowViewModel vm;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private string _title = "Prism App"; //标题
|
private string _title = "Prism App"; //标题
|
||||||
|
@ -82,9 +81,10 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
SocketHelper _socketHelper;
|
SocketHelper _socketHelper;
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, SocketHelper socketHelper, PortUtil portUtil)
|
FFmpegHelper fmpegHelper;
|
||||||
|
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, SocketHelper socketHelper, PortUtil portUtil,FFmpegHelper fmpegHelper)
|
||||||
{
|
{
|
||||||
vm = this;
|
//vm = this;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
this.eventAggregator = eventAggregator;
|
this.eventAggregator = eventAggregator;
|
||||||
this.eventAggregator.GetEvent<SnackbarEvent>().Subscribe(doMyPrismEvent2);
|
this.eventAggregator.GetEvent<SnackbarEvent>().Subscribe(doMyPrismEvent2);
|
||||||
|
@ -137,6 +137,7 @@ namespace DM_Weight.ViewModels
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.fmpegHelper= fmpegHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMyPrismEvent2(AlertMsg msg)
|
void doMyPrismEvent2(AlertMsg msg)
|
||||||
|
@ -196,21 +197,21 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
_recorder?.Dispose();
|
//_recorder?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
void StopPrintScreen()
|
void StopPrintScreen()
|
||||||
{
|
{
|
||||||
|
fmpegHelper.stopFlag = true;
|
||||||
|
fmpegHelper.StopRecording();
|
||||||
//退出登录结束录屏
|
//退出登录结束录屏
|
||||||
_recorder?.Stop();
|
//_recorder?.Stop();
|
||||||
}
|
}
|
||||||
//录屏
|
//录屏
|
||||||
void StartPrintScreen()
|
void StartPrintScreen()
|
||||||
{
|
{
|
||||||
|
fmpegHelper.stopFlag = false;
|
||||||
// 创建输出目录
|
|
||||||
_outputFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Log", "ScreenRecordings");
|
_outputFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Log", "ScreenRecordings");
|
||||||
if (!Directory.Exists(_outputFolder))
|
if (!Directory.Exists(_outputFolder))
|
||||||
{
|
{
|
||||||
|
@ -218,30 +219,40 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
// 生成输出文件名
|
// 生成输出文件名
|
||||||
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
_outputFilePath = Path.Combine(_outputFolder, $"{timestamp}.mp4");
|
_outputFilePath = Path.Combine(_outputFolder, $"{timestamp}.webm");
|
||||||
|
fmpegHelper.StartRecording(_outputFilePath, 25);
|
||||||
|
//// 创建输出目录
|
||||||
|
//_outputFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Log", "ScreenRecordings");
|
||||||
|
//if (!Directory.Exists(_outputFolder))
|
||||||
|
//{
|
||||||
|
// Directory.CreateDirectory(_outputFolder);
|
||||||
|
//}
|
||||||
|
//// 生成输出文件名
|
||||||
|
//string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
|
//_outputFilePath = Path.Combine(_outputFolder, $"{timestamp}.mp4");
|
||||||
|
|
||||||
// 设置录制选项
|
//// 设置录制选项
|
||||||
var options = new RecorderOptions();
|
//var options = new RecorderOptions();
|
||||||
|
|
||||||
// 创建录制器实例
|
//// 创建录制器实例
|
||||||
_recorder = Recorder.CreateRecorder(options);
|
//_recorder = Recorder.CreateRecorder(options);
|
||||||
|
|
||||||
// 设置事件处理
|
//// 设置事件处理
|
||||||
_recorder.OnRecordingComplete += Recorder_OnRecordingComplete;
|
//_recorder.OnRecordingComplete += Recorder_OnRecordingComplete;
|
||||||
_recorder.OnRecordingFailed += Recorder_OnRecordingFailed;
|
//_recorder.OnRecordingFailed += Recorder_OnRecordingFailed;
|
||||||
|
|
||||||
// 开始录制
|
//// 开始录制
|
||||||
_recorder.Record(_outputFilePath);
|
//_recorder.Record(_outputFilePath);
|
||||||
}
|
}
|
||||||
//录制失败
|
//录制失败
|
||||||
private void Recorder_OnRecordingFailed(object sender, RecordingFailedEventArgs e)
|
//private void Recorder_OnRecordingFailed(object sender, RecordingFailedEventArgs e)
|
||||||
{
|
//{
|
||||||
logger.Info($"录制失败: {e.Error}");
|
// logger.Info($"录制失败: {e.Error}");
|
||||||
}
|
//}
|
||||||
//录制完成
|
////录制完成
|
||||||
private void Recorder_OnRecordingComplete(object sender, RecordingCompleteEventArgs e)
|
//private void Recorder_OnRecordingComplete(object sender, RecordingCompleteEventArgs e)
|
||||||
{
|
//{
|
||||||
logger.Info($"录制完成: {e.FilePath}");
|
// logger.Info($"录制完成: {e.FilePath}");
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace DM_Weight.ViewModels
|
||||||
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
machineRecord.OperationTime = DateTime.Now;
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
machineRecord.Type = 55;
|
machineRecord.Type = 55;
|
||||||
machineRecord.InvoiceId = $"打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
machineRecord.InvoiceId = $"移出药品{_ChannelStock?.DrawerNo}打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
||||||
|
|
||||||
|
|
||||||
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
||||||
|
|
|
@ -226,7 +226,7 @@ namespace DM_Weight.ViewModels
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Type = 55,
|
Type = 55,
|
||||||
InvoiceId = $"打开{DrawerNo}号手术间",
|
InvoiceId = $"设置药箱,打开{DrawerNo}号手术间",
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
//bool bFlag = ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo - 1);
|
//bool bFlag = ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo - 1);
|
||||||
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo - 1) });
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo - 1) });
|
||||||
|
|
|
@ -112,8 +112,8 @@
|
||||||
<Grid Margin="0 6 0 6" Grid.Row="0" Grid.ColumnSpan="2">
|
<Grid Margin="0 6 0 6" Grid.Row="0" Grid.ColumnSpan="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="3*" />
|
<ColumnDefinition Width="3*" />
|
||||||
<ColumnDefinition Width="4*" />
|
<ColumnDefinition Width="3*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="3*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
materialDesign:HintAssist.Hint="开单日期"
|
materialDesign:HintAssist.Hint="开单日期"
|
||||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
|
Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
|
||||||
|
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
|
||||||
<!--<Button Margin="0 0 6 0" Content="{Binding SelfContent}" Command="{Binding OpenBoxDelegate}" CommandParameter="0" Visibility="Collapsed"
|
<!--<Button Margin="0 0 6 0" Content="{Binding SelfContent}" Command="{Binding OpenBoxDelegate}" CommandParameter="0" Visibility="Collapsed"
|
||||||
IsEnabled="{Binding SelfEnable}"
|
IsEnabled="{Binding SelfEnable}"
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<Grid Grid.Column="1" Margin="6">
|
<Grid Grid.Column="1" Margin="6">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="550" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
||||||
<Button Margin="6 0 6 6"
|
<Button Margin="6 0 6 6"
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
<Grid Grid.Column="1" Margin="6">
|
<Grid Grid.Column="1" Margin="6">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="550" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
||||||
<Button Margin="6 0 6 6"
|
<Button Margin="6 0 6 6"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition Height="550" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||||
|
|
|
@ -32,12 +32,12 @@ namespace DM_Weight.Views
|
||||||
{
|
{
|
||||||
//IRegionManager _regionManager;
|
//IRegionManager _regionManager;
|
||||||
//IUnityContainer _container;
|
//IUnityContainer _container;
|
||||||
MainWindowViewModel vms;
|
//MainWindowViewModel vms;
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(PortUtil));
|
private readonly ILog logger = LogManager.GetLogger(typeof(PortUtil));
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
vms = MainWindowViewModel.vm;
|
//vms = MainWindowViewModel.vm;
|
||||||
//_regionManager = regionManager;
|
//_regionManager = regionManager;
|
||||||
//_container = container;
|
//_container = container;
|
||||||
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
@ -49,10 +49,10 @@ namespace DM_Weight.Views
|
||||||
//}));
|
//}));
|
||||||
|
|
||||||
}
|
}
|
||||||
protected override void OnClosed(EventArgs e)
|
//protected override void OnClosed(EventArgs e)
|
||||||
{
|
//{
|
||||||
vms._recorder?.Dispose();
|
// vms._recorder?.Dispose();
|
||||||
base.OnClosed(e);
|
// base.OnClosed(e);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition Height="550"/>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace DM_Weight.util
|
||||||
|
{
|
||||||
|
public class FFmpegHelper
|
||||||
|
{
|
||||||
|
private Process _ffmpegProcess;
|
||||||
|
private string _ffmpegPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ffmpeg.exe");
|
||||||
|
//是否停止录屏标志
|
||||||
|
public bool stopFlag = false;
|
||||||
|
|
||||||
|
public void StartRecording(string outputPath, int frameRate = 30)
|
||||||
|
{
|
||||||
|
//int width = (int)SystemParameters.PrimaryScreenWidth;
|
||||||
|
//int height = (int)SystemParameters.PrimaryScreenHeight;
|
||||||
|
//string args = $"-f gdigrab -framerate 30 -i desktop -c:v libx264 -crf 25 -preset ultrafast -t {segmentDuration} {segmentPath}";
|
||||||
|
int segmentDuration = 1800; // 每段半小时
|
||||||
|
string args = $"-f gdigrab -framerate {frameRate} " +
|
||||||
|
$"-i desktop -preset ultrafast -t {segmentDuration} {outputPath}";
|
||||||
|
|
||||||
|
_ffmpegProcess = new Process
|
||||||
|
{
|
||||||
|
StartInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = _ffmpegPath,
|
||||||
|
Arguments = args,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true,
|
||||||
|
RedirectStandardInput = true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_ffmpegProcess.Start();
|
||||||
|
ThreadPool.QueueUserWorkItem(CheckFFmpegProcess); // 检查FFmpeg进程是否完成,以开始下一个录制段
|
||||||
|
}
|
||||||
|
public void StopRecording()
|
||||||
|
{
|
||||||
|
_ffmpegProcess?.StandardInput.WriteLine("q");
|
||||||
|
_ffmpegProcess?.WaitForExit(1000);
|
||||||
|
_ffmpegProcess?.Close();
|
||||||
|
}
|
||||||
|
private void CheckFFmpegProcess(object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!stopFlag)
|
||||||
|
{
|
||||||
|
_ffmpegProcess.WaitForExit(); // 等待FFmpeg进程结束
|
||||||
|
if (!_ffmpegProcess.HasExited) return; // 如果进程未结束,则不继续
|
||||||
|
// 开始下一个录制段,如果需要循环录制,可以取消注释下面的代码行并适当调整逻辑
|
||||||
|
// StartRecording(); // 注意:这将无限循环录制,可能需要用户界面干预来停止或重置计数器。
|
||||||
|
string _outputFolder;
|
||||||
|
string _outputFilePath;
|
||||||
|
_outputFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Log", "ScreenRecordings");
|
||||||
|
if (!Directory.Exists(_outputFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(_outputFolder);
|
||||||
|
}
|
||||||
|
// 生成输出文件名
|
||||||
|
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
|
_outputFilePath = Path.Combine(_outputFolder, $"{timestamp}.webm");
|
||||||
|
StartRecording(_outputFilePath, 25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue