添加efcore sqlite数据访问;添加异常处理;添加用户和学生模型。

Former-commit-id: 6a4bc0c2c3028fb9599318fa0941cebd623ea82a
TangShanKaiPing
wanggang 5 years ago
parent 67d38ab328
commit 689c211a6a

@ -33,9 +33,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -69,7 +66,6 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -83,5 +79,10 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="SharpZipLib">
<Version>1.2.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

@ -9,7 +9,6 @@ D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\AutoUpdate.exe
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\AutoUpdate.pdb D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\AutoUpdate.pdb
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.dll D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.dll
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.pdb D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.pdb
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.xml
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.UpdateForm.resources D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.UpdateForm.resources
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.Properties.Resources.resources D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.Properties.Resources.resources
D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.csproj.GenerateResource.cache D:\1.0\ZHXY\labs\CameraCard\AutoUpdate\obj\Debug\AutoUpdate.csproj.GenerateResource.cache

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpZipLib" version="1.2.0" targetFramework="net48" />
</packages>

@ -77,7 +77,12 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Data\Entity.cs" />
<Compile Include="Data\MyDbContext.cs" />
<Compile Include="Data\Student.cs" />
<Compile Include="Data\User.cs" />
<Compile Include="CVRSDK.cs" /> <Compile Include="CVRSDK.cs" />
<Compile Include="Infrastructure\DllExtern.cs" />
<Compile Include="Infrastructure\ImageHelper.cs" /> <Compile Include="Infrastructure\ImageHelper.cs" />
<Compile Include="Infrastructure\CVRHelper.cs" /> <Compile Include="Infrastructure\CVRHelper.cs" />
<Compile Include="Infrastructure\CVRSDK.cs" /> <Compile Include="Infrastructure\CVRSDK.cs" />
@ -120,9 +125,15 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite">
<Version>3.1.2</Version>
</PackageReference>
<PackageReference Include="OpenCvSharp4.Windows"> <PackageReference Include="OpenCvSharp4.Windows">
<Version>4.2.0.20200208</Version> <Version>4.2.0.20200208</Version>
</PackageReference> </PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher">
<Version>2.0.2</Version>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="lib\DirectShowLib-2005.dll" /> <Content Include="lib\DirectShowLib-2005.dll" />

@ -38,10 +38,10 @@ public static class ImageHelper
var info = ImageCodecInfo.GetImageEncoders().First(o => o.FormatID == ImageFormat.Jpeg.Guid); var info = ImageCodecInfo.GetImageEncoders().First(o => o.FormatID == ImageFormat.Jpeg.Guid);
using (var encoderParams = new EncoderParameters(1)) using (var encoderParams = new EncoderParameters(1))
{ {
using (var param = new EncoderParameter(Encoder.Quality, 70L)) using (var param = new EncoderParameter(Encoder.Quality, 90L))
{ {
encoderParams.Param[0] = param; encoderParams.Param[0] = param;
//image.Save("temp.jpg", info, encoderParams); image.Save("temp.jpg", info, encoderParams);
using (var ms = new MemoryStream()) using (var ms = new MemoryStream())
{ {
image.Save(ms, info, encoderParams); image.Save(ms, info, encoderParams);

@ -79,8 +79,8 @@
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.versionLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.versionLabel = new System.Windows.Forms.ToolStripStatusLabel();
tab1 = new System.Windows.Forms.TabPage(); tab1 = new System.Windows.Forms.TabPage();
tab1.SuspendLayout(); tab1.SuspendLayout();
this.idcGroupBox.SuspendLayout(); this.idcGroupBox.SuspendLayout();
@ -152,9 +152,9 @@
this.idcSamIDValue.AutoSize = true; this.idcSamIDValue.AutoSize = true;
this.idcSamIDValue.Location = new System.Drawing.Point(82, 199); this.idcSamIDValue.Location = new System.Drawing.Point(82, 199);
this.idcSamIDValue.Name = "idcSamIDValue"; this.idcSamIDValue.Name = "idcSamIDValue";
this.idcSamIDValue.Size = new System.Drawing.Size(41, 12); this.idcSamIDValue.Size = new System.Drawing.Size(17, 12);
this.idcSamIDValue.TabIndex = 28; this.idcSamIDValue.TabIndex = 28;
this.idcSamIDValue.Text = "label3"; this.idcSamIDValue.Text = "";
// //
// idcSamIDLabel // idcSamIDLabel
// //
@ -170,9 +170,9 @@
this.idcValidDateValue.AutoSize = true; this.idcValidDateValue.AutoSize = true;
this.idcValidDateValue.Location = new System.Drawing.Point(76, 175); this.idcValidDateValue.Location = new System.Drawing.Point(76, 175);
this.idcValidDateValue.Name = "idcValidDateValue"; this.idcValidDateValue.Name = "idcValidDateValue";
this.idcValidDateValue.Size = new System.Drawing.Size(41, 12); this.idcValidDateValue.Size = new System.Drawing.Size(17, 12);
this.idcValidDateValue.TabIndex = 26; this.idcValidDateValue.TabIndex = 26;
this.idcValidDateValue.Text = "label4"; this.idcValidDateValue.Text = "";
// //
// idcValidDateLabel // idcValidDateLabel
// //
@ -188,9 +188,9 @@
this.idcDepartmentValue.AutoSize = true; this.idcDepartmentValue.AutoSize = true;
this.idcDepartmentValue.Location = new System.Drawing.Point(74, 148); this.idcDepartmentValue.Location = new System.Drawing.Point(74, 148);
this.idcDepartmentValue.Name = "idcDepartmentValue"; this.idcDepartmentValue.Name = "idcDepartmentValue";
this.idcDepartmentValue.Size = new System.Drawing.Size(41, 12); this.idcDepartmentValue.Size = new System.Drawing.Size(17, 12);
this.idcDepartmentValue.TabIndex = 24; this.idcDepartmentValue.TabIndex = 24;
this.idcDepartmentValue.Text = "label3"; this.idcDepartmentValue.Text = "";
// //
// idcDepartmentLabel // idcDepartmentLabel
// //
@ -206,9 +206,9 @@
this.idcIdCardNoValue.AutoSize = true; this.idcIdCardNoValue.AutoSize = true;
this.idcIdCardNoValue.Location = new System.Drawing.Point(74, 124); this.idcIdCardNoValue.Location = new System.Drawing.Point(74, 124);
this.idcIdCardNoValue.Name = "idcIdCardNoValue"; this.idcIdCardNoValue.Name = "idcIdCardNoValue";
this.idcIdCardNoValue.Size = new System.Drawing.Size(41, 12); this.idcIdCardNoValue.Size = new System.Drawing.Size(17, 12);
this.idcIdCardNoValue.TabIndex = 22; this.idcIdCardNoValue.TabIndex = 22;
this.idcIdCardNoValue.Text = "label4"; this.idcIdCardNoValue.Text = "";
// //
// idcIdCardNoLabel // idcIdCardNoLabel
// //
@ -224,9 +224,9 @@
this.idcBirthdayValue.AutoSize = true; this.idcBirthdayValue.AutoSize = true;
this.idcBirthdayValue.Location = new System.Drawing.Point(49, 72); this.idcBirthdayValue.Location = new System.Drawing.Point(49, 72);
this.idcBirthdayValue.Name = "idcBirthdayValue"; this.idcBirthdayValue.Name = "idcBirthdayValue";
this.idcBirthdayValue.Size = new System.Drawing.Size(41, 12); this.idcBirthdayValue.Size = new System.Drawing.Size(17, 12);
this.idcBirthdayValue.TabIndex = 20; this.idcBirthdayValue.TabIndex = 20;
this.idcBirthdayValue.Text = "label3"; this.idcBirthdayValue.Text = "";
// //
// idcBirthdayLabel // idcBirthdayLabel
// //
@ -242,9 +242,9 @@
this.idcNationCodeValue.AutoSize = true; this.idcNationCodeValue.AutoSize = true;
this.idcNationCodeValue.Location = new System.Drawing.Point(250, 48); this.idcNationCodeValue.Location = new System.Drawing.Point(250, 48);
this.idcNationCodeValue.Name = "idcNationCodeValue"; this.idcNationCodeValue.Name = "idcNationCodeValue";
this.idcNationCodeValue.Size = new System.Drawing.Size(41, 12); this.idcNationCodeValue.Size = new System.Drawing.Size(17, 12);
this.idcNationCodeValue.TabIndex = 18; this.idcNationCodeValue.TabIndex = 18;
this.idcNationCodeValue.Text = "label3"; this.idcNationCodeValue.Text = "";
// //
// idcNationCodeLabel // idcNationCodeLabel
// //
@ -260,9 +260,9 @@
this.idcNationValue.AutoSize = true; this.idcNationValue.AutoSize = true;
this.idcNationValue.Location = new System.Drawing.Point(132, 48); this.idcNationValue.Location = new System.Drawing.Point(132, 48);
this.idcNationValue.Name = "idcNationValue"; this.idcNationValue.Name = "idcNationValue";
this.idcNationValue.Size = new System.Drawing.Size(41, 12); this.idcNationValue.Size = new System.Drawing.Size(17, 12);
this.idcNationValue.TabIndex = 16; this.idcNationValue.TabIndex = 16;
this.idcNationValue.Text = "label4"; this.idcNationValue.Text = "";
// //
// idcNationLabel // idcNationLabel
// //
@ -278,9 +278,9 @@
this.idcSexValue.AutoSize = true; this.idcSexValue.AutoSize = true;
this.idcSexValue.Location = new System.Drawing.Point(47, 49); this.idcSexValue.Location = new System.Drawing.Point(47, 49);
this.idcSexValue.Name = "idcSexValue"; this.idcSexValue.Name = "idcSexValue";
this.idcSexValue.Size = new System.Drawing.Size(41, 12); this.idcSexValue.Size = new System.Drawing.Size(17, 12);
this.idcSexValue.TabIndex = 14; this.idcSexValue.TabIndex = 14;
this.idcSexValue.Text = "label3"; this.idcSexValue.Text = "";
// //
// idcSexLabel // idcSexLabel
// //
@ -296,9 +296,9 @@
this.idcAddressValue.AutoSize = true; this.idcAddressValue.AutoSize = true;
this.idcAddressValue.Location = new System.Drawing.Point(49, 97); this.idcAddressValue.Location = new System.Drawing.Point(49, 97);
this.idcAddressValue.Name = "idcAddressValue"; this.idcAddressValue.Name = "idcAddressValue";
this.idcAddressValue.Size = new System.Drawing.Size(41, 12); this.idcAddressValue.Size = new System.Drawing.Size(17, 12);
this.idcAddressValue.TabIndex = 12; this.idcAddressValue.TabIndex = 12;
this.idcAddressValue.Text = "label3"; this.idcAddressValue.Text = "";
// //
// idcAddressLabel // idcAddressLabel
// //
@ -314,9 +314,9 @@
this.idcCnNameValue.AutoSize = true; this.idcCnNameValue.AutoSize = true;
this.idcCnNameValue.Location = new System.Drawing.Point(219, 24); this.idcCnNameValue.Location = new System.Drawing.Point(219, 24);
this.idcCnNameValue.Name = "idcCnNameValue"; this.idcCnNameValue.Name = "idcCnNameValue";
this.idcCnNameValue.Size = new System.Drawing.Size(41, 12); this.idcCnNameValue.Size = new System.Drawing.Size(17, 12);
this.idcCnNameValue.TabIndex = 10; this.idcCnNameValue.TabIndex = 10;
this.idcCnNameValue.Text = "label3"; this.idcCnNameValue.Text = "";
// //
// idcCnNameLabel // idcCnNameLabel
// //
@ -330,11 +330,11 @@
// idcNameValue // idcNameValue
// //
this.idcNameValue.AutoSize = true; this.idcNameValue.AutoSize = true;
this.idcNameValue.Location = new System.Drawing.Point(45, 24); this.idcNameValue.Location = new System.Drawing.Point(47, 24);
this.idcNameValue.Name = "idcNameValue"; this.idcNameValue.Name = "idcNameValue";
this.idcNameValue.Size = new System.Drawing.Size(41, 12); this.idcNameValue.Size = new System.Drawing.Size(17, 12);
this.idcNameValue.TabIndex = 8; this.idcNameValue.TabIndex = 8;
this.idcNameValue.Text = "label3"; this.idcNameValue.Text = "";
// //
// idcNameLable // idcNameLable
// //
@ -348,10 +348,11 @@
// idcPicture // idcPicture
// //
this.idcPicture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.idcPicture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.idcPicture.Location = new System.Drawing.Point(299, 20); this.idcPicture.BackColor = System.Drawing.Color.Black;
this.idcPicture.Location = new System.Drawing.Point(317, 20);
this.idcPicture.Name = "idcPicture"; this.idcPicture.Name = "idcPicture";
this.idcPicture.Size = new System.Drawing.Size(120, 147); this.idcPicture.Size = new System.Drawing.Size(102, 126);
this.idcPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.idcPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.idcPicture.TabIndex = 6; this.idcPicture.TabIndex = 6;
this.idcPicture.TabStop = false; this.idcPicture.TabStop = false;
// //
@ -360,9 +361,9 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.photo); this.groupBox1.Controls.Add(this.photo);
this.groupBox1.Location = new System.Drawing.Point(173, 6); this.groupBox1.Location = new System.Drawing.Point(173, 9);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(426, 252); this.groupBox1.Size = new System.Drawing.Size(426, 249);
this.groupBox1.TabIndex = 6; this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "学籍信息"; this.groupBox1.Text = "学籍信息";
@ -370,9 +371,10 @@
// photo // photo
// //
this.photo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.photo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.photo.Location = new System.Drawing.Point(300, 19); this.photo.BackColor = System.Drawing.Color.Black;
this.photo.Location = new System.Drawing.Point(318, 21);
this.photo.Name = "photo"; this.photo.Name = "photo";
this.photo.Size = new System.Drawing.Size(120, 147); this.photo.Size = new System.Drawing.Size(102, 130);
this.photo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.photo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.photo.TabIndex = 5; this.photo.TabIndex = 5;
this.photo.TabStop = false; this.photo.TabStop = false;
@ -627,6 +629,12 @@
this.statusStrip1.TabIndex = 3; this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// statusLabel
//
this.statusLabel.Name = "statusLabel";
this.statusLabel.Size = new System.Drawing.Size(32, 17);
this.statusLabel.Text = "状态";
//
// versionLabel // versionLabel
// //
this.versionLabel.Name = "versionLabel"; this.versionLabel.Name = "versionLabel";
@ -634,12 +642,6 @@
this.versionLabel.Size = new System.Drawing.Size(14, 17); this.versionLabel.Size = new System.Drawing.Size(14, 17);
this.versionLabel.Text = "v"; this.versionLabel.Text = "v";
// //
// statusLabel
//
this.statusLabel.Name = "statusLabel";
this.statusLabel.Size = new System.Drawing.Size(32, 17);
this.statusLabel.Text = "状态";
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

@ -1,10 +1,11 @@
using System; using CameraCard.Data;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
namespace CameraCard namespace CameraCard
@ -20,6 +21,7 @@ namespace CameraCard
InitializeComponent(); InitializeComponent();
this.versionLabel.Alignment = ToolStripItemAlignment.Right; this.versionLabel.Alignment = ToolStripItemAlignment.Right;
this.versionLabel.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.versionLabel.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString();
MyDbContext.Init();
} }
private void MainFrom_Load(object sender, EventArgs e) private void MainFrom_Load(object sender, EventArgs e)
@ -31,30 +33,60 @@ namespace CameraCard
{ {
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
this.cameraSelector.Items.Clear(); try
this.cameraSelector.Text = string.Empty;
foreach (var item in o)
{ {
this.cameraSelector.Items.Add(item); this.cameraSelector.Items.Clear();
this.cameraSelector.Text = string.Empty;
foreach (var item in o)
{
this.cameraSelector.Items.Add(item);
}
if (this.cameraSelector.Items.Count > 0)
{
this.cameraSelector.SelectedIndex = 0;
}
else
{
this.cameraSelector.Text = "没有检测到USB摄像头";
}
} }
if (this.cameraSelector.Items.Count > 0) catch (Exception ex)
{ {
this.cameraSelector.SelectedIndex = 0; this.log.Text += ex.Message;
} this.log.Text += ex.StackTrace;
else this.log.Text += Environment.NewLine;
{
this.cameraSelector.Text = "没有检测到USB摄像头";
} }
})); }));
}; };
this._cameraHelper.OnFrame = o => this._cameraHelper.OnFrame = o =>
{ {
cameraRender.Image?.Dispose(); this.Invoke(new Action(() =>
cameraRender.Image = o; {
try
{
cameraRender.Image?.Dispose();
cameraRender.Image = o;
}
catch (Exception ex)
{
this.log.Text += ex.Message;
this.log.Text += ex.StackTrace;
this.log.Text += Environment.NewLine;
}
}));
}; };
this.cameraSelector.SelectedIndexChanged += new EventHandler((s, o) => this.cameraSelector.SelectedIndexChanged += new EventHandler((s, o) =>
{ {
this._cameraHelper.SwitchCamera((s as ComboBox).SelectedIndex); try
{
this._cameraHelper.SwitchCamera((s as ComboBox).SelectedIndex);
}
catch (Exception ex)
{
this.log.Text += ex.Message;
this.log.Text += ex.StackTrace;
this.log.Text += Environment.NewLine;
}
}); });
this._cameraHelper.Start(); this._cameraHelper.Start();
//身份读卡器 //身份读卡器
@ -69,7 +101,16 @@ namespace CameraCard
{ {
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
this.UpdateIdCardUI(o); try
{
this.UpdateIdCardUI(o);
}
catch (Exception ex)
{
this.log.Text += ex.Message;
this.log.Text += ex.StackTrace;
this.log.Text += Environment.NewLine;
}
})); }));
}); });
this._cvrHelper.Start(); this._cvrHelper.Start();
@ -103,12 +144,21 @@ namespace CameraCard
private void cameraRender_Paint(object sender, PaintEventArgs e) private void cameraRender_Paint(object sender, PaintEventArgs e)
{ {
e.Graphics.DrawRectangle(this._pen, _rect); try
{
e.Graphics.DrawRectangle(this._pen, _rect);
}
catch (Exception ex)
{
this.log.Text += ex.Message;
this.log.Text += ex.StackTrace;
this.log.Text += Environment.NewLine;
}
} }
private void shotBtn_Click(object sender, EventArgs e) private void shotBtn_Click(object sender, EventArgs e)
{ {
lock (this.cameraRender.Image) try
{ {
using (var bitmap = (this.cameraRender.Image.Clone() as Image)) using (var bitmap = (this.cameraRender.Image.Clone() as Image))
{ {
@ -120,6 +170,12 @@ namespace CameraCard
} }
} }
} }
catch (Exception ex)
{
this.log.Text += ex.Message;
this.log.Text += ex.StackTrace;
this.log.Text += Environment.NewLine;
}
} }
private void UpdateIdCardUI(IdCardModel model) private void UpdateIdCardUI(IdCardModel model)

Loading…
Cancel
Save