提交记录修改Core/Event/ObserverEventHandler.cs+3 −2看文件
新增Core/Models/AppObserver/AppObserverEventArgs.cs+28 −0看文件
修改Core/Servicers/Instances/AppObserver.cs+5 −4看文件
| @@ -1,4 +1,5 @@ | ||
| 1 | 删除:using System; | |
| 1 | 新增:using Core.Models.AppObserver; | |
| 2 | 新增:using System; | |
| 2 | 3 | using System.Collections.Generic; |
| 3 | 4 | using System.Linq; |
| 4 | 5 | using System.Text; |
| @@ -6,5 +7,5 @@ using System.Threading.Tasks; | ||
| 6 | 7 | |
| 7 | 8 | namespace Core.Event |
| 8 | 9 | { |
| 9 | 删除: public delegate void ObserverEventHandler(string processName, string description, string file); | |
| 10 | 新增: public delegate void ObserverEventHandler(AppObserverEventArgs args); | |
| 10 | 11 | } |
| @@ -0,0 +1,28 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace Core.Models.AppObserver | |
| 8 | 新增:{ | |
| 9 | 新增: public class AppObserverEventArgs | |
| 10 | 新增: { | |
| 11 | 新增: private IntPtr _handle; | |
| 12 | 新增: private string _processName; | |
| 13 | 新增: private string _description; | |
| 14 | 新增: private string _file; | |
| 15 | 新增: | |
| 16 | 新增: public string ProcessName { get { return _processName; } } | |
| 17 | 新增: public string Description { get { return _description; } } | |
| 18 | 新增: public string File { get { return _file; } } | |
| 19 | 新增: public IntPtr Handle { get { return _handle; } } | |
| 20 | 新增: public AppObserverEventArgs(string processName, string description, string file, IntPtr handle) | |
| 21 | 新增: { | |
| 22 | 新增: _processName = processName; | |
| 23 | 新增: _description = description; | |
| 24 | 新增: _file = file; | |
| 25 | 新增: _handle = handle; | |
| 26 | 新增: } | |
| 27 | 新增: } | |
| 28 | 新增:} | |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | using Core.Event; |
| 2 | 2 | using Core.Librarys; |
| 3 | 新增:using Core.Models.AppObserver; | |
| 3 | 4 | using Core.Servicers.Interfaces; |
| 4 | 5 | using System; |
| 5 | 6 | using System.Collections.Generic; |
| @@ -40,7 +41,6 @@ namespace Core.Servicers.Instances | ||
| 40 | 41 | |
| 41 | 42 | private async void Handle(IntPtr hwnd) |
| 42 | 43 | { |
| 43 | 删除: Debug.WriteLine(hwnd); | |
| 44 | 44 | string processName = String.Empty, processFileName = String.Empty, processDescription = String.Empty; |
| 45 | 45 | |
| 46 | 46 | var processResult = await Task.Run(() => |
| @@ -102,7 +102,7 @@ namespace Core.Servicers.Instances | ||
| 102 | 102 | return processName; |
| 103 | 103 | }); |
| 104 | 104 | |
| 105 | 删除: EventInvoke(processName, processDescription, processFileName); | |
| 105 | 新增: EventInvoke(processName, processDescription, processFileName, hwnd); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /// <summary> |
| @@ -170,9 +170,10 @@ namespace Core.Servicers.Instances | ||
| 170 | 170 | } |
| 171 | 171 | return new string[] { processName, processFileName, processID.ToString() }; |
| 172 | 172 | } |
| 173 | 删除: private void EventInvoke(string processName, string description, string filename) | |
| 173 | 新增: private void EventInvoke(string processName, string description, string filename, IntPtr handle) | |
| 174 | 174 | { |
| 175 | 删除: OnAppActive?.Invoke(processName, description, filename); | |
| 175 | 新增: var args = new AppObserverEventArgs(processName, description, filename, handle); | |
| 176 | 新增: OnAppActive?.Invoke(args); | |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | public void Stop() |

