diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index 84127f5..da6bcae 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -186,7 +186,8 @@
{
var faceMarkPoints = _faceLandMarker.Mark(faceImage, faceInfos[0]);
var faceFeatures = _faceRecognizer.Extract(faceImage, faceMarkPoints);
- Debug.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures));
+ LogWithConsole.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures),
+ "MainViewModel");
return _faceRecognizer.IsSelf(faceFeatures, _localeFaceFeatures);
});
task.Start();
@@ -210,7 +211,7 @@
/// float[]
private float[] ExtractLocalePicture()
{
- var image = (Bitmap)Image.FromFile(@"D:\Android\IMG_20221008_155007.jpg");
+ var image = (Bitmap)Image.FromFile(@"D:\Code\IMG_20221008_155007.jpg");
var faceImage = SKBitmap.Decode(BitmapToBytes(image)).ToFaceImage();
var faceInfos = _faceDetector.Detect(faceImage);
var faceMarkPoints = new FaceLandmarker().Mark(faceImage, faceInfos[0]);
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index 84127f5..da6bcae 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -186,7 +186,8 @@
{
var faceMarkPoints = _faceLandMarker.Mark(faceImage, faceInfos[0]);
var faceFeatures = _faceRecognizer.Extract(faceImage, faceMarkPoints);
- Debug.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures));
+ LogWithConsole.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures),
+ "MainViewModel");
return _faceRecognizer.IsSelf(faceFeatures, _localeFaceFeatures);
});
task.Start();
@@ -210,7 +211,7 @@
/// float[]
private float[] ExtractLocalePicture()
{
- var image = (Bitmap)Image.FromFile(@"D:\Android\IMG_20221008_155007.jpg");
+ var image = (Bitmap)Image.FromFile(@"D:\Code\IMG_20221008_155007.jpg");
var faceImage = SKBitmap.Decode(BitmapToBytes(image)).ToFaceImage();
var faceInfos = _faceDetector.Detect(faceImage);
var faceMarkPoints = new FaceLandmarker().Mark(faceImage, faceInfos[0]);
diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml
index 355e94d..04cd4c7 100644
--- a/SubCabinetSolution/Views/CabinetWindow.xaml
+++ b/SubCabinetSolution/Views/CabinetWindow.xaml
@@ -7,12 +7,14 @@
xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="White"
DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
+ WindowStyle="None"
mc:Ignorable="d">
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index 84127f5..da6bcae 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -186,7 +186,8 @@
{
var faceMarkPoints = _faceLandMarker.Mark(faceImage, faceInfos[0]);
var faceFeatures = _faceRecognizer.Extract(faceImage, faceMarkPoints);
- Debug.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures));
+ LogWithConsole.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures),
+ "MainViewModel");
return _faceRecognizer.IsSelf(faceFeatures, _localeFaceFeatures);
});
task.Start();
@@ -210,7 +211,7 @@
/// float[]
private float[] ExtractLocalePicture()
{
- var image = (Bitmap)Image.FromFile(@"D:\Android\IMG_20221008_155007.jpg");
+ var image = (Bitmap)Image.FromFile(@"D:\Code\IMG_20221008_155007.jpg");
var faceImage = SKBitmap.Decode(BitmapToBytes(image)).ToFaceImage();
var faceInfos = _faceDetector.Detect(faceImage);
var faceMarkPoints = new FaceLandmarker().Mark(faceImage, faceInfos[0]);
diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml
index 355e94d..04cd4c7 100644
--- a/SubCabinetSolution/Views/CabinetWindow.xaml
+++ b/SubCabinetSolution/Views/CabinetWindow.xaml
@@ -7,12 +7,14 @@
xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="White"
DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
+ WindowStyle="None"
mc:Ignorable="d">
diff --git a/SubCabinetSolution/Views/MainWindow.xaml b/SubCabinetSolution/Views/MainWindow.xaml
index 27487df..828920f 100644
--- a/SubCabinetSolution/Views/MainWindow.xaml
+++ b/SubCabinetSolution/Views/MainWindow.xaml
@@ -9,11 +9,11 @@
xmlns:utils="clr-namespace:SubCabinetSolution.Utils"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="{StaticResource MainThemeColor}"
DataContext="{Binding MainWindow, Source={StaticResource Locator}}"
- ResizeMode="CanResize"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
WindowStyle="None"
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index 84127f5..da6bcae 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -186,7 +186,8 @@
{
var faceMarkPoints = _faceLandMarker.Mark(faceImage, faceInfos[0]);
var faceFeatures = _faceRecognizer.Extract(faceImage, faceMarkPoints);
- Debug.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures));
+ LogWithConsole.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures),
+ "MainViewModel");
return _faceRecognizer.IsSelf(faceFeatures, _localeFaceFeatures);
});
task.Start();
@@ -210,7 +211,7 @@
/// float[]
private float[] ExtractLocalePicture()
{
- var image = (Bitmap)Image.FromFile(@"D:\Android\IMG_20221008_155007.jpg");
+ var image = (Bitmap)Image.FromFile(@"D:\Code\IMG_20221008_155007.jpg");
var faceImage = SKBitmap.Decode(BitmapToBytes(image)).ToFaceImage();
var faceInfos = _faceDetector.Detect(faceImage);
var faceMarkPoints = new FaceLandmarker().Mark(faceImage, faceInfos[0]);
diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml
index 355e94d..04cd4c7 100644
--- a/SubCabinetSolution/Views/CabinetWindow.xaml
+++ b/SubCabinetSolution/Views/CabinetWindow.xaml
@@ -7,12 +7,14 @@
xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="White"
DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
+ WindowStyle="None"
mc:Ignorable="d">
diff --git a/SubCabinetSolution/Views/MainWindow.xaml b/SubCabinetSolution/Views/MainWindow.xaml
index 27487df..828920f 100644
--- a/SubCabinetSolution/Views/MainWindow.xaml
+++ b/SubCabinetSolution/Views/MainWindow.xaml
@@ -9,11 +9,11 @@
xmlns:utils="clr-namespace:SubCabinetSolution.Utils"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="{StaticResource MainThemeColor}"
DataContext="{Binding MainWindow, Source={StaticResource Locator}}"
- ResizeMode="CanResize"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
WindowStyle="None"
diff --git a/SubCabinetSolution/obj/Debug/App.g.i.cs b/SubCabinetSolution/obj/Debug/App.g.i.cs
index a823026..f5828f9 100644
--- a/SubCabinetSolution/obj/Debug/App.g.i.cs
+++ b/SubCabinetSolution/obj/Debug/App.g.i.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9CAF2ABD13B8B6627FAA4F3FDED1269A61A8C2AF239E97C0D860E60A13D34D0F"
+#pragma checksum "..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DD8C1157D514C3C2B191C15A7B55AF884FA7C01A8668DA9730846AC86BC81BE7"
//------------------------------------------------------------------------------
//
// 此代码由工具生成。
@@ -67,7 +67,7 @@
_contentLoaded = true;
#line 10 "..\..\App.xaml"
- this.StartupUri = new System.Uri("/Views/CabinetWindow.xaml", System.UriKind.Relative);
+ this.StartupUri = new System.Uri("/Views/MainWindow.xaml", System.UriKind.Relative);
#line default
#line hidden
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index 07f4ce6..f63c326 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git a/SubCabinetSolution/App.config b/SubCabinetSolution/App.config
index e7f1514..71eb152 100644
--- a/SubCabinetSolution/App.config
+++ b/SubCabinetSolution/App.config
@@ -1,6 +1,140 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml
index 7b7917f..06c81d3 100644
--- a/SubCabinetSolution/App.xaml
+++ b/SubCabinetSolution/App.xaml
@@ -7,7 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:SubCabinetSolution.ViewModel"
d1P1:Ignorable="d"
- StartupUri="/Views/CabinetWindow.xaml">
+ StartupUri="/Views/MainWindow.xaml">
diff --git a/SubCabinetSolution/Properties/AssemblyInfo.cs b/SubCabinetSolution/Properties/AssemblyInfo.cs
index 90055fa..4a1e741 100644
--- a/SubCabinetSolution/Properties/AssemblyInfo.cs
+++ b/SubCabinetSolution/Properties/AssemblyInfo.cs
@@ -2,9 +2,9 @@
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
[assembly: AssemblyTitle("SubCabinetSolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -14,40 +14,41 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+//若要开始生成可本地化的应用程序,请在
+// 中的 .csproj 文件中
+//设置 CultureYouAreCodingWith。 例如,如果您在源文件中
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(在页面或应用程序资源词典中
+ // 未找到某个资源的情况下使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(在页面、应用程序或任何主题特定资源词典中
+ // 未找到某个资源的情况下使用)
)]
-// Version information for an assembly consists of the following four values:
+// 程序集的版本信息由下面四个值组成:
//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
+// 主版本
+// 次版本
+// 生成号
+// 修订号
//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 5b067cb..ff1ebe7 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -90,6 +90,9 @@
..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll
+
+ ..\packages\log4net.2.0.15\lib\net45\log4net.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
@@ -207,6 +210,8 @@
+
+
diff --git a/SubCabinetSolution/Utils/LogHelper.cs b/SubCabinetSolution/Utils/LogHelper.cs
new file mode 100644
index 0000000..8ba2495
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogHelper.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Diagnostics;
+using log4net;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogHelper
+ {
+ private static readonly ILog LogDebug = LogManager.GetLogger("logdebug");
+ private static readonly ILog LogInfo = LogManager.GetLogger("loginfo");
+ private static readonly ILog LogWarn = LogManager.GetLogger("logwarn");
+ private static readonly ILog LogError = LogManager.GetLogger("logerror");
+ private static readonly ILog LogFatal = LogManager.GetLogger("logfatal");
+
+ public static void Debug(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg);
+ }
+
+ public static void Debug(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogDebug.Debug(msg, e);
+ }
+
+
+ public static void Info(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg);
+ }
+
+ public static void Info(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogInfo.Info(msg, e);
+ }
+
+
+ public static void Warn(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg);
+ }
+
+ public static void Warn(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogWarn.Warn(msg, e);
+ }
+
+
+ public static void Error(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg);
+ }
+
+ public static void Error(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogError.Error(msg, e);
+ }
+
+
+ public static void Fatal(string msg)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg);
+ }
+
+ public static void Fatal(string msg, Exception e)
+ {
+ var sf = new StackFrame(1);
+ msg = $"{sf.GetMethod().ReflectedType?.FullName}.{sf.GetMethod().Name}:{msg}";
+ LogFatal.Fatal(msg, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Utils/LogWithConsole.cs b/SubCabinetSolution/Utils/LogWithConsole.cs
new file mode 100644
index 0000000..a22ba75
--- /dev/null
+++ b/SubCabinetSolution/Utils/LogWithConsole.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Diagnostics;
+
+namespace SubCabinetSolution.Utils
+{
+ public static class LogWithConsole
+ {
+ ///
+ /// Log本地化,并输出在Console,便于Debug
+ ///
+ /// log内容
+ /// 当前类名
+ public static void WriteLine(string log, string className)
+ {
+ LogHelper.Info(log);
+ Debug.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + $" {className} => " + log);
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index 84127f5..da6bcae 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -186,7 +186,8 @@
{
var faceMarkPoints = _faceLandMarker.Mark(faceImage, faceInfos[0]);
var faceFeatures = _faceRecognizer.Extract(faceImage, faceMarkPoints);
- Debug.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures));
+ LogWithConsole.WriteLine("相似度:" + _faceRecognizer.Compare(faceFeatures, _localeFaceFeatures),
+ "MainViewModel");
return _faceRecognizer.IsSelf(faceFeatures, _localeFaceFeatures);
});
task.Start();
@@ -210,7 +211,7 @@
/// float[]
private float[] ExtractLocalePicture()
{
- var image = (Bitmap)Image.FromFile(@"D:\Android\IMG_20221008_155007.jpg");
+ var image = (Bitmap)Image.FromFile(@"D:\Code\IMG_20221008_155007.jpg");
var faceImage = SKBitmap.Decode(BitmapToBytes(image)).ToFaceImage();
var faceInfos = _faceDetector.Detect(faceImage);
var faceMarkPoints = new FaceLandmarker().Mark(faceImage, faceInfos[0]);
diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml
index 355e94d..04cd4c7 100644
--- a/SubCabinetSolution/Views/CabinetWindow.xaml
+++ b/SubCabinetSolution/Views/CabinetWindow.xaml
@@ -7,12 +7,14 @@
xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="White"
DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
+ WindowStyle="None"
mc:Ignorable="d">
diff --git a/SubCabinetSolution/Views/MainWindow.xaml b/SubCabinetSolution/Views/MainWindow.xaml
index 27487df..828920f 100644
--- a/SubCabinetSolution/Views/MainWindow.xaml
+++ b/SubCabinetSolution/Views/MainWindow.xaml
@@ -9,11 +9,11 @@
xmlns:utils="clr-namespace:SubCabinetSolution.Utils"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="高值耗材柜(科室)"
- Width="1366"
- Height="768"
+ d:DesignHeight="768"
+ d:DesignWidth="1366"
Background="{StaticResource MainThemeColor}"
DataContext="{Binding MainWindow, Source={StaticResource Locator}}"
- ResizeMode="CanResize"
+ ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
WindowStyle="None"
diff --git a/SubCabinetSolution/obj/Debug/App.g.i.cs b/SubCabinetSolution/obj/Debug/App.g.i.cs
index a823026..f5828f9 100644
--- a/SubCabinetSolution/obj/Debug/App.g.i.cs
+++ b/SubCabinetSolution/obj/Debug/App.g.i.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9CAF2ABD13B8B6627FAA4F3FDED1269A61A8C2AF239E97C0D860E60A13D34D0F"
+#pragma checksum "..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DD8C1157D514C3C2B191C15A7B55AF884FA7C01A8668DA9730846AC86BC81BE7"
//------------------------------------------------------------------------------
//
// 此代码由工具生成。
@@ -67,7 +67,7 @@
_contentLoaded = true;
#line 10 "..\..\App.xaml"
- this.StartupUri = new System.Uri("/Views/CabinetWindow.xaml", System.UriKind.Relative);
+ this.StartupUri = new System.Uri("/Views/MainWindow.xaml", System.UriKind.Relative);
#line default
#line hidden
diff --git a/SubCabinetSolution/packages.config b/SubCabinetSolution/packages.config
index 13cd1f3..ee19784 100644
--- a/SubCabinetSolution/packages.config
+++ b/SubCabinetSolution/packages.config
@@ -1,57 +1,59 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file