NXX пре 2 година
родитељ
комит
e760a0ac0b
100 измењених фајлова са 5913 додато и 26 уклоњено
  1. +533
    -0
      BPASmartClient.AGV/AGVHelper.cs
  2. +21
    -0
      BPASmartClient.AGV/AGVLoadInteracteModel.cs
  3. +52
    -0
      BPASmartClient.AGV/AGVModel.cs
  4. +43
    -0
      BPASmartClient.AGV/AGVRequestUrl.cs
  5. +21
    -0
      BPASmartClient.AGV/AGVTaskCancelModel.cs
  6. +23
    -0
      BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs
  7. +29
    -0
      BPASmartClient.AGV/AGV_PointRollerJobData.cs
  8. +28
    -0
      BPASmartClient.AGV/AGV_SlotRollerJobData.cs
  9. +13
    -0
      BPASmartClient.AGV/App.config
  10. +14
    -0
      BPASmartClient.AGV/BPASmartClient.AGV.csproj
  11. +25
    -0
      BPASmartClient.AGV/Enums/AGVMove.cs
  12. +37
    -0
      BPASmartClient.AGV/Enums/BinTask.cs
  13. +33
    -0
      BPASmartClient.AGV/Enums/CTC.cs
  14. +20
    -0
      BPASmartClient.AGV/Enums/JobType.cs
  15. +29
    -0
      BPASmartClient.AGV/Enums/QuickPickTask.cs
  16. +37
    -0
      BPASmartClient.AGV/Enums/STC.cs
  17. +13
    -0
      BPASmartClient.AGV/Enums/SmallBelt.cs
  18. +41
    -0
      BPASmartClient.AGV/Feedback/AGVToUpSystem.cs
  19. +17
    -0
      BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs
  20. +46
    -0
      BPASmartClient.AGV/Feedback/JobData.cs
  21. +53
    -0
      BPASmartClient.AGV/Feedback/Upstreamrequest.cs
  22. +19
    -0
      BPASmartClient.AGV/HttpRequestHeaderModel.cs
  23. +16
    -0
      BPASmartClient.AGV/HttpResponseBodyModel.cs
  24. +15
    -0
      BPASmartClient.AGV/HttpResponseData.cs
  25. +15
    -0
      BPASmartClient.AGV/HttpResponseHeaderModel.cs
  26. +14
    -0
      BPASmartClient.AGV/HttpResponseModel.cs
  27. +13
    -0
      BPASmartClient.AGV/JobData.cs
  28. +17
    -0
      BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj
  29. +33
    -0
      BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs
  30. +69
    -0
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  31. +25
    -0
      BPASmartClient.AgvApi/Factory.cs
  32. +34
    -0
      BPASmartClient.AgvApi/PersonHub.cs
  33. +40
    -0
      BPASmartClient.AgvApi/Program.cs
  34. +31
    -0
      BPASmartClient.AgvApi/Properties/launchSettings.json
  35. +13
    -0
      BPASmartClient.AgvApi/WeatherForecast.cs
  36. +8
    -0
      BPASmartClient.AgvApi/appsettings.Development.json
  37. +9
    -0
      BPASmartClient.AgvApi/appsettings.json
  38. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  39. +10
    -0
      BPASmartClient.Business/Plugin/DeviceMgr.cs
  40. +1
    -2
      BPASmartClient.Business/Plugin/MQTTMgr.cs
  41. +15
    -0
      BPASmartClient.Business/Plugin/OrderProxy.cs
  42. +50
    -2
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  43. +48
    -0
      BPASmartClient.CustomResource/Converters/StatusConverter.cs
  44. BIN
     
  45. BIN
     
  46. BIN
     
  47. BIN
     
  48. BIN
     
  49. BIN
     
  50. BIN
     
  51. BIN
     
  52. BIN
     
  53. BIN
     
  54. BIN
     
  55. BIN
     
  56. BIN
     
  57. BIN
     
  58. BIN
     
  59. BIN
     
  60. BIN
     
  61. BIN
     
  62. BIN
     
  63. +16
    -0
      BPASmartClient.CustomResource/Pages/Enums/Permission.cs
  64. +34
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs
  65. +125
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  66. +14
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs
  67. +20
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs
  68. +7
    -3
      BPASmartClient.CustomResource/Pages/Model/Config.cs
  69. +6
    -2
      BPASmartClient.CustomResource/Pages/Model/Global.cs
  70. +98
    -0
      BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
  71. +68
    -0
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  72. +73
    -0
      BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs
  73. +32
    -0
      BPASmartClient.CustomResource/Pages/Model/RunLog.cs
  74. +17
    -0
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  75. +39
    -0
      BPASmartClient.CustomResource/Pages/Model/UserLog.cs
  76. +13
    -0
      BPASmartClient.CustomResource/Pages/Model/UserManager.cs
  77. +379
    -0
      BPASmartClient.CustomResource/Pages/View/AlarmView.xaml
  78. +28
    -0
      BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs
  79. +321
    -0
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  80. +90
    -0
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  81. +567
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  82. +9
    -10
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  83. +348
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
  84. +72
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
  85. +372
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  86. +28
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs
  87. +327
    -0
      BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml
  88. +47
    -0
      BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
  89. +442
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
  90. +28
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs
  91. +142
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  92. +81
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  93. +109
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  94. +69
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs
  95. +126
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  96. +134
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  97. +0
    -1
      BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml
  98. +1
    -1
      BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml
  99. BIN
     
  100. +7
    -4
      BPASmartClient.CustomResource/Themes/Generic.xaml

+ 533
- 0
BPASmartClient.AGV/AGVHelper.cs Прегледај датотеку

@@ -0,0 +1,533 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Web;
using Newtonsoft.Json;
using System.Net.Http;
using System.Configuration;

namespace BPASmartClient.AGV
{
public class AGVHelper
{
public static AGVHelper _Instance { get; set; }
public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper());
public AGVHelper()
{
}
/// <summary>
/// 获取配置文件信息
/// </summary>
/// <param name="strKey"></param>
/// <returns></returns>
public string GetAppSettingValue(string strKey)
{
string file = System.Environment.CurrentDirectory;
Configuration config = ConfigurationManager.OpenExeConfiguration(file);
foreach (string key in config.AppSettings.Settings.AllKeys)
{
if (key == strKey)
{
return config.AppSettings.Settings[strKey].Value.ToString();
}
}
return null;
}
public string HttpRequest(string url, string head, string body)
{
return PostData(url, head, body);
}
public string PostData(string url, string head, string body)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.Headers["header"] = head;
//request.Proxy = new WebProxy("192.168.1.12",80);
byte[] bytes = Encoding.UTF8.GetBytes(body);
request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式
//request.ContentType = "application/json";
request.ContentLength = bytes.Length;
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();

if (response != null)
{
response.Close();
}
if (request != null)
{
request.Abort();
}
return retString;//返回响应报文
}
/// <summary>
/// AGV去1号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV去2号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineTwoLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data= HttpRequest(url, head, body);
object objData= JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV去3号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineThreeLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅1
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotOne(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅2
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotTwo(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅3
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotThree(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅4
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFour(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅5
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFive(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// 任务取消
/// </summary>
/// <param name="robotJobId">上游系统任务号,全局唯一</param>
public string CancelJobTask(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskCancelUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVTaskCancelModel.GetInstance.robotJobId = robotJobId;
AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号
string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// 实操任务完成通知
/// </summary>
/// <returns></returns>
public string TaskCompleteNotify(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId;
AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号
string body=JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV上下料交互反馈
/// </summary>
/// <param name="agvCode">AGV编号</param>
/// <param name="jobId">任务编号</param>
/// <param name="msgId">消息编号</param>
/// <returns></returns>
public string UpDownFeedBack(string agvCode,string jobId,string msgId)
{
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVLoadInteracteModel.GetInstance.agvCode = agvCode;
AGVLoadInteracteModel.GetInstance.jobId = jobId;
AGVLoadInteracteModel.GetInstance.msgId= msgId;
string body=JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
}
}

+ 21
- 0
BPASmartClient.AGV/AGVLoadInteracteModel.cs Прегледај датотеку

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// AGV上下料交互反馈接口(上游系统->快仓系统)
/// </summary>
internal class AGVLoadInteracteModel
{
private static AGVLoadInteracteModel _instance;
public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel();
public string agvCode { get; set;}
public string jobId { get; set; }
public string msgId { get; set; }
public bool? complete { get; set; }
}
}

+ 52
- 0
BPASmartClient.AGV/AGVModel.cs Прегледај датотеку

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// AGV任务下发
/// </summary>
internal class AGVModel
{
private static AGVModel _instance;
public static AGVModel GetInstance => _instance ??= new AGVModel();
/// <summary>
/// 必填项
/// </summary>
public string robotJobId { get; set; }
/// <summary>
/// 必填项
/// </summary>
public long warehouseId { get; set; }
public string? robotJobGroupId { get; set; }
public int? sequence { get; set; }
/// <summary>
/// 必填项
/// </summary>
public int jobPriority { get; set; }
/// <summary>
/// 必填项
/// </summary>
public int jobPriorityType { get; set; }
public string? deadline { get; set; }
public string? agvType { get; set; }
public string? agvEndPoint { get; set; }
public bool? needOperation { get; set; }
public string? agvCode { get; set; }
public int? taskCountDown { get; set; }
public string? businessType { get; set; }
/// <summary>
/// 必填项
/// </summary>
public string jobType { get; set; }
/// <summary>
/// 必填项
/// </summary>
public IJobData jobData { get; set; }
}
}

+ 43
- 0
BPASmartClient.AGV/AGVRequestUrl.cs Прегледај датотеку

@@ -0,0 +1,43 @@
namespace BPASmartClient.AGV
{
public class AGVRequestUrl
{
private static AGVRequestUrl _instance;
public static AGVRequestUrl GetInstance => _instance ??= new AGVRequestUrl();
public AGVRequestUrl()
{
string IpAddress = "";
TaskSendUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.submit";
TaskCancelUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.cancel";
TaskCompleteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.operation.notice";
AGVInteracteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.roller.job.upstream.response";
}


#region Url汇总
//各种AGV的移动及搬运任务。
// 本接口请求参数包含公共字段及具体任务字段两部分组成。
//支持批量任务下发。
public string TaskSendUrl { get; set; }

//货架搬运任务指令下发后,允许上游系统调用该接口取消移位任务,支持取消策略。不同车型允许取消的任务节点不同,具体信息见API文档
public string TaskCancelUrl { get; set; }

//工作站任务实操完成后调用该接口。如果bucket有其他任务去执行其他任务。在线工作站货架直接回库,离线工作站分配AGV回库。
public string TaskCompleteUrl { get; set; }

//1.辊筒AGV在手动上下料时请求上游交互后,上游下发的反馈接口
//2.料箱AGV在任务下发需要和上游进行交互时调用此接口
//3.翻板车AGV在投递点前确认时上游反馈接口
public string AGVInteracteUrl { get; set; }
#endregion
}
}









+ 21
- 0
BPASmartClient.AGV/AGVTaskCancelModel.cs Прегледај датотеку

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// AGV任务取消
/// </summary>
internal class AGVTaskCancelModel
{
private static AGVTaskCancelModel _instance;
public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel();
public string robotJobId { get; set; }
public long warehouseId { get; set; }
public string? executeMode { get; set; }
public string? reason { get; set; }
}
}

+ 23
- 0
BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs Прегледај датотеку

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// AGV任务完成通知
/// </summary>
internal class AGVTaskCompleteNotifyModel
{
private static AGVTaskCompleteNotifyModel _instance;
public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel();
public string? robotJobId { get; set; }
public string? bucketCode { get; set; }
public string? bucketslotCode { get; set; }
public long warehouseId { get; set; }
public bool? nullFlag { get; set; }
public string? jobId { get; set; }
}
}

+ 29
- 0
BPASmartClient.AGV/AGV_PointRollerJobData.cs Прегледај датотеку

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// 辊筒点到点搬运
/// </summary>
internal class AGV_PointRollerJobData:IJobData
{
private static AGV_PointRollerJobData _instance;
public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData();
public string? containerCode { get; set; }
public string startPoint { get; set; }
public string endPoint { get; set; }
public bool autoLoad { get; set; }
public bool enableIOLoad { get; set; }
public bool autoUnload { get; set; }
public bool enableIOUnload { get; set; }
public long? loadEquipmentId { get; set; } = null;
public long? unloadEquipmentId { get; set; } = null;
public bool? loadInteractive { get; set; }
public int? loadHeight { get; set; }
public int? unloadHeight { get; set; }
}
}

+ 28
- 0
BPASmartClient.AGV/AGV_SlotRollerJobData.cs Прегледај датотеку

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
/// <summary>
/// 辊筒货位到货位搬运
/// </summary>
internal class AGV_SlotRollerJobData:IJobData
{
private static AGV_SlotRollerJobData _instance;
public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData();
public string? containerCode { get; set; }
public string startSlotCode { get; set; }
public string endSlotCode { get; set; }
public bool autoLoad { get; set; }
public bool enableIOLoad { get; set; }
public bool autoUnload { get; set; }
public bool enableIOUnload { get; set; }
public long? loadEquipmentId { get; set; } = null;
public long? unLoadEquipmentId { get; set; } = null;

public bool? loadInteractive { get; set; }
}
}

+ 13
- 0
BPASmartClient.AGV/App.config Прегледај датотеку

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--请求报文头-->
<add key="appKey" value="132"/>
<add key="appSecret" value="123"/>
<add key="requestId" value="123"/>
<add key="timestamp" value="123"/>
<add key ="version" value="2.8"/>
<!--请求报文体-->
</appSettings>
</configuration>

+ 14
- 0
BPASmartClient.AGV/BPASmartClient.AGV.csproj Прегледај датотеку

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
</ItemGroup>

</Project>

+ 25
- 0
BPASmartClient.AGV/Enums/AGVMove.cs Прегледај датотеку

@@ -0,0 +1,25 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// AGV移动任务枚举
/// </summary>
public enum AGVMove
{
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 任务取消
/// </summary>
CANCEL,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED
}
}

+ 37
- 0
BPASmartClient.AGV/Enums/BinTask.cs Прегледај датотеку

@@ -0,0 +1,37 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// 纯料箱任务枚举
/// </summary>
public enum BinTask
{
/// <summary>
/// 开始移动(仅单插臂或单夹报,2.8.1后)
/// </summary>
MOVE_BEGIN,
/// <summary>
/// 到站
/// </summary>
ENTER_STATION,
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 取料完成
/// </summary>
LOAD_COMPLETED,
/// <summary>
/// 放料完成
/// </summary>
UNLOAD_COMPLETED,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED,
}
}

+ 33
- 0
BPASmartClient.AGV/Enums/CTC.cs Прегледај датотеку

@@ -0,0 +1,33 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// 货位到货位/点到点辊筒料箱搬运任务枚举
/// </summary>
public enum CTC
{
/// <summary>
/// 正在上料
/// </summary>
ROLLER_LOAD_DOING,
/// <summary>
/// 上料完成
/// </summary>
ROLLER_LOAD_FINISH,
/// <summary>
/// 正在下料
/// </summary>
ROLLER_UNLOAD_DOING,
/// <summary>
/// 下料完成
/// </summary>
DONE,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED,
}
}

+ 20
- 0
BPASmartClient.AGV/Enums/JobType.cs Прегледај датотеку

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Enums
{
public enum JobType
{
/// <summary>
/// 货位到货位搬运
/// </summary>
SLOT_ROLLER_MOVE,
/// <summary>
/// 点到点搬运
/// </summary>
POINT_ROLLER_MOVE
}
}

+ 29
- 0
BPASmartClient.AGV/Enums/QuickPickTask.cs Прегледај датотеку

@@ -0,0 +1,29 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// QuickPick任务枚举
/// </summary>
public enum QuickPickTask
{
/// <summary>
/// 到站
/// </summary>
ENTER_STATION,
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 任务取消
/// </summary>
CANCEL,
/// <summary>
/// 离站
/// </summary>
LEAVE_STATION,
/// <summary>
/// 回滚(有其他任务,当前任务可不执行)
/// </summary>
ROLLBACK
}
}

+ 37
- 0
BPASmartClient.AGV/Enums/STC.cs Прегледај датотеку

@@ -0,0 +1,37 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// 货架/货位/点到点货架搬运任务枚举
/// </summary>
public enum STC
{
/// <summary>
/// //顶升完成
/// </summary>
LIFT_UP_DONE,
/// <summary>
/// 开始移动
/// </summary>
MOVE_BEGIN,
/// <summary>
/// 放下完成
/// </summary>
PUT_DOWN_DONE,
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 任务取消
/// </summary>
CANCEL,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED,
}
}

+ 13
- 0
BPASmartClient.AGV/Enums/SmallBelt.cs Прегледај датотеку

@@ -0,0 +1,13 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// 小皮带任务枚举
/// </summary>
public enum SmallBelt
{
/// <summary>
/// 任务完成
/// </summary>
DONE
}
}

+ 41
- 0
BPASmartClient.AGV/Feedback/AGVToUpSystem.cs Прегледај датотеку

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class AGVToUpSystem
{
/// <summary>
/// 上游系统任务号,全局唯一
/// </summary>
public string robotJobId { get; set; }

/// <summary>
/// 仓库编号
/// </summary>
public int warehouseId { get; set; }

/// <summary>
/// 任务快仓系统编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 任务状态
/// </summary>
public string state { get; set; }

/// <summary>
/// 内部任务类型
/// </summary>
public string jobType { get; set; }

/// <summary>
/// 数据字段
/// </summary>
public JobData jobData { get; set; } = new JobData();
}
}

+ 17
- 0
BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs Прегледај датотеку

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class AGVUpReportHeader
{
public string? appKey { get; set; }
public string? appSecret { get; set; }
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 46
- 0
BPASmartClient.AGV/Feedback/JobData.cs Прегледај датотеку

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class JobData
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上料点位
/// </summary>
public string startPointCode { get; set; }

/// <summary>
/// 上料货位编号
/// </summary>
public string startSlotCode { get; set; }

/// <summary>
/// 下料点位
/// </summary>
public string targetPointCode { get; set; }

/// <summary>
/// 下料货位编号
/// </summary>
public string targetSlotCode { get; set; }

/// <summary>
/// 是否需要上料交互
/// </summary>
public bool loadInteractive { get; set; }
}
}

+ 53
- 0
BPASmartClient.AGV/Feedback/Upstreamrequest.cs Прегледај датотеку

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class Upstreamrequest
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

/// <summary>
/// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
/// </summary>
public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

/// <summary>
/// 上游任务号
/// </summary>
public string robotJobId { get; set; }
}
}

+ 19
- 0
BPASmartClient.AGV/HttpRequestHeaderModel.cs Прегледај датотеку

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpRequestHeaderModel
{
private static HttpRequestHeaderModel _instance;
public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel();
public string? appKey { get; set; }
public string? appSecret { get; set; }
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 16
- 0
BPASmartClient.AGV/HttpResponseBodyModel.cs Прегледај датотеку

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseBodyModel
{
public string code { get; set; }
public string message { get; set; }
public bool success { get; set; }
public HttpResponseData data { get; set; }
}
}

+ 15
- 0
BPASmartClient.AGV/HttpResponseData.cs Прегледај датотеку

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseData
{
public string code { get; set; }
public bool message { get; set; }
public string robotJobId { get; set; }
}
}

+ 15
- 0
BPASmartClient.AGV/HttpResponseHeaderModel.cs Прегледај датотеку

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseHeaderModel
{
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 14
- 0
BPASmartClient.AGV/HttpResponseModel.cs Прегледај датотеку

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseModel
{
public HttpResponseHeaderModel? Header { get; set; }
public HttpResponseBodyModel? Body { get; set; }
}
}

+ 13
- 0
BPASmartClient.AGV/JobData.cs Прегледај датотеку

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
public interface IJobData
{

}
}

+ 17
- 0
BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj Прегледај датотеку

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.AGV\BPASmartClient.AGV.csproj" />
</ItemGroup>

</Project>

+ 33
- 0
BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs Прегледај датотеку

@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;

namespace BPASmartClient.AgvApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

+ 69
- 0
BPASmartClient.AgvApi/Controllers/robotjobController.cs Прегледај датотеку

@@ -0,0 +1,69 @@
using BPASmartClient.AGV.Feedback;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;

namespace BPASmartClient.AgvApi.Controllers
{
[ApiController]
[Route("apicallback/quicktron/[Controller]")]
public class robotjobController : ControllerBase
{
/// <summary>
/// 搬运任务状态上报
/// </summary>
/// <param name="sign"></param>
/// <returns></returns>
[HttpPost("report")]
public string report(string sign)
{
if (sign != null)
{
try
{
var res = JsonConvert.DeserializeObject<AGVToUpSystem>(sign);
if (res != null)
{
Factory.GetInstance.SendReport(res);
return "SUCCESS";
}
}
catch (Exception ex)
{
return ex.ToString();
}

}
return "Error";
}

/// <summary>
/// AGV上下料交互请求接口
/// </summary>
/// <param name="sign"></param>
/// <returns></returns>
[HttpPost("upstreamrequest")]
public string upstreamrequest(string sign)
{
if (sign != null)
{
try
{
var res = JsonConvert.DeserializeObject<Upstreamrequest>(sign);
if (res != null)
{
Factory.GetInstance.SendUpstreamrequest(sign);
return "SUCCESS";
}
}
catch (Exception ex)
{
return ex.ToString();
}

}
return "Error";
}

}
}

+ 25
- 0
BPASmartClient.AgvApi/Factory.cs Прегледај датотеку

@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.SignalR;

namespace BPASmartClient.AgvApi
{
public class Factory
{

private volatile static Factory _Instance;
public static Factory GetInstance => _Instance ?? (_Instance = new Factory());
private Factory() { }

public IHubCallerClients HubCallerClient { get; set; }

public Task SendReport(object obj)
{
return HubCallerClient?.Caller.SendAsync("Report", obj);
}

public Task SendUpstreamrequest(object obj)
{
return HubCallerClient?.Caller.SendAsync("Upstreamrequest", obj);
}

}
}

+ 34
- 0
BPASmartClient.AgvApi/PersonHub.cs Прегледај датотеку

@@ -0,0 +1,34 @@
using Microsoft.AspNetCore.SignalR;

namespace BPASmartClient.AgvApi
{
public class PersonHub : Hub
{

public override Task OnConnectedAsync()
{
Console.WriteLine($"{Context.ConnectionId}:= 连接成功");
Factory.GetInstance.HubCallerClient = Clients;
return base.OnConnectedAsync();
}

public override Task OnDisconnectedAsync(Exception? exception)
{
Console.WriteLine($"{Context.ConnectionId}:= 断开连接");
return base.OnDisconnectedAsync(exception);
}

/// <summary>
/// 接收客户端发来的信息,并向客户端发送信息
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public Task Send(object str)
{
return Clients.Caller.SendAsync("SendMessage", str);
}



}
}

+ 40
- 0
BPASmartClient.AgvApi/Program.cs Прегледај датотеку

@@ -0,0 +1,40 @@
using BPASmartClient.AgvApi;
using Microsoft.AspNetCore.Cors.Infrastructure;



var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSignalR();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

app.Use(async (context, next) =>
{
context.Request.Headers["appKey"] = "0123456789abcdef";
context.Response.Headers["appSecret"] = "0123456789abcdef";
context.Response.Headers["requestId"] = "5f643ece-dc53-4d55-8e5f-d1e2dfd6a6d0";
context.Response.Headers["timestamp"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
context.Response.Headers["version"] = "2.8";
await next();
});


app.UseAuthorization();

app.MapControllers();
app.MapHub<PersonHub>("/personhub");

app.Run();

+ 31
- 0
BPASmartClient.AgvApi/Properties/launchSettings.json Прегледај датотеку

@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:38659",
"sslPort": 0
}
},
"profiles": {
"BPASmartClient.AgvApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5175",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

+ 13
- 0
BPASmartClient.AgvApi/WeatherForecast.cs Прегледај датотеку

@@ -0,0 +1,13 @@
namespace BPASmartClient.AgvApi
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}

+ 8
- 0
BPASmartClient.AgvApi/appsettings.Development.json Прегледај датотеку

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

+ 9
- 0
BPASmartClient.AgvApi/appsettings.json Прегледај датотеку

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

+ 1
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj Прегледај датотеку

@@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Message" Version="1.0.37" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 10
- 0
BPASmartClient.Business/Plugin/DeviceMgr.cs Прегледај датотеку

@@ -5,6 +5,7 @@ using BPASmartClient.Helper;
using BPASmartClient.Http;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.Peripheral;
using Newtonsoft.Json;
using System;
@@ -128,6 +129,15 @@ namespace BPASmartClient.Business
MessageLog.GetInstance.Show($"物料ID:=[{x.BatchingId}],{x.BatchingLoc}号位置:{x.BatchingCount}");
});
}
else if (PushType == 2)//小炒API流程获取,待定
{
new StirFryGoodsEvent()
{
DeviceId = device.DeviceId,
stirFrymessage = JsonConvert.DeserializeObject<StirFryPushMessage>(result)
}.Publish();
MessageLog.GetInstance.Show("接收到【 API 】获取的小炒流程信息");
}
}
catch (Exception ex)
{


+ 1
- 2
BPASmartClient.Business/Plugin/MQTTMgr.cs Прегледај датотеку

@@ -46,12 +46,11 @@ namespace BPASmartClient.Business
mqttProxy.Connected = new Action(() =>
{
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray());
MessageLog.GetInstance.Show("MQTT 连接成功");
});
//MQTT 连接成功
mqttProxy.LostConnect = new Action(() =>
{
MqttHelper.GetInstance().MqttSubscriptionAsync(TopicDefine.GetInstance().SubscribTopics.ToArray());
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray());
});
//MQTT 数据接收
mqttProxy.MessageRecive = new Action<string>((message) =>


+ 15
- 0
BPASmartClient.Business/Plugin/OrderProxy.cs Прегледај датотеку

@@ -1,11 +1,14 @@
//#define test
using BPA.Message;
using BPA.Message.Enum;
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Http;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
@@ -99,6 +102,18 @@ namespace BPASmartClient.Business
MessageLog.GetInstance.Show($"物料ID:=[{x.BatchingId}],{x.BatchingLoc}号位置:{x.BatchingCount}");
});
}
//小炒流程信息
else if (message is StirFryPushMessage frybom)
{
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 28);
new StirFryGoodsEvent() {
DeviceId = device.DeviceId,
stirFrymessage =frybom
}.Publish();
MessageLog.GetInstance.Show("接受到【MQTT】的小炒流程信息");
}
});

EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);


+ 50
- 2
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Прегледај датотеку

@@ -19,8 +19,18 @@
</ItemGroup>

<ItemGroup>
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\停车位.png" />
<None Remove="Image\AGV\充电桩.png" />
<None Remove="Image\AGV\墙.png" />
<None Remove="Image\AGV\汤碗.png" />
<None Remove="Image\AGV\炒锅.png" />
<None Remove="Image\AGV\物流车.png" />
<None Remove="Image\AGV\砖块.png" />
<None Remove="Image\AGV\蔬菜.png" />
<None Remove="Image\AGV\语音箭头.png" />
<None Remove="Image\bg.png" />
<None Remove="Image\btn_close.png" />
<None Remove="Image\btn_normal.png" />
@@ -93,12 +103,16 @@
<None Remove="Image\圆角矩形 30 拷贝.png" />
<None Remove="Image\圆角矩形 4.png" />
<None Remove="Image\圆角矩形.png" />
<None Remove="Image\工艺流程.jpg" />
<None Remove="Image\工艺流程.png" />
<None Remove="Image\底部背景.png" />
<None Remove="Image\搜索按钮.png" />
<None Remove="Image\搜索框.png" />
<None Remove="Image\文字.png" />
<None Remove="Image\日历.png" />
<None Remove="Image\日期1.png" />
<None Remove="Image\智慧城市科技风登录页面.png" />
<None Remove="Image\智慧城市科技风登录页面边框.png" />
<None Remove="Image\有告警.png" />
<None Remove="Image\标题背景.png" />
<None Remove="Image\环形切图\内圈\未选中.png" />
@@ -107,6 +121,8 @@
<None Remove="Image\环形切图\外圈\未选中.png" />
<None Remove="Image\环形切图\外圈\选中.png" />
<None Remove="Image\界面2.png" />
<None Remove="Image\登录界面背景.jpg" />
<None Remove="Image\登录界面背景1.jpg" />
<None Remove="Image\矩形.png" />
<None Remove="Image\矩形1.png" />
<None Remove="Image\矩形样式.png" />
@@ -144,6 +160,7 @@
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
<None Remove="Image\背景3.jpg" />
<None Remove="Image\背景图片.png" />
<None Remove="Image\背景矢量\内部.png" />
<None Remove="Image\背景矢量\右上.png" />
@@ -173,6 +190,7 @@
<None Remove="Image\顶部切图\Top_L.png" />
<None Remove="Image\顶部切图\窗体背景.png" />
<None Remove="Image\顶部切图\窗体背景2.png" />
<None Remove="Image\顶部切图\自动化产线上位机控制系统.png" />
<None Remove="Image\顶部切图\返回按钮1.png" />
<None Remove="Image\顶部切图\返回按钮2.png" />
<None Remove="Image\顶部切图\返回按钮图标.png" />
@@ -196,7 +214,24 @@
</ItemGroup>

<ItemGroup>
<Content Include="Videos\Login.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\停车位.png" />
<Resource Include="Image\AGV\充电桩.png" />
<Resource Include="Image\AGV\墙.png" />
<Resource Include="Image\AGV\汤碗.png" />
<Resource Include="Image\AGV\炒锅.png" />
<Resource Include="Image\AGV\物流车.png" />
<Resource Include="Image\AGV\砖块.png" />
<Resource Include="Image\AGV\蔬菜.png" />
<Resource Include="Image\AGV\语音箭头.png" />
<Resource Include="Image\btn_close.png" />
<Resource Include="Image\ComboBoxPopSelect.png" />
<Resource Include="Image\ComboBoxSelect.png" />
@@ -214,11 +249,18 @@
<Resource Include="Image\告警\无告警.png" />
<Resource Include="Image\告警\无告警1.png" />
<Resource Include="Image\告警\轻微告警.png" />
<Resource Include="Image\工艺流程.jpg" />
<Resource Include="Image\工艺流程.png" />
<Resource Include="Image\智慧城市科技风登录页面.png" />
<Resource Include="Image\智慧城市科技风登录页面边框.png" />
<Resource Include="Image\界面2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\边角.png" />
</ItemGroup>

@@ -232,6 +274,7 @@
<Resource Include="Image\顶部切图\Top_L.png" />
<Resource Include="Image\顶部切图\窗体背景.png" />
<Resource Include="Image\顶部切图\窗体背景2.png" />
<Resource Include="Image\顶部切图\自动化产线上位机控制系统.png" />
<Resource Include="Image\顶部切图\返回按钮1.png" />
<Resource Include="Image\顶部切图\返回按钮2.png" />
<Resource Include="Image\顶部切图\返回按钮图标.png" />
@@ -240,11 +283,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.37" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Image\bg.png" />
<Resource Include="Image\btn_normal.png" />
<Resource Include="Image\buttonOff.png" />


+ 48
- 0
BPASmartClient.CustomResource/Converters/StatusConverter.cs Прегледај датотеку

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class StatusConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SolidColorBrush returnValue = Brushes.SandyBrown;
if (value != null && value is ushort statusValue)
{
switch (statusValue)
{
case 0:
returnValue = Brushes.SandyBrown;
break;
case 1:
returnValue = Brushes.Green;
break;
case 2:
returnValue = Brushes.Yellow;
break;
case 3:
returnValue = Brushes.Aqua;
break;
case 4:
returnValue = Brushes.Red;
break;
default:
break;
}
}
return returnValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}




















+ 16
- 0
BPASmartClient.CustomResource/Pages/Enums/Permission.cs Прегледај датотеку

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Enums
{
public enum Permission : int
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
技术员 = 4
}
}

+ 34
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs Прегледај датотеку

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
[AttributeUsage(AttributeTargets.Property)]
public class AlarmAttribute : Attribute
{
public AlarmAttribute(string Info, AlarmTriggerType alarmTriggerType = AlarmTriggerType.Rising, AlarmLevel alarmLevel = AlarmLevel.一般报警)
{
AlarmInfo = Info;
AlarmType = alarmTriggerType;
@AlarmLevel = alarmLevel;
}

/// <summary>
/// 报警信息
/// </summary>
public string AlarmInfo { get; set; }

/// <summary>
/// 告警类型
/// </summary>
public AlarmTriggerType AlarmType { get; set; }

/// <summary>
/// 告警级别
/// </summary>
public AlarmLevel @AlarmLevel { get; set; }
}
}

+ 125
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs Прегледај датотеку

@@ -0,0 +1,125 @@
using BPASmartClient.Helper;
//using BPASmartClient.Message;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class AlarmHelper<AlarmT> where AlarmT : class, new()
{
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
public static Action<string> RemoveAction { get; set; }
public static Action ChangeAction { get; set; }

public static AlarmT Alarm { get; set; } = new AlarmT();

public static void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
foreach (var item in Alarm.GetType().GetProperties())
{
if (item.CustomAttributes.Count() > 0)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
{
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
Thread.Sleep(100);
}), "报警通用模块监听");

}

/// <summary>
/// 沿报警检测
/// </summary>
/// <param name="Trigger">触发变量</param>
/// <param name="text">报警信息</param>
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
{
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
{
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
{
AddAlarm(Trigger, text, alarmLevel);
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
}
}
else RemoveAlarm(text);
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
}

/// <summary>
/// 添加报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
Grade = alarmLevel.ToString(),
Info = AlarmInfo,
Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Insert(0, tempAlarm);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
}
}

/// <summary>
/// 移除报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void RemoveAlarm(string AlarmInfo)
{
var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
if (result != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Remove(result);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

if (RemoveAction != null) RemoveAction(AlarmInfo);
if (ChangeAction != null) ChangeAction();
}
}

}
}

+ 14
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs Прегледај датотеку

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public enum AlarmLevel
{
一般报警,
严重报警
}
}

+ 20
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs Прегледај датотеку

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public enum AlarmTriggerType
{
/// <summary>
/// 上升沿
/// </summary>
Rising,
/// <summary>
/// 下降沿
/// </summary>
Falling
}
}

DosingSystem/Model/Config.cs → BPASmartClient.CustomResource/Pages/Model/Config.cs Прегледај датотеку

@@ -1,4 +1,5 @@
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,16 +8,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Config
{

private volatile static Config _Instance;
public static Config GetInstance => _Instance ?? (_Instance = new Config());
private Config() { }


public void Init()
{
if (File.Exists("up.hbl"))
@@ -43,6 +42,11 @@ namespace DosingSystem.Model
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
SaveUser();
}

public void SaveUser()
{
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
}
}

DosingSystem/Model/Global.cs → BPASmartClient.CustomResource/Pages/Model/Global.cs Прегледај датотеку

@@ -1,13 +1,17 @@
using System;
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Global
{
public static UserManager userManager { get; set; } = new UserManager();

public static UserInfo userInfo { get; set; } = new UserInfo();

}
}

+ 98
- 0
BPASmartClient.CustomResource/Pages/Model/MenuManage.cs Прегледај датотеку

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPASmartClient.CustomResource.Pages.Enums;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
/// <summary>
/// 在启动界面之前设置菜单项
/// </summary>
public class MenuManage : ObservableObject
{
private volatile static MenuManage _Instance;
public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
private MenuManage() { }

public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
}

public class MenuModel : ObservableObject
{
/// <summary>
/// 主菜单权限
/// </summary>
public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mMainMenuPermission;

/// <summary>
/// 主菜单图标
/// </summary>
public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
private string _mMainMenuIcon = string.Empty;

/// <summary>
/// 主菜单名称
/// </summary>
public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
private string _mMainMenuName = string.Empty;

/// <summary>
/// 别名(英文名)
/// </summary>
public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
private string _mAlias = string.Empty;

/// <summary>
/// 主菜单的显示隐藏设置
/// </summary>
public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mMainMenuVisibility;

/// <summary>
/// 子菜单集合
/// </summary>
public ObservableCollection<SubMenumodel> subMenumodels { get; set; } = new ObservableCollection<SubMenumodel>();

}

public class SubMenumodel : ObservableObject
{
/// <summary>
/// 子菜单名称
/// </summary>
public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
private string _mSubMenuName = string.Empty;

/// <summary>
/// 子菜单权限管理
/// </summary>
public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mSubMenuPermission;

/// <summary>
/// 切换界面路径
/// </summary>
public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
private string _mToggleWindowPath = string.Empty;

/// <summary>
/// 程序集名称
/// </summary>
public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
private string _mAssemblyName = string.Empty;

/// <summary>
/// 子菜单的显示隐藏设置
/// </summary>
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mSubMenuVisibility;

}

}

+ 68
- 0
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs Прегледај датотеку

@@ -0,0 +1,68 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class MessageLog
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
private MessageLog() { }

public Action<string> UserLog { get; set; }

public Action<string> RunLog { get; set; }

public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
}

//public void GetLog()
//{
// Sqlite<UserLog>.GetInstance.GetData();
// Sqlite<RunLog>.GetInstance.GetData();
//}

public void ShowUserLog(string info)
{
UserLog userLog = new UserLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
}

public void ShowRunLog(string info)
{
RunLog runLog = new RunLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RunLogInfo = info
};
Sqlite<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
}


}
}

+ 73
- 0
BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs Прегледај датотеку

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BPASmartClient.CustomResource.Pages.Model
{
/// <summary>
/// 给PasswordBox添加一个可以绑定的附加类
/// </summary>
public class PasswordHelper
{

static bool IsUpdete = false;

#region PasswordProperty
public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string),
typeof(PasswordHelper), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnPropertyChanged)));


public static string GetPassword(DependencyObject d)
{
return d.GetValue(PasswordProperty).ToString();
}

public static void SetPassword(DependencyObject d, string value)
{
d.SetValue(PasswordProperty, value);
}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged -= password_PasswordChanged;
if (!IsUpdete) password.Password = e.NewValue?.ToString();
password.PasswordChanged += password_PasswordChanged;
}
#endregion

#region AttachProperty
public static readonly DependencyProperty AttachProperty = DependencyProperty.RegisterAttached("Attach", typeof(bool),
typeof(PasswordHelper), new FrameworkPropertyMetadata(default(bool), new PropertyChangedCallback(OnAttachChanged)));

public static bool GetAttach(DependencyObject d)
{
return (bool)d.GetValue(AttachProperty);
}

public static void SetAttach(DependencyObject d, bool value)
{
d.SetValue(AttachProperty, value);
}

private static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged += password_PasswordChanged;
}

private static void password_PasswordChanged(object sender, RoutedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
IsUpdete = true;
SetPassword(passwordBox, passwordBox.Password);
IsUpdete = false;
}

#endregion
}
}

+ 32
- 0
BPASmartClient.CustomResource/Pages/Model/RunLog.cs Прегледај датотеку

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RunLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string RunLogInfo { get { return _mRunLogInfo; } set { _mRunLogInfo = value; OnPropertyChanged(); } }
//private string _mRunLogInfo;

public string Date { get; set; }

public string Time { get; set; }

public string RunLogInfo { get; set; }

}
}

+ 17
- 0
BPASmartClient.CustomResource/Pages/Model/UserInfo.cs Прегледај датотеку

@@ -0,0 +1,17 @@
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserInfo
{
public Permission permission { get; set; }
public string UserName { get; set; }
public string Password { get; set; }

}
}

+ 39
- 0
BPASmartClient.CustomResource/Pages/Model/UserLog.cs Прегледај датотеку

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Permission { get { return _mPermission; } set { _mPermission = value; OnPropertyChanged(); } }
//private string _mPermission;

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
//private string _mLogInfo;

public string Permission { get; set; }

public string Date { get; set; }

public string Time { get; set; }

public string UserName { get; set; }

public string LogInfo { get; set; }

}
}

+ 13
- 0
BPASmartClient.CustomResource/Pages/Model/UserManager.cs Прегледај датотеку

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserManager
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
}
}

+ 379
- 0
BPASmartClient.CustomResource/Pages/View/AlarmView.xaml Прегледај датотеку

@@ -0,0 +1,379 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.AlarmView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:AlarmViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警日期" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding NumId}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Time}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Id}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Time}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// AlarmView.xaml 的交互逻辑
/// </summary>
public partial class AlarmView : UserControl
{
public AlarmView()
{
InitializeComponent();
}
}
}

+ 321
- 0
BPASmartClient.CustomResource/Pages/View/LoginView.xaml Прегледај датотеку

@@ -0,0 +1,321 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
Width="1920"
Height="1080"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
WindowState="Normal"
mc:Ignorable="d">

<Window.DataContext>
<vm:LoginViewModel />
</Window.DataContext>

<Window.Resources>
<Style x:Key="TxLogin" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe60c;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号密码"
Visibility="Collapsed" />-->

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 操作按钮样式-->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="20,20" />
<Setter Property="Background" Value="#cc009DFF" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="30" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="20">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#009DFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid>
<MediaElement
Name="player"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LoadedBehavior="Manual" />

<Grid x:Name="grid" Margin="400,180">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="40"
Foreground="#009DFF"
Text="用户登录" />

<TextBlock
Grid.Row="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="30"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<TextBox
Name="Username"
Grid.Row="1"
Margin="20,20"
BorderBrush="#009DFF"
BorderThickness="3"
FontSize="30"
Foreground="#009DFF"
KeyDown="TextBox_KeyDown"
Style="{DynamicResource UserTextBoxStyle}"
TabIndex="1"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="2"
Margin="20,20"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
BorderThickness="3"
FontSize="30"
Foreground="#009DFF"
KeyDown="pb_KeyDown"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="markText"
Grid.Row="2"
Margin="70,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="30"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />

<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Command="{Binding ExitCommand}"
Content="退 出"
Style="{StaticResource ButtonStyle}" />

<Button
Grid.Column="1"
Command="{Binding LoginCommand}"
Content="登 录"
Style="{StaticResource ButtonStyle}"
TabIndex="3" />

</Grid>
</Grid>
</Grid>
</Window>

+ 90
- 0
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs Прегледај датотеку

@@ -0,0 +1,90 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// LoginView.xaml 的交互逻辑
/// </summary>
public partial class LoginView : Window
{
public LoginView()
{
InitializeComponent();
grid.Visibility = Visibility.Collapsed;
Username.Focus();
Username.SelectionStart = Username.Text.Trim().Length;
this.Loaded += LoginView_Loaded;
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
}

private void LoginView_Loaded(object sender, RoutedEventArgs e)
{
string path = $"{AppDomain.CurrentDomain.BaseDirectory}Videos\\Login.mp4";
if (File.Exists(path))
{
player.Source = new Uri(path); // 绑定视频文件
this.WindowState = WindowState.Maximized;
player.LoadedBehavior = MediaState.Manual; // 交互式控制
player.Loaded += new RoutedEventHandler(media_Loaded); // 添加元素加载完成事件 -- 自动开始播放
player.MediaEnded += new RoutedEventHandler(media_MediaEnded); // 添加媒体播放结束事件 -- 重新播放
player.Unloaded += new RoutedEventHandler(media_Unloaded);// 添加元素卸载完成事件 -- 停止播放
player.MediaOpened += Player_MediaOpened;//已播放事件
}
}

private void Player_MediaOpened(object sender, RoutedEventArgs e)
{
grid.Visibility = Visibility.Visible;
}

private void media_Loaded(object sender, RoutedEventArgs e)
{
(sender as MediaElement).Play();
}

private void media_MediaEnded(object sender, RoutedEventArgs e)
{
// MediaElement需要先停止播放才能再开始播放,
// 否则会停在最后一帧不动
(sender as MediaElement).Stop();
(sender as MediaElement).Play();
}

private void media_Unloaded(object sender, RoutedEventArgs e)
{
(sender as MediaElement).Stop();
}

private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
}

private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) pb.Focus();
}

private void pb_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
}
}
}

+ 567
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml Прегледај датотеку

@@ -0,0 +1,567 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.MainView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="MainView"
Width="1200"
Height="700"
Topmost="False"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
<ImageBrush x:Key="leftImageSub" ImageSource="../../Image/leftImageSub.png" />
<ImageBrush x:Key="topImage" ImageSource="../../Image/topImage.png" />
<!--#endregion-->

<!--#region 标题栏按钮样式-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="24" />
<Setter Property="FontFamily" Value="../../Fonts/#iconfont" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="TitleBarBr" Background="Transparent">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#22ffffff" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 导航栏样式-->
<Style x:Key="NavButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1.5">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#865eec" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0,0,1.5,1.5" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表单选按钮样式-->
<Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="5,10,1,5" />
<Setter Property="Width" Value="160" />
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="粗体" />
<Setter Property="Foreground" Value="#DDD" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#DDD" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid
x:Name="templateRoot"
Background="Transparent"
SnapsToDevicePixels="True">
<Border x:Name="border2" />
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="14,0,0,0"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="4,-1,0,0" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}" />

<Trigger Property="IsChecked" Value="true">
<Setter Property="Foreground" Value="White" />
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImageSub}">
<!--<Setter.Value>
<ImageBrush ImageSource="./images/back.png" />
</Setter.Value>-->
</Setter>
</Trigger>

<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#101F3F" />
<Setter Property="Foreground" Value="#4B8EC4" />
</Trigger>

<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="border2" Property="Background" Value="#55007acc" />
</MultiTrigger.Setters>
</MultiTrigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表样式-->
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Height" Value="80" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="10,10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<Border
x:Name="border2"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>

<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImage}" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
Height="60"
MinWidth="0"
MinHeight="0"
Margin="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ToggleButtonStyle}" />
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Left"
Focusable="false"
Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
<Style x:Key="checkBoxStyle" TargetType="CheckBox">
<Setter Property="Foreground" Value="#a2c2e8" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="1"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<StackPanel
Background="Transparent"
Orientation="Horizontal"
SnapsToDevicePixels="True">
<Grid>
<Image
Width="12"
Height="14"
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
<Image
x:Name="image1"
Width="12"
Height="14"
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
</Grid>
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="14,0,0,0"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="4,0,0,0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Grid Background="#103153">

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Border
x:Name="MoveBorder"
Height="50"
VerticalAlignment="Top"
Background="#0C2349"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1">

<StackPanel Orientation="Horizontal">
<Image Margin="15,5,0,5" Source="../../Image/HBL.png" />
<TextBlock
Name="tbTitle"
Margin="20,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="White"
Text="上位机监控系统" />
</StackPanel>


</Border>

<UniformGrid
Width="150"
Height="50"
HorizontalAlignment="Right"
Columns="3">
<Button
Visibility="Hidden"
IsEnabled="False"
Name="ButMin"
Content="&#xe664;"
Style="{StaticResource TitleBarStyle}" />
<Button
Visibility="Hidden"
IsEnabled="False"
Name="ButMax"
Content="&#xe65d;"
FontSize="22"
Style="{StaticResource TitleBarStyle}" />
<Button
Name="ButClose"
Content="&#xe679;"
Foreground="Red"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 显示区设置-->

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- 侧边栏菜单设置 -->
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<Grid>
<Border BorderBrush="#121F40" BorderThickness="1">
<Border.Background>
<ImageBrush ImageSource="../../Image/leftback.png" />
</Border.Background>
</Border>

<ScrollViewer
Grid.Row="1"
Margin="10"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding menuModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Visibility="{Binding MainMenuVisibility}">
<Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
<Expander.Header>
<StackPanel
Margin="10,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="25"
Foreground="#ddd"
Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
<TextBlock
FontSize="16"
Foreground="White"
Text="{Binding MainMenuName}" />
<TextBlock
FontSize="13"
Foreground="Gray"
Text="{Binding Alias}" />
</StackPanel>
</StackPanel>
</Expander.Header>
<Expander.Content>
<StackPanel>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding subMenumodels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
CommandParameter="{Binding ToggleWindowPath}"
Content="{Binding SubMenuName}"
GroupName="All"
Style="{StaticResource RadioMiniButtonStyle}"
Visibility="{Binding SubMenuVisibility}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</StackPanel>
</Expander.Content>
</Expander>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</ScrollViewer>
<!--#endregion-->

<!--#region 页面显示-->
<Grid Grid.Column="1">
<Grid.Background>
<ImageBrush ImageSource="../../Image/WindowImages.png" />
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox
Style="{StaticResource checkBoxStyle}"
Margin="5,0,5,0"
Content="开机启动"
IsChecked="{Binding AutoStart}" />
<CheckBox
Style="{StaticResource checkBoxStyle}"
Margin="5,0,5,0"
Content="设备初始化"
IsChecked="{Binding Status}"
/>
</StackPanel>
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#1A8ADE"
Text="{Binding DisplayName}" />

<TextBlock
Margin="10,10,0,5"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding DateVisible}" />

<TextBlock
Margin="0,10,50,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding TimeVisible}" />

<ContentControl Grid.Row="1" Content="{Binding MainContent}" />

</Grid>

<!--#endregion-->

</Grid>


<!--#endregion-->

</Grid>

</Window>

DosingSystem/View/MainWindow.xaml.cs → BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs Прегледај датотеку

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -10,25 +11,23 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DosingSystem.View
namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// MainView.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainView : Window
{
public MainWindow()
public MainView()
{
InitializeComponent();
this.WindowState = WindowState.Maximized;
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); };

this.MaxWidth = SystemParameters.WorkArea.Width;
this.MaxHeight = SystemParameters.WorkArea.Height;

this.br.MouseLeftButtonDown += (o, e) =>
this.MoveBorder.MouseLeftButtonDown += (o, e) =>
{
if (e.ClickCount > 1)
{

+ 348
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml Прегледај датотеку

@@ -0,0 +1,348 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.PasswordChangeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="PasswordChangeView"
Width="500"
Height="350"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:PasswordChangeViewModel />
</Window.DataContext>

<Window.Resources>
<Style x:Key="TxLogin" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe850;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号密码"
Visibility="Collapsed" />-->

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Border
x:Name="br"
BorderBrush="#009dff"
BorderThickness="2">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
<Grid>
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" />
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />

<Grid Margin="50,20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="密码修改" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<Grid Grid.Row="1">
<PasswordBox
Name="oldpb"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding OldPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="oldpb_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="oldmarkText"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入原密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="2">
<PasswordBox
Name="newpb1"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb1_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText1"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="3">
<PasswordBox
Name="newpb2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb2_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请再次输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="取 消"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="确 认"
FontSize="20"
Foreground="White"
TabIndex="3" />

</Grid>

</Grid>
</Grid>

</Border>

</Window>

+ 72
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs Прегледај датотеку

@@ -0,0 +1,72 @@
using BPASmartClient.Helper;
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// PasswordChangeView.xaml 的交互逻辑
/// </summary>
public partial class PasswordChangeView : Window
{
public PasswordChangeView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) =>
{
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
ActionManage.GetInstance.CancelRegister("PasswordChangeViewconfirm");
ActionManage.GetInstance.CancelRegister("PasswordChangeViewCancel");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "PasswordChangeViewconfirm");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "PasswordChangeViewCancel");
}

private void newpb2_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb2.Password.Length > 0)
{
this.newmarkText2.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText2.Visibility = Visibility.Visible;
}
}

private void newpb1_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb1.Password.Length > 0)
{
this.newmarkText1.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText1.Visibility = Visibility.Visible;
}
}

private void oldpb_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.oldpb.Password.Length > 0)
{
this.oldmarkText.Visibility = Visibility.Collapsed;
}
else
{
this.oldmarkText.Visibility = Visibility.Visible;
}
}
}
}

+ 372
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml Прегледај датотеку

@@ -0,0 +1,372 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.RunLogView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:RunLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />

<!--<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->

<!--<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// RunLogView.xaml 的交互逻辑
/// </summary>
public partial class RunLogView : UserControl
{
public RunLogView()
{
InitializeComponent();
}
}
}

+ 327
- 0
BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml Прегледај датотеку

@@ -0,0 +1,327 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.SubPagLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="SubPagLoginView"
Width="800"
Height="450"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:LoginViewModel />
</Window.DataContext>

<Window.Resources>
<Style x:Key="TxLogin" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe60c;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号密码"
Visibility="Collapsed" />-->

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="{TemplateBinding FontSize}"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 操作按钮样式-->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="5" />
<Setter Property="Background" Value="#cc009DFF" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#009DFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid>
<Grid.Background>
<ImageBrush ImageSource="../../Image/智慧城市科技风登录页面边框.png" />
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.05*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="0.9*" />
<RowDefinition />
<RowDefinition Height="1.2*" />
</Grid.RowDefinitions>

<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<Grid
x:Name="grid"
Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBox
Name="Username"
Margin="5,5"
BorderBrush="#009DFF"
BorderThickness="3"
FontSize="16"
Foreground="#009DFF"
KeyDown="TextBox_KeyDown"
Style="{DynamicResource UserTextBoxStyle}"
TabIndex="1"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="1"
Margin="5"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
BorderThickness="3"
FontSize="16"
Foreground="#009DFF"
KeyDown="pb_KeyDown"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="markText"
Grid.Row="1"
Margin="58,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />

<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Command="{Binding ExitCommand}"
Content="退 出"
Style="{StaticResource ButtonStyle}" />

<Button
Grid.Column="1"
Command="{Binding LoginCommand}"
Content="登 录"
Style="{StaticResource ButtonStyle}"
TabIndex="3" />

</Grid>

</Grid>


</Grid>


</Window>

+ 47
- 0
BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs Прегледај датотеку

@@ -0,0 +1,47 @@
using BPASmartClient.Helper;
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// SubPagLoginView.xaml 的交互逻辑
/// </summary>
public partial class SubPagLoginView : Window
{
public SubPagLoginView()
{
InitializeComponent();
Username.Focus();
Username.SelectionStart = Username.Text.Trim().Length;
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
}

private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
}

private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) pb.Focus();
}

private void pb_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
}
}
}

+ 442
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml Прегледај датотеку

@@ -0,0 +1,442 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.UserLogView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:UserLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#20FDFA" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

<!--#region 用户输入框样式-->
<Style x:Key="SearchTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="16"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe602;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<TextBox
Width="200"
Margin="20,0"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource SearchTextBoxStyle}"
TabIndex="1"
Text="{Binding SearchUser}"
Visibility="{Binding IsVisibility}" />

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="操作权限" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="用户名" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding UserLogs}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding UserName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryUserLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding UserName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// UserLogView.xaml 的交互逻辑
/// </summary>
public partial class UserLogView : UserControl
{
public UserLogView()
{
InitializeComponent();
}
}
}

+ 142
- 0
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs Прегледај датотеку

@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Model;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class AlarmViewModel : ObservableObject
{
public AlarmViewModel()
{
ControlCommand = new RelayCommand(() =>
{
if (ControlButText == "报警复位")
{
return;
}
if (ControlButText == "开始查询")
{
var lists = Sqlite<Alarm>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryAlarm.Clear();
foreach (var item in res)
{
HistoryAlarm.Add(item);
}
}
}

});

SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史报警")
{
GetHistoryAlarm();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时报警";
return;
}

if (ButContent == "实时报警")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ControlButText = "报警复位";
ButContent = "历史报警";
return;
}
});

//AlarmInfos = AlarmHelper<tt>.Alarms;
//AlarmHelper<tt>.Init();
}

private void GetHistoryAlarm()
{
var data = Sqlite<Alarm>.GetInstance.GetData();
if (data != null)
{
HistoryAlarm.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryAlarm.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }


public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;


public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;


/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史报警";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";


/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;


public ObservableCollection<Alarm> AlarmInfos { get; set; }

public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();


}



}

+ 81
- 0
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs Прегледај датотеку

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class LoginViewModel : ObservableObject
{
public LoginViewModel()
{
ActionManage.GetInstance.Register(new Action(() => { Login(); }), "EnterLogin", true);
LoginCommand = new RelayCommand(() => { Login(); });

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ExitAction");
});
}

private void Login()
{
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
if (res != null)
{
Global.userInfo.permission = res.permission;
Global.userInfo.UserName = res.UserName;
Global.userInfo.Password = res.Password;
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
}
ActionManage.GetInstance.Send("PermissionChange");
ActionManage.GetInstance.Send("LoginOk");
}
else
{
ErrorInfo = "用户名或密码错误!";
}
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;


public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } }
private string _mUserName = Global.userInfo.UserName;


public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } }
private string _mPassword;


}
}

+ 109
- 0
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs Прегледај датотеку

@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
menuModels = MenuManage.GetInstance.menuModels;
PermissionChange();
ActionManage.GetInstance.Register(new Action(() =>
{
PermissionChange();
}), "PermissionChange");

}

private void PermissionChange()
{
int MainIndex = Array.FindIndex(menuModels.ToArray(), P => P.MainMenuVisibility == Visibility.Visible);
if (MainIndex >= 0 && MainIndex < menuModels.Count)
{
int SubIndex; SubIndex = Array.FindIndex(menuModels.ElementAt(MainIndex).subMenumodels.ToArray(), p => p.SubMenuVisibility == Visibility.Visible);
if (SubIndex >= 0 && SubIndex < menuModels.ElementAt(MainIndex).subMenumodels.Count)
{
DoNavChanged(menuModels.ElementAt(MainIndex).subMenumodels.ElementAt(SubIndex).ToggleWindowPath);
}
}
}

public ObservableCollection<MenuModel> menuModels { get; set; }

private void DoNavChanged(object obj)
{
for (int i = 0; i < menuModels.Count; i++)
{
var res = menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.ToggleWindowPath == obj.ToString());
if (res != null)
{
DisplayName = res.SubMenuName;
var end = res.AssemblyName.Substring(res.AssemblyName.Length - 1);
var start = res.ToggleWindowPath.Substring(0, 1);
bool isAddPoint = end != "." && start != ".";
string point = isAddPoint ? "." : "";
Type type = Assembly.Load(res.AssemblyName)?.GetType($"{res.AssemblyName }{point}{ res.ToggleWindowPath}");
ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
if (type?.BaseType.Name == "Window")
{
((Window)cti?.Invoke(null)).ShowDialog();
break;
}
else if (type?.BaseType.Name == "UserControl")
{
//ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
MainContent = (FrameworkElement)cti?.Invoke(null);
break;
}
}
}
}
private bool _status;
/// <summary>
/// 设备初始化状态
/// </summary>
public bool Status
{
get { return _status; }
set
{
if (value)
{
ActionManage.GetInstance.Send("StartPlcInite");
}
else
{
ActionManage.GetInstance.Send("EndPlcInite");
}
_status = value;
OnPropertyChanged();
}
}
/// <summary>
/// 开机自启
/// </summary>
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
public RelayCommand<object> NavChangedCommand { get; set; }

public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
private FrameworkElement _mMainContent;

public string DisplayName { get { return _mDisplayName; } set { _mDisplayName = value; OnPropertyChanged(); } }
private string _mDisplayName;



}
}

+ 69
- 0
BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs Прегледај датотеку

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class PasswordChangeViewModel : ObservableObject
{
public PasswordChangeViewModel()
{
LoginCommand = new RelayCommand(() =>
{
if (Global.userInfo.Password == OldPassword)
{
if (NewPassword1 == NewPassword2)
{
Global.userInfo.Password = NewPassword2;
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName);
if (index >= 0 && index < Global.userManager.userInfos.Count)
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
Config.GetInstance.SaveUser();
ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
}
else
{
ErrorInfo = "新密码不匹配";
}
}
else
{
ErrorInfo = "原密码错误";
}
});

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PasswordChangeViewCancel");
});
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;

public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } }
private string _mOldPassword;


public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } }
private string _mNewPassword1;


public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
private string _mNewPassword2;


}
}

+ 126
- 0
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs Прегледај датотеку

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RunLogViewModel : ObservableObject
{
public RunLogViewModel()
{
Sqlite<RunLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryRunLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{

if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<RunLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryRunLog.Clear();
foreach (var item in res)
{
HistoryRunLog.Add(item);
}
}
}

});
}

private void GetHistoryRunLog()
{
var data = Sqlite<RunLog>.GetInstance.GetData();
if (data != null)
{
HistoryRunLog.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryRunLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;

public ObservableCollection<RunLog> HistoryRunLog { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<RunLog> Log { get; set; } = MessageLog.GetInstance.runLogs;
}
}

+ 134
- 0
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs Прегледај датотеку

@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class UserLogViewModel : ObservableObject
{
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageLog.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryUserLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{
if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<UserLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
var result = res.Where(p => p.UserName == SearchUser && SearchUser != null && SearchUser.Length > 0).ToList();
var logs = result != null && SearchUser?.Length > 0 ? result : res;
if (logs != null)
{
HistoryUserLog.Clear();
foreach (var item in logs)
{
HistoryUserLog.Add(item);
}
}
}
});
}

private void GetHistoryUserLog()
{
var data = Sqlite<UserLog>.GetInstance.GetData();
var res = data.Where(p => p.UserName == Global.userInfo.UserName).ToList();
if (res != null)
{
HistoryUserLog.Clear();
foreach (var item in res)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryUserLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;


public string SearchUser { get { return _mSearchUser; } set { _mSearchUser = value; OnPropertyChanged(); } }
private string _mSearchUser;


public ObservableCollection<UserLog> HistoryUserLog { get; set; } = new ObservableCollection<UserLog>();

public ObservableCollection<UserLog> UserLogs { get; set; }

}
}

+ 0
- 1
BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml Прегледај датотеку

@@ -215,5 +215,4 @@
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>

+ 1
- 1
BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml Прегледај датотеку

@@ -432,7 +432,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<!-- Set CalendarStyle to DatePickerCalendarStyle. -->
<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" />
<Setter Property="Width" Value="200" />
<Setter Property="Width" Value="130" />
<Setter Property="FontSize" Value="12" />
<!--<Setter Property="Height" Value="30" />-->
<Setter Property="Template">



+ 7
- 4
BPASmartClient.CustomResource/Themes/Generic.xaml Прегледај датотеку

@@ -15,10 +15,6 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>-->
<TextBlock
Name="PART_icoText"
Margin="0,0,10,0"
@@ -37,6 +33,13 @@
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Grid>
<!--<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="PART_br" Property="BorderBrush" Value="{TemplateBinding EnableColor}" />
<Setter TargetName="PART_icoText" Property="Foreground" Value="red" />
<Setter TargetName="PART_content" Property="Foreground" Value="red" />
</Trigger>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter.Value>
</Setter>


Неке датотеке нису приказане због велике количине промена

Loading…
Откажи
Сачувај