Browse Source

摄像头 抢答点名页面

ZhangXueYang
zhangxueyang 3 years ago
parent
commit
598e619c68

+ 15
- 0
XHZB.Desktop/CameraWindow.xaml View File

@@ -0,0 +1,15 @@
1
+<Window x:Class="XHZB.Desktop.CameraWindow"
2
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
+        xmlns:local="clr-namespace:XHZB.Desktop" xmlns:wfi="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
7
+xmlns:aforge ="clr-namespace:AForge.Controls;assembly=AForge.Controls"
8
+        mc:Ignorable="d"
9
+        Title="CameraWindow" Height="250" Width="200" >
10
+    <Grid>
11
+        <wfi:WindowsFormsHost Grid.Row="0" Grid.Column="1" x:Name="wfhCamera" Height="124" Width="172" HorizontalAlignment="Right" Margin="0,10,30.10,0" VerticalAlignment="Top">
12
+            <aforge:VideoSourcePlayer x:Name="player" Height="124" Width="172"  />
13
+        </wfi:WindowsFormsHost>
14
+    </Grid>
15
+</Window>

+ 36
- 0
XHZB.Desktop/CameraWindow.xaml.cs View File

@@ -0,0 +1,36 @@
1
+using AForge.Video.DirectShow;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+using System.Windows;
8
+using System.Windows.Controls;
9
+using System.Windows.Data;
10
+using System.Windows.Documents;
11
+using System.Windows.Input;
12
+using System.Windows.Media;
13
+using System.Windows.Media.Imaging;
14
+using System.Windows.Shapes;
15
+
16
+namespace XHZB.Desktop
17
+{
18
+    /// <summary>
19
+    /// CameraWindow.xaml 的交互逻辑
20
+    /// </summary>
21
+    public partial class CameraWindow : Window
22
+    {
23
+        public CameraWindow()
24
+        {
25
+            InitializeComponent();
26
+            FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
27
+            if(videoDevices.Count>0)
28
+            {
29
+                var videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
30
+                videoDevice.VideoResolution = videoDevice.VideoCapabilities[0];
31
+                player.VideoSource = videoDevice;
32
+                player.Start();
33
+            }
34
+        }
35
+    }
36
+}

+ 9
- 0
XHZB.Desktop/LoginWindow.xaml.cs View File

@@ -70,6 +70,15 @@ namespace XHZB.Desktop
70 70
         public LoginWindow()
71 71
         {
72 72
             InitializeComponent();
73
+
74
+
75
+            CameraWindow cameraWindow = new CameraWindow();
76
+            cameraWindow.Topmost = true;
77
+            cameraWindow.Show();
78
+
79
+
80
+
81
+
73 82
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
74 83
 
75 84
             string typestr = APP.isDebug ? "测试版" : "正式版";

+ 0
- 5
XHZB.Desktop/ToolbarWindow.xaml.cs View File

@@ -93,11 +93,6 @@ namespace XHZB.Desktop
93 93
         }
94 94
         #endregion
95 95
 
96
-
97
-
98
-
99
-
100
-
101 96
         #region 事件
102 97
         /// <summary>
103 98
         /// 模块点击

+ 31
- 6
XHZB.Desktop/XHZB.Desktop.csproj View File

@@ -44,6 +44,24 @@
44 44
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
45 45
   </PropertyGroup>
46 46
   <ItemGroup>
47
+    <Reference Include="AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb, processorArchitecture=MSIL">
48
+      <HintPath>..\packages\AForge.2.2.5\lib\AForge.dll</HintPath>
49
+    </Reference>
50
+    <Reference Include="AForge.Controls, Version=2.2.5.0, Culture=neutral, PublicKeyToken=a8ac264d1dc6b9d9, processorArchitecture=MSIL">
51
+      <HintPath>..\packages\AForge.Controls.2.2.5\lib\AForge.Controls.dll</HintPath>
52
+    </Reference>
53
+    <Reference Include="AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b, processorArchitecture=MSIL">
54
+      <HintPath>..\packages\AForge.Imaging.2.2.5\lib\AForge.Imaging.dll</HintPath>
55
+    </Reference>
56
+    <Reference Include="AForge.Math, Version=2.2.5.0, Culture=neutral, PublicKeyToken=abba2e25397ee8c9, processorArchitecture=MSIL">
57
+      <HintPath>..\packages\AForge.Math.2.2.5\lib\AForge.Math.dll</HintPath>
58
+    </Reference>
59
+    <Reference Include="AForge.Video, Version=2.2.5.0, Culture=neutral, PublicKeyToken=cbfb6e07d173c401, processorArchitecture=MSIL">
60
+      <HintPath>..\packages\AForge.Video.2.2.5\lib\AForge.Video.dll</HintPath>
61
+    </Reference>
62
+    <Reference Include="AForge.Video.DirectShow, Version=2.2.5.0, Culture=neutral, PublicKeyToken=61ea4348d43881b7, processorArchitecture=MSIL">
63
+      <HintPath>..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll</HintPath>
64
+    </Reference>
47 65
     <Reference Include="log4net">
48 66
       <HintPath>..\Common\dlls\log4net.dll</HintPath>
49 67
     </Reference>
@@ -53,18 +71,18 @@
53 71
     <Reference Include="System" />
54 72
     <Reference Include="System.Data" />
55 73
     <Reference Include="System.Drawing" />
56
-    <Reference Include="System.Xml" />
57 74
     <Reference Include="Microsoft.CSharp" />
58 75
     <Reference Include="System.Core" />
59
-    <Reference Include="System.Xml.Linq" />
60 76
     <Reference Include="System.Data.DataSetExtensions" />
61 77
     <Reference Include="System.Net.Http" />
62
-    <Reference Include="System.Xaml">
63
-      <RequiredTargetFramework>4.0</RequiredTargetFramework>
64
-    </Reference>
65
-    <Reference Include="WindowsBase" />
66 78
     <Reference Include="PresentationCore" />
67 79
     <Reference Include="PresentationFramework" />
80
+    <Reference Include="System.Windows.Forms" />
81
+    <Reference Include="System.Xaml" />
82
+    <Reference Include="System.XML" />
83
+    <Reference Include="System.Xml.Linq" />
84
+    <Reference Include="WindowsBase" />
85
+    <Reference Include="WindowsFormsIntegration" />
68 86
     <Reference Include="WpfAnimatedGif, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9e7cd3b544a090dc, processorArchitecture=MSIL">
69 87
       <HintPath>..\packages\WpfAnimatedGif.2.0.0\lib\net40\WpfAnimatedGif.dll</HintPath>
70 88
     </Reference>
@@ -73,6 +91,9 @@
73 91
     <Compile Include="AttendanceWindow.xaml.cs">
74 92
       <DependentUpon>AttendanceWindow.xaml</DependentUpon>
75 93
     </Compile>
94
+    <Compile Include="CameraWindow.xaml.cs">
95
+      <DependentUpon>CameraWindow.xaml</DependentUpon>
96
+    </Compile>
76 97
     <Compile Include="LoadDialog.xaml.cs">
77 98
       <DependentUpon>LoadDialog.xaml</DependentUpon>
78 99
     </Compile>
@@ -107,6 +128,10 @@
107 128
       <SubType>Designer</SubType>
108 129
       <Generator>MSBuild:Compile</Generator>
109 130
     </Page>
131
+    <Page Include="CameraWindow.xaml">
132
+      <SubType>Designer</SubType>
133
+      <Generator>MSBuild:Compile</Generator>
134
+    </Page>
110 135
     <Page Include="LoadDialog.xaml">
111 136
       <SubType>Designer</SubType>
112 137
       <Generator>MSBuild:Compile</Generator>

+ 6
- 0
XHZB.Desktop/packages.config View File

@@ -1,5 +1,11 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <packages>
3
+  <package id="AForge" version="2.2.5" targetFramework="net452" />
4
+  <package id="AForge.Controls" version="2.2.5" targetFramework="net452" />
5
+  <package id="AForge.Imaging" version="2.2.5" targetFramework="net452" />
6
+  <package id="AForge.Math" version="2.2.5" targetFramework="net452" />
7
+  <package id="AForge.Video" version="2.2.5" targetFramework="net452" />
8
+  <package id="AForge.Video.DirectShow" version="2.2.5" targetFramework="net452" />
3 9
   <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
4 10
   <package id="WpfAnimatedGif" version="2.0.0" targetFramework="net452" />
5 11
 </packages>

Loading…
Cancel
Save