xiongzhu %!s(int64=5) %!d(string=hai) anos
pai
achega
6cf7dd446e
Modificáronse 63 ficheiros con 734 adicións e 267 borrados
  1. BIN=BIN
      .vs/DeviceCenter/v16/.suo
  2. 1 7
      App.xaml
  3. 14 4
      DeviceCenter.csproj
  4. BIN=BIN
      assets/icon.ico
  5. BIN=BIN
      assets/loading.jpg
  6. BIN=BIN
      bin/x86/Debug/DeviceCenter.exe
  7. BIN=BIN
      bin/x86/Debug/DeviceCenter.pdb
  8. BIN=BIN
      bin/x86/Debug/Notifications.Wpf.dll
  9. BIN=BIN
      bin/x86/Debug/WPFNotification.dll
  10. 19 2
      bin/x86/Debug/config.json
  11. 9 1
      enums/DeviceEnums.cs
  12. 122 46
      model/AcsDevice.cs
  13. 16 7
      model/CarCamDevice.cs
  14. 23 0
      model/Config.cs
  15. 33 3
      model/Device.cs
  16. BIN=BIN
      obj/x86/Debug/App.baml
  17. 3 3
      obj/x86/Debug/App.g.cs
  18. 3 3
      obj/x86/Debug/App.g.i.cs
  19. BIN=BIN
      obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
  20. BIN=BIN
      obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  21. 1 1
      obj/x86/Debug/DeviceCenter.csproj.CoreCompileInputs.cache
  22. 10 1
      obj/x86/Debug/DeviceCenter.csproj.FileListAbsolute.txt
  23. BIN=BIN
      obj/x86/Debug/DeviceCenter.csproj.GenerateResource.cache
  24. BIN=BIN
      obj/x86/Debug/DeviceCenter.csprojAssemblyReference.cache
  25. BIN=BIN
      obj/x86/Debug/DeviceCenter.exe
  26. BIN=BIN
      obj/x86/Debug/DeviceCenter.g.resources
  27. BIN=BIN
      obj/x86/Debug/DeviceCenter.pdb
  28. 13 0
      obj/x86/Debug/DeviceCenter_Content.g.i.cs
  29. 6 6
      obj/x86/Debug/DeviceCenter_MarkupCompile.cache
  30. 4 4
      obj/x86/Debug/DeviceCenter_MarkupCompile.i.cache
  31. 3 5
      obj/x86/Debug/DeviceCenter_MarkupCompile.i.lref
  32. 5 4
      obj/x86/Debug/DeviceCenter_MarkupCompile.lref
  33. BIN=BIN
      obj/x86/Debug/views/AddDevice.baml
  34. 29 18
      obj/x86/Debug/views/AddDevice.g.cs
  35. 29 18
      obj/x86/Debug/views/AddDevice.g.i.cs
  36. BIN=BIN
      obj/x86/Debug/views/Login.baml
  37. 1 1
      obj/x86/Debug/views/Login.g.cs
  38. BIN=BIN
      obj/x86/Debug/views/MainWindow.baml
  39. 9 7
      obj/x86/Debug/views/MainWindow.g.cs
  40. 9 7
      obj/x86/Debug/views/MainWindow.g.i.cs
  41. BIN=BIN
      obj/x86/Debug/views/Splash.baml
  42. 89 0
      obj/x86/Debug/views/Splash.g.cs
  43. 89 0
      obj/x86/Debug/views/Splash.g.i.cs
  44. 1 1
      packages.config
  45. BIN=BIN
      packages/Notifications.Wpf.0.1.1/.signature.p7s
  46. BIN=BIN
      packages/Notifications.Wpf.0.1.1/Notifications.Wpf.0.1.1.nupkg
  47. BIN=BIN
      packages/Notifications.Wpf.0.1.1/lib/net40/Notifications.Wpf.dll
  48. BIN=BIN
      packages/Notifications.Wpf.0.1.1/lib/net45/Notifications.Wpf.dll
  49. BIN=BIN
      packages/Notifications.Wpf.0.1.1/lib/net461/Notifications.Wpf.dll
  50. BIN=BIN
      packages/WPFNotification.1.1.0/WPFNotification.1.1.0.nupkg
  51. 0 21
      packages/WPFNotification.1.1.0/content/App.xaml.install.xdt
  52. 0 11
      packages/WPFNotification.1.1.0/content/App.xaml.uninstall.xdt
  53. BIN=BIN
      packages/WPFNotification.1.1.0/lib/WPFNotification.dll
  54. 0 8
      packages/WPFNotification.1.1.0/tools/init.ps1
  55. 0 8
      packages/WPFNotification.1.1.0/tools/install.ps1
  56. 0 8
      packages/WPFNotification.1.1.0/tools/uninstall.ps1
  57. 0 29
      utils/NotificationUtil.cs
  58. 6 1
      views/AddDevice.xaml
  59. 48 12
      views/AddDevice.xaml.cs
  60. 8 0
      views/MainWindow.xaml
  61. 45 20
      views/MainWindow.xaml.cs
  62. 11 0
      views/Splash.xaml
  63. 75 0
      views/Splash.xaml.cs

BIN=BIN
.vs/DeviceCenter/v16/.suo


+ 1 - 7
App.xaml

@@ -1,6 +1,4 @@
-<Application x:Class="DeviceCenter.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"	xmlns:local="clr-namespace:DeviceCenter"
-             StartupUri="views/Login.xaml">
+<Application x:Class="DeviceCenter.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"	xmlns:local="clr-namespace:DeviceCenter"	StartupUri="views/Splash.xaml">
     <Application.Resources>
     
     <ResourceDictionary>
@@ -9,10 +7,6 @@
     <ResourceDictionary.MergedDictionaries>
     
     
-    
-    <ResourceDictionary Source="/WPFNotification;component/Assets/NotificationUI.xaml"/>
-    
-    
     </ResourceDictionary.MergedDictionaries>
     
     </ResourceDictionary>

+ 14 - 4
DeviceCenter.csproj

@@ -65,6 +65,9 @@
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
+    <Reference Include="Notifications.Wpf, Version=0.1.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>packages\Notifications.Wpf.0.1.1\lib\net461\Notifications.Wpf.dll</HintPath>
+    </Reference>
     <Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
       <HintPath>packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
     </Reference>
@@ -75,6 +78,7 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath>
     </Reference>
@@ -90,9 +94,6 @@
     <Reference Include="WindowsBase" />
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
-    <Reference Include="WPFNotification, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>packages\WPFNotification.1.1.0\lib\WPFNotification.dll</HintPath>
-    </Reference>
   </ItemGroup>
   <ItemGroup>
     <ApplicationDefinition Include="App.xaml">
@@ -115,11 +116,13 @@
     <Compile Include="utils\EnumerationExtension.cs" />
     <Compile Include="utils\EnumItemsSource.cs" />
     <Compile Include="utils\http.cs" />
-    <Compile Include="utils\NotificationUtil.cs" />
     <Compile Include="utils\PortUtil.cs" />
     <Compile Include="utils\ProcessUtil.cs" />
     <Compile Include="utils\TypeMap.cs" />
     <Compile Include="utils\VehicleUtil.cs" />
+    <Compile Include="views\Splash.xaml.cs">
+      <DependentUpon>Splash.xaml</DependentUpon>
+    </Compile>
     <Page Include="views\AddDevice.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -151,6 +154,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="views\Splash.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="libs\CarCamSDK.cs" />
@@ -186,6 +193,9 @@
   <ItemGroup>
     <Resource Include="assets\icon.ico" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="assets\loading.jpg" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
     <PostBuildEvent>xcopy /y /d  "$(ProjectDir)*.dll" "$(ProjectDir)$(OutDir)"

BIN=BIN
assets/icon.ico


BIN=BIN
assets/loading.jpg


BIN=BIN
bin/x86/Debug/DeviceCenter.exe


BIN=BIN
bin/x86/Debug/DeviceCenter.pdb


BIN=BIN
bin/x86/Debug/Notifications.Wpf.dll


BIN=BIN
bin/x86/Debug/WPFNotification.dll


+ 19 - 2
bin/x86/Debug/config.json

@@ -2,6 +2,23 @@
   "url": "http://localhost:8080",
   "username": "root",
   "password": "123456",
-  "token": null,
-  "devices": []
+  "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJyb290IiwiZXhwIjoxNTk4NTEyNjg3LCJpYXQiOjE1OTU5MjA2ODd9.afEmBklLU7nIDLDb2DrtAgqQGsqNtwb8dwExPzYYjVrUovx-3bs7vC3NeI9J2QJ5BDGZ-VCig9_gvainsDM3Wg",
+  "devices": [
+    {
+      "_userId": 0,
+      "userId": 0,
+      "areaId": null,
+      "buildingId": null,
+      "floorId": null,
+      "name": "门禁1",
+      "ip": "192.168.1.155",
+      "port": 8888,
+      "username": "",
+      "password": "",
+      "status": 0,
+      "type": 1,
+      "direction": 0,
+      "message": null
+    }
+  ]
 }

+ 9 - 1
enums/DeviceEnums.cs

@@ -18,7 +18,7 @@ namespace DeviceCenter
     public enum DeviceStatus
     {
         [Description("空闲")]
-        IDEL,
+        IDLE,
         [Description("连接中")]
         CONNECTING,
         [Description("已连接")]
@@ -26,4 +26,12 @@ namespace DeviceCenter
         [Description("失败")]
         FAIL
     }
+
+    public enum Direction
+    {
+        [Description("进")]
+        IN,
+        [Description("出")]
+        OUT
+    }
 }

+ 122 - 46
model/AcsDevice.cs

@@ -1,83 +1,159 @@
-using DeviceCenter;
-using log4net;
+using log4net;
 using System;
-using System.Collections.Generic;
 using System.IO;
-using System.Linq;
 using System.Runtime.InteropServices;
-using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
 namespace DeviceCenter
 {
-    class AcsDevice : Device
+    public class AcsDevice : Device
     {
         public static readonly ILog log = LogManager.GetLogger("DeviceCenter");
 
-        public int userId { get; set; }
+        public int _userId { get; set; }
         public AcsDevice()
         {
             type = DeviceType.ACS;
         }
 
-        public override void Init()
+        public int userId
         {
-            CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLoginInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO();
-            CHCNetSDK.NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = new CHCNetSDK.NET_DVR_DEVICEINFO_V40();
+            get
+            {
+                return _userId;
+            }
+        }
+
+        //public override void Init()
+        //{
+        //    CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLoginInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO();
+        //    CHCNetSDK.NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = new CHCNetSDK.NET_DVR_DEVICEINFO_V40();
+
+        //    struLoginInfo.bUseAsynLogin = false;
+        //    struLoginInfo.sDeviceAddress = ip;
+        //    struLoginInfo.sUserName = username;
+        //    struLoginInfo.sPassword = password;
+        //    struLoginInfo.wPort = (ushort)port;
+
+        //    struDeviceInfoV40.struDeviceV30.sSerialNumber = new byte[CHCNetSDK.SERIALNO_LEN];
 
-            struLoginInfo.bUseAsynLogin = false;
-            struLoginInfo.sDeviceAddress = ip;
-            struLoginInfo.sUserName = username;
-            struLoginInfo.sPassword = password;
-            struLoginInfo.wPort = (ushort)port;
+        //    int m_userId = CHCNetSDK.NET_DVR_Login_V40(ref struLoginInfo, ref struDeviceInfoV40);
+        //    if (m_userId < 0)
+        //    {
+        //        status = DeviceStatus.FAIL;
+        //        uint nErr = CHCNetSDK.NET_DVR_GetLastError();
+        //        if (nErr == CHCNetSDK.NET_DVR_PASSWORD_ERROR)
+        //        {
+        //            message = "user name or password error!";
+        //            if (1 == struDeviceInfoV40.bySupportLock)
+        //            {
+        //                string strTemp1 = string.Format(" Left {0} try opportunity", struDeviceInfoV40.byRetryLoginTime);
+        //                message += strTemp1;
+        //            }
+        //        }
+        //        else if (nErr == CHCNetSDK.NET_DVR_USER_LOCKED)
+        //        {
+        //            if (1 == struDeviceInfoV40.bySupportLock)
+        //            {
+        //                string strTemp1 = string.Format("user is locked, the remaining lock time is {0}", struDeviceInfoV40.dwSurplusLockTime);
+        //                message = strTemp1;
+        //            }
+        //        }
+        //        else
+        //        {
+        //            message = "net error or dvr is busy!";
+        //        }
+        //        return;
+        //    }
+        //    _userId = m_userId;
 
-            struDeviceInfoV40.struDeviceV30.sSerialNumber = new byte[CHCNetSDK.SERIALNO_LEN];
+        //    CHCNetSDK.NET_DVR_SETUPALARM_PARAM struSetupAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM();
+        //    struSetupAlarmParam.dwSize = (uint)Marshal.SizeOf(struSetupAlarmParam);
+        //    struSetupAlarmParam.byLevel = 1;
+        //    struSetupAlarmParam.byAlarmInfoType = 1;
+        //    struSetupAlarmParam.byDeployType = 1;
+        //    int handle = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(m_userId, ref struSetupAlarmParam);
+        //    if (-1 == handle)
+        //    {
+        //        message = "Setup alarm chan failed";
+        //        status = DeviceStatus.FAIL;
+        //    }
+        //    else
+        //    {
+        //        message = "";
+        //        status = DeviceStatus.CONNECTED;
+        //    }
+        //}
 
-            int m_userId = CHCNetSDK.NET_DVR_Login_V40(ref struLoginInfo, ref struDeviceInfoV40);
-            if (m_userId < 0)
+        public override async void Init()
+        {
+            await Task.Run(() =>
             {
-                uint nErr = CHCNetSDK.NET_DVR_GetLastError();
-                if (nErr == CHCNetSDK.NET_DVR_PASSWORD_ERROR)
+                status = DeviceStatus.CONNECTING;
+                CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLoginInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO();
+                CHCNetSDK.NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = new CHCNetSDK.NET_DVR_DEVICEINFO_V40();
+
+                struLoginInfo.bUseAsynLogin = false;
+                struLoginInfo.sDeviceAddress = ip;
+                struLoginInfo.sUserName = username;
+                struLoginInfo.sPassword = password;
+                struLoginInfo.wPort = (ushort)port;
+
+                struDeviceInfoV40.struDeviceV30.sSerialNumber = new byte[CHCNetSDK.SERIALNO_LEN];
+
+                int m_userId = CHCNetSDK.NET_DVR_Login_V40(ref struLoginInfo, ref struDeviceInfoV40);
+                if (m_userId < 0)
                 {
-                    MessageBox.Show("user name or password error!");
-                    if (1 == struDeviceInfoV40.bySupportLock)
+                    status = DeviceStatus.FAIL;
+                    uint nErr = CHCNetSDK.NET_DVR_GetLastError();
+                    if (nErr == CHCNetSDK.NET_DVR_PASSWORD_ERROR)
                     {
-                        string strTemp1 = string.Format("Left {0} try opportunity", struDeviceInfoV40.byRetryLoginTime);
-                        MessageBox.Show(strTemp1);
+                        message = "user name or password error!";
+                        if (1 == struDeviceInfoV40.bySupportLock)
+                        {
+                            string strTemp1 = string.Format(" Left {0} try opportunity", struDeviceInfoV40.byRetryLoginTime);
+                            message += strTemp1;
+                        }
                     }
-                }
-                else if (nErr == CHCNetSDK.NET_DVR_USER_LOCKED)
-                {
-                    if (1 == struDeviceInfoV40.bySupportLock)
+                    else if (nErr == CHCNetSDK.NET_DVR_USER_LOCKED)
+                    {
+                        if (1 == struDeviceInfoV40.bySupportLock)
+                        {
+                            string strTemp1 = string.Format("user is locked, the remaining lock time is {0}", struDeviceInfoV40.dwSurplusLockTime);
+                            message = strTemp1;
+                        }
+                    }
+                    else
                     {
-                        string strTemp1 = string.Format("user is locked, the remaining lock time is {0}", struDeviceInfoV40.dwSurplusLockTime);
-                        MessageBox.Show(strTemp1);
+                        message = "net error or dvr is busy!";
                     }
+                    return;
+                }
+                _userId = m_userId;
+
+                CHCNetSDK.NET_DVR_SETUPALARM_PARAM struSetupAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM();
+                struSetupAlarmParam.dwSize = (uint)Marshal.SizeOf(struSetupAlarmParam);
+                struSetupAlarmParam.byLevel = 1;
+                struSetupAlarmParam.byAlarmInfoType = 1;
+                struSetupAlarmParam.byDeployType = 1;
+                int handle = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(m_userId, ref struSetupAlarmParam);
+                if (-1 == handle)
+                {
+                    message = "Setup alarm chan failed";
+                    status = DeviceStatus.FAIL;
                 }
                 else
                 {
-                    MessageBox.Show("net error or dvr is busy!");
+                    message = "";
+                    status = DeviceStatus.CONNECTED;
                 }
-                return;
-            }
-            userId = m_userId;
-
-            CHCNetSDK.NET_DVR_SETUPALARM_PARAM struSetupAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM();
-            struSetupAlarmParam.dwSize = (uint)Marshal.SizeOf(struSetupAlarmParam);
-            struSetupAlarmParam.byLevel = 1;
-            struSetupAlarmParam.byAlarmInfoType = 1;
-            struSetupAlarmParam.byDeployType = 1;
-            int handle = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(m_userId, ref struSetupAlarmParam);
-            if (-1 == handle)
-            {
-                MessageBox.Show("Setup alarm chan failed");
-            }
+            });
         }
 
         public override void dispose()
         {
-            throw new NotImplementedException();
+            status = DeviceStatus.IDLE;
         }
 
         public void onAlarm(ref CHCNetSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser)

+ 16 - 7
model/CarCamDevice.cs

@@ -13,24 +13,33 @@ namespace DeviceCenter
     {
         public static readonly ILog log = LogManager.GetLogger("DeviceCenter");
 
-        public int userId { get; set; }
-       
-        public CarCamDevice() {
+        private int _userId;
+
+        public int userId
+        {
+            get
+            {
+                return _userId;
+            }
+        }
+
+        public CarCamDevice()
+        {
             this.type = DeviceType.CAR_CAM;
         }
 
         public override void Init()
         {
-            userId = CarCamSDK.Net_AddCamera(ip);
-            int iRet1 = CarCamSDK.Net_ConnCamera(userId, 30000, 10);
+            _userId = CarCamSDK.Net_AddCamera(ip);
+            int iRet1 = CarCamSDK.Net_ConnCamera(_userId, 30000, 10);
             if (iRet1 != 0)
             {
-                CarCamSDK.Net_DelCamera(userId);
+                CarCamSDK.Net_DelCamera(_userId);
                 MessageBox.Show("连接相机失败!", "提示");
             }
             else
             {
-                CarCamSDK.Net_RegOffLineClient(userId);
+                CarCamSDK.Net_RegOffLineClient(_userId);
             }
         }
 

+ 23 - 0
model/Config.cs

@@ -41,6 +41,29 @@ namespace DeviceCenter.model
                         if (File.Exists(path))
                         {
                             Config config = JsonConvert.DeserializeObject<Config>(File.ReadAllText(path));
+                            for (int i = 0; i < config.devices.Count; i++)
+                            {
+                                Device device = new Device();
+                                if (config.devices[i].type == DeviceType.ACS)
+                                {
+                                    device = new AcsDevice();
+                                }
+                                else if (config.devices[i].type == DeviceType.CAR_CAM)
+                                {
+                                    device = new CarCamDevice();
+                                }
+                                device.ip = config.devices[i].ip;
+                                device.port = config.devices[i].port;
+                                device.username = config.devices[i].username;
+                                device.password = config.devices[i].password;
+                                device.name = config.devices[i].name;
+                                device.status = DeviceStatus.IDLE;
+                                device.areaId = config.devices[i].areaId;
+                                device.buildingId = config.devices[i].buildingId;
+                                device.floorId = config.devices[i].floorId;
+                                config.devices[i] = device;
+
+                            }
                             _Instance = config;
                         }
                         else

+ 33 - 3
model/Device.cs

@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
 
 namespace DeviceCenter
 {
-    abstract class Device : INotifyPropertyChanged
+    public class Device : INotifyPropertyChanged
     {
         private string _name;
         private string _ip;
@@ -12,7 +12,13 @@ namespace DeviceCenter
         private string _password;
         private DeviceType _type;
         private DeviceStatus _status;
+        private Direction _direction;
+        public long? areaId { get; set; }
+        public long? buildingId { get; set; }
+        public long? floorId { get; set; }
+        private string _message;
 
+        public Device() { }
 
         public string name
         {
@@ -95,12 +101,36 @@ namespace DeviceCenter
                 OnPropertyChanged();
             }
         }
+        public Direction direction
+        {
+            get
+            {
+                return _direction;
+            }
+            set
+            {
+                _direction = value;
+                OnPropertyChanged();
+            }
+        }
+        public string message
+        {
+            get
+            {
+                return _message;
+            }
+            set
+            {
+                _message = value;
+                OnPropertyChanged();
+            }
+        }
 
         public event PropertyChangedEventHandler PropertyChanged;
 
-        abstract public void Init();
+        public virtual void Init() { }
 
-        abstract public void dispose();
+        public virtual void dispose() { }
 
         protected void OnPropertyChanged([CallerMemberName] string name = null)
         {

BIN=BIN
obj/x86/Debug/App.baml


+ 3 - 3
obj/x86/Debug/App.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7A22460192E4D8A2C3968E22A42714D8F0F81120799E6D46439F6498C1F79F25"
+#pragma checksum "..\..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "27BECF06FD9E46721F35DC8C7B7A019C2A1A5F6B84F320B644E6140EB3646EA2"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -53,8 +53,8 @@ namespace DeviceCenter {
             }
             _contentLoaded = true;
             
-            #line 3 "..\..\..\App.xaml"
-            this.StartupUri = new System.Uri("views/Login.xaml", System.UriKind.Relative);
+            #line 1 "..\..\..\App.xaml"
+            this.StartupUri = new System.Uri("views/Splash.xaml", System.UriKind.Relative);
             
             #line default
             #line hidden

+ 3 - 3
obj/x86/Debug/App.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "98DD44A5091098A0E407B3EA73C6797AAD1E84D33E91DFF7BA320D27BAAC3B95"
+#pragma checksum "..\..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "27BECF06FD9E46721F35DC8C7B7A019C2A1A5F6B84F320B644E6140EB3646EA2"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -53,8 +53,8 @@ namespace DeviceCenter {
             }
             _contentLoaded = true;
             
-            #line 3 "..\..\..\App.xaml"
-            this.StartupUri = new System.Uri("views/Login.xaml", System.UriKind.Relative);
+            #line 1 "..\..\..\App.xaml"
+            this.StartupUri = new System.Uri("views/Splash.xaml", System.UriKind.Relative);
             
             #line default
             #line hidden

BIN=BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache


BIN=BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
obj/x86/Debug/DeviceCenter.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-6c0ce1360fc2c98bf2b82890972a2c5fa6e73695
+188974e9a02df791ac81dda2ffab007fd553c315

+ 10 - 1
obj/x86/Debug/DeviceCenter.csproj.FileListAbsolute.txt

@@ -45,7 +45,6 @@ C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\views\Login.baml
 C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\views\MainWindow.baml
 C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\DeviceCenter.csproj.CopyComplete
 C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\CommonServiceLocator.dll
-C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\WPFNotification.dll
 C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\App.baml
 C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\System.Windows.Interactivity.dll
 C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\Newtonsoft.Json.dll
@@ -63,3 +62,13 @@ C:\Users\xiong\Projects\csharp\DeviceCenter\bin\x86\Debug\FontAwesome5.Net.dll
 C:\Users\xiong\Projects\csharp\DeviceCenter\bin\x86\Debug\FontAwesome5.xml
 C:\Users\xiong\Projects\csharp\DeviceCenter\bin\x86\Debug\FontAwesome5.Net.xml
 C:\Users\xiong\Projects\csharp\DeviceCenter\bin\x86\Debug\RSG.Promise.dll
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\FontAwesome5.dll
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\FontAwesome5.Net.dll
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\RestSharp.dll
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\RSG.Promise.dll
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\FontAwesome5.xml
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\FontAwesome5.Net.xml
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\RestSharp.xml
+C:\Users\xiong\Projects\win\DeviceCenter\bin\x86\Debug\Notifications.Wpf.dll
+C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\views\Splash.g.cs
+C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\views\Splash.baml

BIN=BIN
obj/x86/Debug/DeviceCenter.csproj.GenerateResource.cache


BIN=BIN
obj/x86/Debug/DeviceCenter.csprojAssemblyReference.cache


BIN=BIN
obj/x86/Debug/DeviceCenter.exe


BIN=BIN
obj/x86/Debug/DeviceCenter.g.resources


BIN=BIN
obj/x86/Debug/DeviceCenter.pdb


+ 13 - 0
obj/x86/Debug/DeviceCenter_Content.g.i.cs

@@ -0,0 +1,13 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("assets/loading.jpg")]
+
+

+ 6 - 6
obj/x86/Debug/DeviceCenter_MarkupCompile.cache

@@ -4,17 +4,17 @@
 winexe
 C#
 .cs
-C:\Users\xiong\Projects\csharp\DeviceCenter\obj\x86\Debug\
+C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\
 DeviceCenter
 none
 false
 DEBUG;TRACE
-C:\Users\xiong\Projects\csharp\DeviceCenter\App.xaml
-3-1289623115
+C:\Users\xiong\Projects\win\DeviceCenter\App.xaml
+41000995254
 
-351599969651
-24-1854166468
-views\AddDevice.xaml;views\Login.xaml;views\MainWindow.xaml;
+35-1837790505
+25365830917
+views\AddDevice.xaml;views\Login.xaml;views\MainWindow.xaml;views\Splash.xaml;
 
 False
 

+ 4 - 4
obj/x86/Debug/DeviceCenter_MarkupCompile.i.cache

@@ -10,11 +10,11 @@ none
 false
 DEBUG;TRACE
 C:\Users\xiong\Projects\win\DeviceCenter\App.xaml
-3-1289623115
+41000995254
 
-36-157835768
-24-2098230024
-views\AddDevice.xaml;views\Login.xaml;views\MainWindow.xaml;
+36699371372
+25365830917
+views\AddDevice.xaml;views\Login.xaml;views\MainWindow.xaml;views\Splash.xaml;
 
 True
 

+ 3 - 5
obj/x86/Debug/DeviceCenter_MarkupCompile.i.lref

@@ -1,6 +1,4 @@
-C:\Users\xiong\Projects\win\DeviceCenter\obj\x86\Debug\GeneratedInternalTypeHelper.g.i.cs
-FC:\Users\xiong\Projects\win\DeviceCenter\App.xaml;;
-FC:\Users\xiong\Projects\win\DeviceCenter\views\AddDevice.xaml;;
-FC:\Users\xiong\Projects\win\DeviceCenter\views\Login.xaml;;
-FC:\Users\xiong\Projects\win\DeviceCenter\views\MainWindow.xaml;;
+
+
+FC:\Users\xiong\Projects\win\DeviceCenter\views\Splash.xaml;;
 

+ 5 - 4
obj/x86/Debug/DeviceCenter_MarkupCompile.lref

@@ -1,6 +1,7 @@
 
-FC:\Users\xiong\Projects\csharp\DeviceCenter\App.xaml;;
-FC:\Users\xiong\Projects\csharp\DeviceCenter\views\AddDevice.xaml;;
-FC:\Users\xiong\Projects\csharp\DeviceCenter\views\Login.xaml;;
-FC:\Users\xiong\Projects\csharp\DeviceCenter\views\MainWindow.xaml;;
+FC:\Users\xiong\Projects\win\DeviceCenter\App.xaml;;
+FC:\Users\xiong\Projects\win\DeviceCenter\views\AddDevice.xaml;;
+FC:\Users\xiong\Projects\win\DeviceCenter\views\Login.xaml;;
+FC:\Users\xiong\Projects\win\DeviceCenter\views\MainWindow.xaml;;
+FC:\Users\xiong\Projects\win\DeviceCenter\views\Splash.xaml;;
 

BIN=BIN
obj/x86/Debug/views/AddDevice.baml


+ 29 - 18
obj/x86/Debug/views/AddDevice.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\..\views\AddDevice.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "264E1AD96AE3D4ECD7A053156934C1493B70A3D2691239624A95B5911EF83B64"
+#pragma checksum "..\..\..\..\views\AddDevice.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E3BE221B23BB9B59CCCE86C9CC625911AE9803A84C17AD943B73A4E7216DFC14"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -41,7 +41,7 @@ namespace DeviceCenter {
     public partial class AddDevice : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 21 "..\..\..\..\views\AddDevice.xaml"
+        #line 22 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_area;
         
@@ -49,7 +49,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 26 "..\..\..\..\views\AddDevice.xaml"
+        #line 27 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_building;
         
@@ -57,7 +57,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 31 "..\..\..\..\views\AddDevice.xaml"
+        #line 32 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_floor;
         
@@ -65,7 +65,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 36 "..\..\..\..\views\AddDevice.xaml"
+        #line 37 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_type;
         
@@ -73,7 +73,15 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 40 "..\..\..\..\views\AddDevice.xaml"
+        #line 41 "..\..\..\..\views\AddDevice.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.ComboBox cb_dir;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 45 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_name;
         
@@ -81,7 +89,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 44 "..\..\..\..\views\AddDevice.xaml"
+        #line 49 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_ip;
         
@@ -89,7 +97,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 48 "..\..\..\..\views\AddDevice.xaml"
+        #line 53 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_port;
         
@@ -97,7 +105,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 52 "..\..\..\..\views\AddDevice.xaml"
+        #line 57 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_username;
         
@@ -105,7 +113,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 56 "..\..\..\..\views\AddDevice.xaml"
+        #line 61 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_password;
         
@@ -152,7 +160,7 @@ namespace DeviceCenter {
             case 1:
             this.cb_area = ((System.Windows.Controls.ComboBox)(target));
             
-            #line 21 "..\..\..\..\views\AddDevice.xaml"
+            #line 22 "..\..\..\..\views\AddDevice.xaml"
             this.cb_area.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cb_area_SelectionChanged);
             
             #line default
@@ -161,7 +169,7 @@ namespace DeviceCenter {
             case 2:
             this.cb_building = ((System.Windows.Controls.ComboBox)(target));
             
-            #line 26 "..\..\..\..\views\AddDevice.xaml"
+            #line 27 "..\..\..\..\views\AddDevice.xaml"
             this.cb_building.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cb_building_SelectionChanged);
             
             #line default
@@ -174,23 +182,26 @@ namespace DeviceCenter {
             this.cb_type = ((System.Windows.Controls.ComboBox)(target));
             return;
             case 5:
-            this.tb_name = ((System.Windows.Controls.TextBox)(target));
+            this.cb_dir = ((System.Windows.Controls.ComboBox)(target));
             return;
             case 6:
-            this.tb_ip = ((System.Windows.Controls.TextBox)(target));
+            this.tb_name = ((System.Windows.Controls.TextBox)(target));
             return;
             case 7:
-            this.tb_port = ((System.Windows.Controls.TextBox)(target));
+            this.tb_ip = ((System.Windows.Controls.TextBox)(target));
             return;
             case 8:
-            this.tb_username = ((System.Windows.Controls.TextBox)(target));
+            this.tb_port = ((System.Windows.Controls.TextBox)(target));
             return;
             case 9:
-            this.tb_password = ((System.Windows.Controls.TextBox)(target));
+            this.tb_username = ((System.Windows.Controls.TextBox)(target));
             return;
             case 10:
+            this.tb_password = ((System.Windows.Controls.TextBox)(target));
+            return;
+            case 11:
             
-            #line 58 "..\..\..\..\views\AddDevice.xaml"
+            #line 63 "..\..\..\..\views\AddDevice.xaml"
             ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
             
             #line default

+ 29 - 18
obj/x86/Debug/views/AddDevice.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\..\views\AddDevice.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5336DBA50C132F8A01DB3F244FD61A6599E93E92DD8E355C7749328F3FED067B"
+#pragma checksum "..\..\..\..\views\AddDevice.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E3BE221B23BB9B59CCCE86C9CC625911AE9803A84C17AD943B73A4E7216DFC14"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -41,7 +41,7 @@ namespace DeviceCenter {
     public partial class AddDevice : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 21 "..\..\..\..\views\AddDevice.xaml"
+        #line 22 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_area;
         
@@ -49,7 +49,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 26 "..\..\..\..\views\AddDevice.xaml"
+        #line 27 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_building;
         
@@ -57,7 +57,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 31 "..\..\..\..\views\AddDevice.xaml"
+        #line 32 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_floor;
         
@@ -65,7 +65,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 36 "..\..\..\..\views\AddDevice.xaml"
+        #line 37 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ComboBox cb_type;
         
@@ -73,7 +73,15 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 40 "..\..\..\..\views\AddDevice.xaml"
+        #line 41 "..\..\..\..\views\AddDevice.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.ComboBox cb_dir;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 45 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_name;
         
@@ -81,7 +89,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 44 "..\..\..\..\views\AddDevice.xaml"
+        #line 49 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_ip;
         
@@ -89,7 +97,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 48 "..\..\..\..\views\AddDevice.xaml"
+        #line 53 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_port;
         
@@ -97,7 +105,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 52 "..\..\..\..\views\AddDevice.xaml"
+        #line 57 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_username;
         
@@ -105,7 +113,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 56 "..\..\..\..\views\AddDevice.xaml"
+        #line 61 "..\..\..\..\views\AddDevice.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.TextBox tb_password;
         
@@ -152,7 +160,7 @@ namespace DeviceCenter {
             case 1:
             this.cb_area = ((System.Windows.Controls.ComboBox)(target));
             
-            #line 21 "..\..\..\..\views\AddDevice.xaml"
+            #line 22 "..\..\..\..\views\AddDevice.xaml"
             this.cb_area.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cb_area_SelectionChanged);
             
             #line default
@@ -161,7 +169,7 @@ namespace DeviceCenter {
             case 2:
             this.cb_building = ((System.Windows.Controls.ComboBox)(target));
             
-            #line 26 "..\..\..\..\views\AddDevice.xaml"
+            #line 27 "..\..\..\..\views\AddDevice.xaml"
             this.cb_building.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cb_building_SelectionChanged);
             
             #line default
@@ -174,23 +182,26 @@ namespace DeviceCenter {
             this.cb_type = ((System.Windows.Controls.ComboBox)(target));
             return;
             case 5:
-            this.tb_name = ((System.Windows.Controls.TextBox)(target));
+            this.cb_dir = ((System.Windows.Controls.ComboBox)(target));
             return;
             case 6:
-            this.tb_ip = ((System.Windows.Controls.TextBox)(target));
+            this.tb_name = ((System.Windows.Controls.TextBox)(target));
             return;
             case 7:
-            this.tb_port = ((System.Windows.Controls.TextBox)(target));
+            this.tb_ip = ((System.Windows.Controls.TextBox)(target));
             return;
             case 8:
-            this.tb_username = ((System.Windows.Controls.TextBox)(target));
+            this.tb_port = ((System.Windows.Controls.TextBox)(target));
             return;
             case 9:
-            this.tb_password = ((System.Windows.Controls.TextBox)(target));
+            this.tb_username = ((System.Windows.Controls.TextBox)(target));
             return;
             case 10:
+            this.tb_password = ((System.Windows.Controls.TextBox)(target));
+            return;
+            case 11:
             
-            #line 58 "..\..\..\..\views\AddDevice.xaml"
+            #line 63 "..\..\..\..\views\AddDevice.xaml"
             ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
             
             #line default

BIN=BIN
obj/x86/Debug/views/Login.baml


+ 1 - 1
obj/x86/Debug/views/Login.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\..\views\Login.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "04806D8F258CC6748B9040BD942C4E24C3D1F69FDEAD14475F0EE67BE2F43E4E"
+#pragma checksum "..\..\..\..\views\Login.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "F84C04C60D84E086CF28911010366BF5C0B419955D02C609BFD012F8F899D92E"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。

BIN=BIN
obj/x86/Debug/views/MainWindow.baml


+ 9 - 7
obj/x86/Debug/views/MainWindow.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\..\views\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9F754B03B98E9BC952FEC19B04F6935FD7DC6438148C3074B13A3BA2F68ECC2B"
+#pragma checksum "..\..\..\..\views\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "C73ED64BCD4C10425419C6736E26280FC90C51156EDCDB4309B3237FEE6B971D"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -10,6 +10,8 @@
 //------------------------------------------------------------------------------
 
 using DeviceCenter;
+using FontAwesome5;
+using FontAwesome5.Converters;
 using System;
 using System.Diagnostics;
 using System.Windows;
@@ -41,7 +43,7 @@ namespace DeviceCenter {
     public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 16 "..\..\..\..\views\MainWindow.xaml"
+        #line 22 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button btn_add_device;
         
@@ -49,7 +51,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 17 "..\..\..\..\views\MainWindow.xaml"
+        #line 23 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button btn_del_device;
         
@@ -57,7 +59,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 22 "..\..\..\..\views\MainWindow.xaml"
+        #line 28 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ListView lv_device;
         
@@ -103,7 +105,7 @@ namespace DeviceCenter {
             {
             case 1:
             
-            #line 8 "..\..\..\..\views\MainWindow.xaml"
+            #line 9 "..\..\..\..\views\MainWindow.xaml"
             ((DeviceCenter.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);
             
             #line default
@@ -112,7 +114,7 @@ namespace DeviceCenter {
             case 2:
             this.btn_add_device = ((System.Windows.Controls.Button)(target));
             
-            #line 16 "..\..\..\..\views\MainWindow.xaml"
+            #line 22 "..\..\..\..\views\MainWindow.xaml"
             this.btn_add_device.Click += new System.Windows.RoutedEventHandler(this.btn_add_device_Click);
             
             #line default
@@ -121,7 +123,7 @@ namespace DeviceCenter {
             case 3:
             this.btn_del_device = ((System.Windows.Controls.Button)(target));
             
-            #line 17 "..\..\..\..\views\MainWindow.xaml"
+            #line 23 "..\..\..\..\views\MainWindow.xaml"
             this.btn_del_device.Click += new System.Windows.RoutedEventHandler(this.btn_del_device_Click);
             
             #line default

+ 9 - 7
obj/x86/Debug/views/MainWindow.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\..\..\views\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1FA3B79A02583320BB87766B115C4BBF3EA1A6965217BC7448458D80BCC7C529"
+#pragma checksum "..\..\..\..\views\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "C73ED64BCD4C10425419C6736E26280FC90C51156EDCDB4309B3237FEE6B971D"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
@@ -10,6 +10,8 @@
 //------------------------------------------------------------------------------
 
 using DeviceCenter;
+using FontAwesome5;
+using FontAwesome5.Converters;
 using System;
 using System.Diagnostics;
 using System.Windows;
@@ -41,7 +43,7 @@ namespace DeviceCenter {
     public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 16 "..\..\..\..\views\MainWindow.xaml"
+        #line 22 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button btn_add_device;
         
@@ -49,7 +51,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 17 "..\..\..\..\views\MainWindow.xaml"
+        #line 23 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button btn_del_device;
         
@@ -57,7 +59,7 @@ namespace DeviceCenter {
         #line hidden
         
         
-        #line 22 "..\..\..\..\views\MainWindow.xaml"
+        #line 28 "..\..\..\..\views\MainWindow.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.ListView lv_device;
         
@@ -103,7 +105,7 @@ namespace DeviceCenter {
             {
             case 1:
             
-            #line 8 "..\..\..\..\views\MainWindow.xaml"
+            #line 9 "..\..\..\..\views\MainWindow.xaml"
             ((DeviceCenter.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);
             
             #line default
@@ -112,7 +114,7 @@ namespace DeviceCenter {
             case 2:
             this.btn_add_device = ((System.Windows.Controls.Button)(target));
             
-            #line 16 "..\..\..\..\views\MainWindow.xaml"
+            #line 22 "..\..\..\..\views\MainWindow.xaml"
             this.btn_add_device.Click += new System.Windows.RoutedEventHandler(this.btn_add_device_Click);
             
             #line default
@@ -121,7 +123,7 @@ namespace DeviceCenter {
             case 3:
             this.btn_del_device = ((System.Windows.Controls.Button)(target));
             
-            #line 17 "..\..\..\..\views\MainWindow.xaml"
+            #line 23 "..\..\..\..\views\MainWindow.xaml"
             this.btn_del_device.Click += new System.Windows.RoutedEventHandler(this.btn_del_device_Click);
             
             #line default

BIN=BIN
obj/x86/Debug/views/Splash.baml


+ 89 - 0
obj/x86/Debug/views/Splash.g.cs

@@ -0,0 +1,89 @@
+#pragma checksum "..\..\..\..\views\Splash.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "26ACE9A3890BA67B4AD288678450339310596D648DB5EED173C5D79C19A82CAB"
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+using DeviceCenter;
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Automation;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Media.Effects;
+using System.Windows.Media.Imaging;
+using System.Windows.Media.Media3D;
+using System.Windows.Media.TextFormatting;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Shell;
+
+
+namespace DeviceCenter {
+    
+    
+    /// <summary>
+    /// Splash
+    /// </summary>
+    public partial class Splash : System.Windows.Window, System.Windows.Markup.IComponentConnector {
+        
+        
+        #line 9 "..\..\..\..\views\Splash.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Image image;
+        
+        #line default
+        #line hidden
+        
+        private bool _contentLoaded;
+        
+        /// <summary>
+        /// InitializeComponent
+        /// </summary>
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        public void InitializeComponent() {
+            if (_contentLoaded) {
+                return;
+            }
+            _contentLoaded = true;
+            System.Uri resourceLocater = new System.Uri("/DeviceCenter;component/views/splash.xaml", System.UriKind.Relative);
+            
+            #line 1 "..\..\..\..\views\Splash.xaml"
+            System.Windows.Application.LoadComponent(this, resourceLocater);
+            
+            #line default
+            #line hidden
+        }
+        
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
+        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 1:
+            this.image = ((System.Windows.Controls.Image)(target));
+            return;
+            }
+            this._contentLoaded = true;
+        }
+    }
+}
+

+ 89 - 0
obj/x86/Debug/views/Splash.g.i.cs

@@ -0,0 +1,89 @@
+#pragma checksum "..\..\..\..\views\Splash.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "26ACE9A3890BA67B4AD288678450339310596D648DB5EED173C5D79C19A82CAB"
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+using DeviceCenter;
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Automation;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Media.Effects;
+using System.Windows.Media.Imaging;
+using System.Windows.Media.Media3D;
+using System.Windows.Media.TextFormatting;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Shell;
+
+
+namespace DeviceCenter {
+    
+    
+    /// <summary>
+    /// Splash
+    /// </summary>
+    public partial class Splash : System.Windows.Window, System.Windows.Markup.IComponentConnector {
+        
+        
+        #line 9 "..\..\..\..\views\Splash.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Image image;
+        
+        #line default
+        #line hidden
+        
+        private bool _contentLoaded;
+        
+        /// <summary>
+        /// InitializeComponent
+        /// </summary>
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        public void InitializeComponent() {
+            if (_contentLoaded) {
+                return;
+            }
+            _contentLoaded = true;
+            System.Uri resourceLocater = new System.Uri("/DeviceCenter;component/views/splash.xaml", System.UriKind.Relative);
+            
+            #line 1 "..\..\..\..\views\Splash.xaml"
+            System.Windows.Application.LoadComponent(this, resourceLocater);
+            
+            #line default
+            #line hidden
+        }
+        
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
+        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
+            switch (connectionId)
+            {
+            case 1:
+            this.image = ((System.Windows.Controls.Image)(target));
+            return;
+            }
+            this._contentLoaded = true;
+        }
+    }
+}
+

+ 1 - 1
packages.config

@@ -5,7 +5,7 @@
   <package id="FontAwesome5" version="2.0.8" targetFramework="net472" />
   <package id="log4net" version="2.0.8" targetFramework="net472" />
   <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
+  <package id="Notifications.Wpf" version="0.1.1" targetFramework="net472" />
   <package id="RestSharp" version="106.11.4" targetFramework="net472" />
   <package id="RSG.Promise" version="3.0.1" targetFramework="net472" />
-  <package id="WPFNotification" version="1.1.0" targetFramework="net472" />
 </packages>

BIN=BIN
packages/WPFNotification.1.1.0/.signature.p7s → packages/Notifications.Wpf.0.1.1/.signature.p7s


BIN=BIN
packages/Notifications.Wpf.0.1.1/Notifications.Wpf.0.1.1.nupkg


BIN=BIN
packages/Notifications.Wpf.0.1.1/lib/net40/Notifications.Wpf.dll


BIN=BIN
packages/Notifications.Wpf.0.1.1/lib/net45/Notifications.Wpf.dll


BIN=BIN
packages/Notifications.Wpf.0.1.1/lib/net461/Notifications.Wpf.dll


BIN=BIN
packages/WPFNotification.1.1.0/WPFNotification.1.1.0.nupkg


+ 0 - 21
packages/WPFNotification.1.1.0/content/App.xaml.install.xdt

@@ -1,21 +0,0 @@
-<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-  <Application.Resources xdt:Transform="InsertIfMissing" />
-  <Application.Resources>
-    <ResourceDictionary  xdt:Transform="InsertIfMissing"/>
-    <ResourceDictionary xdt:Transform="InsertBefore(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[1])" />
-    <ResourceDictionary xdt:Locator="XPath(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[local-name()='ResourceDictionary'][last()])">
-      <ResourceDictionary.MergedDictionaries xdt:Transform="InsertIfMissing"/>
-      <ResourceDictionary.MergedDictionaries xdt:Transform="InsertBefore(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[local-name()='ResourceDictionary']/*[1])"/>
-    </ResourceDictionary >
-    <ResourceDictionary.MergedDictionaries xdt:Locator="XPath(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[local-name()='ResourceDictionary'][last()]/*[local-name()='ResourceDictionary.MergedDictionaries'][last()])">
-      <ResourceDictionary  Source="/WPFNotification;component/Assets/NotificationUI.xaml" xdt:Transform="Insert" />
-    </ResourceDictionary.MergedDictionaries >
-
-    <ResourceDictionary xdt:Transform="Remove" xdt:Locator="XPath(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[local-name()='ResourceDictionary'][1])" />
-
-    <ResourceDictionary.MergedDictionaries xdt:Transform="Remove" xdt:Locator="XPath(/*[local-name()='Application']/*[local-name()='Application.Resources']/*[local-name()='ResourceDictionary' and last()]/*[local-name()='ResourceDictionary.MergedDictionaries'][1])" />
-
-  </Application.Resources>
-</Application>

+ 0 - 11
packages/WPFNotification.1.1.0/content/App.xaml.uninstall.xdt

@@ -1,11 +0,0 @@
-<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
-  <Application.Resources>
-    <ResourceDictionary>
-      <ResourceDictionary.MergedDictionaries >
-        <ResourceDictionary Source="/WPFNotification;component/Assets/NotificationUI.xaml" xdt:Transform="Remove" xdt:Locator="Match(Source)" />
-      </ResourceDictionary.MergedDictionaries>
-    </ResourceDictionary>
-  </Application.Resources>
-</Application>

BIN=BIN
packages/WPFNotification.1.1.0/lib/WPFNotification.dll


+ 0 - 8
packages/WPFNotification.1.1.0/tools/init.ps1

@@ -1,8 +0,0 @@
-# Runs the first time a package is installed in a solution, and every time the solution is opened.
-
-param($installPath, $toolsPath, $package, $project)
-
-# $installPath is the path to the folder where the package is installed.
-# $toolsPath is the path to the tools directory in the folder where the package is installed.
-# $package is a reference to the package object.
-# $project is null in init.ps1

+ 0 - 8
packages/WPFNotification.1.1.0/tools/install.ps1

@@ -1,8 +0,0 @@
-# Runs every time a package is installed in a project
-
-param($installPath, $toolsPath, $package, $project)
-
-# $installPath is the path to the folder where the package is installed.
-# $toolsPath is the path to the tools directory in the folder where the package is installed.
-# $package is a reference to the package object.
-# $project is a reference to the project the package was installed to.

+ 0 - 8
packages/WPFNotification.1.1.0/tools/uninstall.ps1

@@ -1,8 +0,0 @@
-# Runs every time a package is uninstalled
-
-param($installPath, $toolsPath, $package, $project)
-
-# $installPath is the path to the folder where the package is installed.
-# $toolsPath is the path to the tools directory in the folder where the package is installed.
-# $package is a reference to the package object.
-# $project is a reference to the project the package was installed to.

+ 0 - 29
utils/NotificationUtil.cs

@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using WPFNotification.Core.Configuration;
-using WPFNotification.Model;
-using WPFNotification.Services;
-
-namespace DeviceCenter.utils
-{
-    class NotificationUtil
-    {
-        private static readonly INotificationDialogService notificationService = new NotificationDialogService();
-
-        public static void show(string title, string message)
-        {
-            var notificationConfiguration = NotificationConfiguration.DefaultConfiguration;
-            notificationConfiguration.NotificationFlowDirection = NotificationFlowDirection.RightBottom;
-            var newNotification = new Notification()
-            {
-                Title = title,
-                Message = message
-                // ,ImgURL = "pack://application:,,,a/Resources/Images/warning.png"
-            };
-            notificationService.ShowNotificationWindow(newNotification, notificationConfiguration);
-        }
-    }
-}

+ 6 - 1
views/AddDevice.xaml

@@ -6,7 +6,7 @@
         xmlns:sys="clr-namespace:System;assembly=mscorlib"
         xmlns:local="clr-namespace:DeviceCenter"
         mc:Ignorable="d"
-        Title="添加设备" Height="400" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
+        Title="添加设备" Height="440" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
     <Window.Resources>
         <ObjectDataProvider x:Key="NameWeek" MethodName="GetNames" ObjectType="{x:Type sys:Enum}">
             <ObjectDataProvider.MethodParameters>
@@ -14,6 +14,7 @@
             </ObjectDataProvider.MethodParameters>
         </ObjectDataProvider>
         <local:EnumItemsSource x:Key="DeviceTypeItemsSource" Type="{x:Type local:DeviceType}"/>
+        <local:EnumItemsSource x:Key="DirectionItemsSource" Type="{x:Type local:Direction}"/>
     </Window.Resources>
     <StackPanel Orientation="Vertical">
         <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
@@ -35,6 +36,10 @@
             <Label Content="设备类型" Width="80" HorizontalContentAlignment="Right" Margin="0 0 10 0"/>
             <ComboBox x:Name="cb_type" Width="150" ItemsSource="{Binding Source={StaticResource DeviceTypeItemsSource}}"  DisplayMemberPath="Key" SelectedValuePath="Value"/>
         </StackPanel>
+        <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
+            <Label Content="方向" Width="80" HorizontalContentAlignment="Right" Margin="0 0 10 0"/>
+            <ComboBox x:Name="cb_dir" Width="150" ItemsSource="{Binding Source={StaticResource DirectionItemsSource}}"  DisplayMemberPath="Key" SelectedValuePath="Value"/>
+        </StackPanel>
         <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
             <Label Content="设备名称" Width="80" HorizontalContentAlignment="Right" Margin="0 0 10 0"/>
             <TextBox Name="tb_name" Width="150" VerticalContentAlignment="Center"></TextBox>

+ 48 - 12
views/AddDevice.xaml.cs

@@ -1,21 +1,11 @@
 using DeviceCenter.model;
 using DeviceCenter.utils;
-using RestSharp;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 
 namespace DeviceCenter
 {
@@ -30,6 +20,9 @@ namespace DeviceCenter
         private ObservableCollection<Building> buildings = new ObservableCollection<Building>();
         private ObservableCollection<Floor> floors = new ObservableCollection<Floor>();
 
+        public Device device { get; set; }
+
+
         public AddDevice()
         {
             InitializeComponent();
@@ -46,11 +39,54 @@ namespace DeviceCenter
 
         private void Button_Click(object sender, RoutedEventArgs e)
         {
-            if (cb_type.SelectedValue != null)
+            if (string.IsNullOrWhiteSpace(tb_name.Text))
+            {
+                MessageBox.Show("请输入名称");
+                return;
+            }
+            if (string.IsNullOrWhiteSpace(tb_ip.Text))
+            {
+                MessageBox.Show("请输入ip");
+                return;
+            }
+            if (cb_type.SelectedValue == null)
+            {
+                MessageBox.Show("请选择设备类型");
+                return;
+            }
+            if ((DeviceType)cb_type.SelectedValue == DeviceType.ACS && string.IsNullOrWhiteSpace(tb_port.Text))
+            {
+                MessageBox.Show("请输入端口");
+                return;
+            }
+
+            Device device;
+            if ((DeviceType)cb_type.SelectedValue == DeviceType.ACS)
+            {
+                device = new AcsDevice();
+            }
+            else
+            {
+                device = new CarCamDevice();
+            }
+            device.ip = tb_ip.Text;
+            if (!string.IsNullOrEmpty(tb_port.Text))
+            {
+                device.port = int.Parse(tb_port.Text);
+            }
+            device.name = tb_name.Text;
+            device.username = tb_username.Text;
+            device.password = tb_password.Text;
+            device.status = DeviceStatus.IDLE;
+            device.areaId = (long?)cb_area.SelectedValue;
+            device.buildingId = (long?)cb_building.SelectedValue;
+            device.floorId = (long?)cb_floor.SelectedValue;
+            if (cb_dir.SelectedValue != null)
             {
-                Console.WriteLine(cb_type.SelectedValue);
+                device.direction = (Direction)cb_dir.SelectedValue;
             }
             this.DialogResult = true;
+            this.device = device;
             Close();
         }
 

+ 8 - 0
views/MainWindow.xaml

@@ -5,11 +5,17 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:DeviceCenter"
         mc:Ignorable="d"
+        xmlns:fa5="http://schemas.fontawesome.com/icons/"
         Title="设备中心" Height="450" Width="800" ResizeMode="NoResize" Closing="Window_Closing" WindowStartupLocation="CenterScreen">
     <Window.Resources>
         <local:EnumItemsSource x:Key="deviceTypeConverter" Type="{x:Type local:DeviceType}"/>
+        <local:EnumItemsSource x:Key="directionConverter" Type="{x:Type local:Direction}"/>
         <local:EnumItemsSource x:Key="deviceStatusConverter" Type="{x:Type local:DeviceStatus}"/>
         <local:DeviceStatusColorConverter x:Key="deviceStatusColorConverter"/>
+        <Style x:Key="iconStyle" TargetType="fa5:SvgAwesome">
+            <Setter Property="Foreground" Value="#409EFF" />
+            <Setter Property="Width" Value="10"></Setter>
+        </Style>
     </Window.Resources>
     <DockPanel VerticalAlignment="Stretch" Height="Auto">
         <StackPanel DockPanel.Dock="Bottom" Height="Auto" Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
@@ -35,6 +41,8 @@
                             </DataTemplate>
                         </GridViewColumn.CellTemplate>
                     </GridViewColumn>
+                    <GridViewColumn Header="方向" Width="40" DisplayMemberBinding="{Binding direction, Converter = {StaticResource directionConverter}}" />
+                    <GridViewColumn Header="消息" Width="180" DisplayMemberBinding="{Binding message}" />
                 </GridView>
             </ListView.View>
         </ListView>

+ 45 - 20
views/MainWindow.xaml.cs

@@ -1,6 +1,7 @@
 using DeviceCenter.model;
 using DeviceCenter.utils;
 using log4net;
+using Notifications.Wpf;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
@@ -18,6 +19,7 @@ namespace DeviceCenter
     public partial class MainWindow : Window
     {
         public static readonly ILog log = LogManager.GetLogger("DeviceCenter");
+        private NotificationManager notificationManager = new NotificationManager();
 
         private ObservableCollection<Device> devices = new ObservableCollection<Device>();
         private Config config = Config.getInstance();
@@ -31,42 +33,56 @@ namespace DeviceCenter
 
             initSdk();
 
-            devices.Add(new CarCamDevice() { name = "Device 1", ip = "192.168.1.10", status = DeviceStatus.CONNECTING });
-            devices.Add(new AcsDevice() { name = "Device 2", ip = "192.168.1.11", status = DeviceStatus.FAIL });
-            devices.Add(new AcsDevice() { name = "Device 3", ip = "192.168.1.12", status = DeviceStatus.CONNECTED });
-
             lv_device.ItemsSource = devices;
-            Thread t = new Thread(() =>
-            {
-                Thread.Sleep(2000);
-                devices[0].status = DeviceStatus.CONNECTED;
-            });
-            t.Start();
         }
 
         private async void initSdk()
         {
-            await Task.Run(() => {
-                CarCamSDK.Net_Init();
+            await Task.Run(() =>
+            {
+                long ts = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds();
                 carPlateCallback = new CarCamSDK.FGetImageCB2(onGetCarPlate);
                 CarCamSDK.Net_RegImageRecv2(carPlateCallback);
 
                 //UsbSwitch.usb_relay_init();
 
-                if (!CHCNetSDK.NET_DVR_Init())
-                {
-                    MessageBox.Show("门禁SDK初始化失败");
-                }
-
                 alarmCallback = new CHCNetSDK.MSGCallBack(onAlarm);
                 if (CHCNetSDK.NET_DVR_SetDVRMessageCallBack_V50(0, alarmCallback, IntPtr.Zero))
                 {
                     log.Info("NET_DVR_SetDVRMessageCallBack_V50 Succeed");
+                    notificationManager.Show(new NotificationContent
+                    {
+                        Title = "Success",
+                        Message = "NET_DVR_SetDVRMessageCallBack_V50 Succeed",
+                        Type = NotificationType.Success
+                    });
                 }
                 else
                 {
-                    MessageBox.Show("NET_DVR_SetDVRMessageCallBack_V50 Fail");
+                    notificationManager.Show(new NotificationContent
+                    {
+                        Title = "Error",
+                        Message = "NET_DVR_SetDVRMessageCallBack_V50 Fail",
+                        Type = NotificationType.Error
+                    });
                 }
+
+                notificationManager.Show(new NotificationContent
+                {
+                    Title = "Info",
+                    Message = "init finish, toke " + (new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() - ts) + "ms",
+                    Type = NotificationType.Information
+                });
+
+                Application.Current.Dispatcher.Invoke((Action)(() =>
+                {
+                    config.devices.ForEach(i =>
+                    {
+                        i.Init();
+                        devices.Add(i);
+                    });
+                }));
+
             });
         }
 
@@ -80,7 +96,8 @@ namespace DeviceCenter
             AddDevice addDevice = new AddDevice();
             if (addDevice.ShowDialog() ?? false)
             {
-
+                config.devices.Add(addDevice.device);
+                devices.Add(addDevice.device);
             }
         }
 
@@ -93,9 +110,17 @@ namespace DeviceCenter
             }
             Console.WriteLine(lv_device.SelectedItem);
             MessageBoxResult messageBoxResult = MessageBox.Show("确认删除?", "提示", MessageBoxButton.YesNo);
+
             if (messageBoxResult == MessageBoxResult.Yes)
             {
-                devices.RemoveAt(lv_device.SelectedIndex);
+                int i = lv_device.SelectedIndex;
+                if (devices[i].status != DeviceStatus.IDLE)
+                {
+                    devices[i].dispose();
+                }
+                devices.RemoveAt(i);
+                config.devices.RemoveAt(i);
+                config.save();
                 // lv_device.Items.Refresh();
             }
         }

+ 11 - 0
views/Splash.xaml

@@ -0,0 +1,11 @@
+<Window x:Class="DeviceCenter.Splash"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:DeviceCenter"
+        mc:Ignorable="d" WindowStyle="None"
+        Title="Splash" Height="Auto" Width="Auto" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen">
+    <Image x:Name="image" Width="256" Height="Auto" Source="/DeviceCenter;component/assets/loading.jpg"/>
+
+</Window>

+ 75 - 0
views/Splash.xaml.cs

@@ -0,0 +1,75 @@
+using Notifications.Wpf;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace DeviceCenter
+{
+    /// <summary>
+    /// Splash.xaml 的交互逻辑
+    /// </summary>
+    public partial class Splash : Window
+    {
+        private NotificationManager notificationManager = new NotificationManager();
+
+        public Splash()
+        {
+            InitializeComponent();
+            //CarCamSDK.Net_Init();
+            //Login login = new Login();
+            //login.Show();
+            //Close();
+            init();
+        }
+
+        private async void init()
+        {
+            await Task.Run(() =>
+            {
+                int code = CarCamSDK.Net_Init();
+                notificationManager.Show(new NotificationContent
+                {
+                    Title = "Info",
+                    Message = "CarCamSDK Net_Init " + code,
+                    Type = NotificationType.Information
+                });
+
+                if (!CHCNetSDK.NET_DVR_Init())
+                {
+                    notificationManager.Show(new NotificationContent
+                    {
+                        Title = "Error",
+                        Message = "NET_DVR_Init Error",
+                        Type = NotificationType.Error
+                    });
+                }
+                else
+                {
+                    notificationManager.Show(new NotificationContent
+                    {
+                        Title = "Success",
+                        Message = "NET_DVR_Init Succss",
+                        Type = NotificationType.Success
+                    });
+                }
+
+                Application.Current.Dispatcher.Invoke((Action)(() =>
+                {
+                    Login login = new Login();
+                    login.Show();
+                    Close();
+                }));
+            });
+        }
+    }
+}