├── src ├── ProjectEvent.UI │ ├── Styles │ │ ├── Readme.md │ │ └── Light │ │ │ ├── Base │ │ │ ├── Text.xaml │ │ │ └── ContextMenu.xaml │ │ │ └── Controls.xaml │ ├── Themes │ │ ├── Readme.md │ │ ├── InputGroup │ │ │ └── InputGroup.xaml │ │ ├── ItemSelect │ │ │ └── ItemSelect.xaml │ │ ├── Input │ │ │ └── TextField.xaml │ │ ├── Base │ │ │ └── Icon.xaml │ │ ├── Navigation │ │ │ └── Navigation.xaml │ │ ├── TabContainer │ │ │ └── TabHeaderButton.xaml │ │ ├── PageContainer.xaml │ │ ├── Action │ │ │ └── ActionContainer.xaml │ │ └── IconSelection │ │ │ └── IconSelection.xaml │ ├── Assets │ │ ├── Icons │ │ │ ├── tray.ico │ │ │ ├── icon_max.ico │ │ │ └── icon_max.png │ │ ├── Fonts │ │ │ ├── SegMDL2.ttf │ │ │ └── fabric-icons.ttf │ │ └── Images │ │ │ └── rocket_launch__monochromatic.png │ ├── Services │ │ ├── IEventMangerService.cs │ │ ├── ICallFunctionPipes.cs │ │ ├── IApp.cs │ │ ├── IEventLog.cs │ │ ├── IGroup.cs │ │ ├── IProjects.cs │ │ └── ISettingsService.cs │ ├── Models │ │ ├── DataModels │ │ │ ├── ComBoxActionModel.cs │ │ │ ├── ActionItemModel.cs │ │ │ ├── EventLogModel.cs │ │ │ ├── GroupModel.cs │ │ │ └── ProjectModel.cs │ │ ├── ConditionModels │ │ │ ├── WIFIConnectedEventConditionModel.cs │ │ │ ├── IntervalTimerConditionModel.cs │ │ │ ├── FileChangedConditionModel.cs │ │ │ ├── BluetoothEventConditionModel.cs │ │ │ ├── ProcessCreatedConditionModel.cs │ │ │ └── TimeChangedConditionModel.cs │ │ ├── EventLogPageModel.cs │ │ ├── Settings │ │ │ ├── SettingsModel.cs │ │ │ └── GeneralModel.cs │ │ ├── UINotifyPropertyChanged.cs │ │ ├── IndexPageModel.cs │ │ └── SettingsPageModel.cs │ ├── Controls │ │ ├── Action │ │ │ ├── Models │ │ │ │ ├── ComBoxModel.cs │ │ │ │ ├── DelayActionInputModel.cs │ │ │ │ ├── KeyboardActionInputModel .cs │ │ │ │ ├── OpenURLActionInputModel.cs │ │ │ │ ├── DeleteFileActionInputModel.cs │ │ │ │ ├── ReadFileActionInputModel.cs │ │ │ │ ├── SnippingActionInputModel.cs │ │ │ │ ├── SoundPlayActionInputModel.cs │ │ │ │ ├── GetIPAddressActionInputModel.cs │ │ │ │ ├── SetDeviceVolumeActionInputModel.cs │ │ │ │ ├── JsonDeserializeActionInputModel.cs │ │ │ │ ├── RegexActionInputModel.cs │ │ │ │ ├── KillProcessActionInputModel.cs │ │ │ │ ├── LoopsActionInputModel.cs │ │ │ │ ├── ActionModel.cs │ │ │ │ ├── StartProcessActionInputModel.cs │ │ │ │ ├── WriteFileActionInputModel.cs │ │ │ │ ├── DownloadFileActionInputModel.cs │ │ │ │ ├── DialogActionInputModel.cs │ │ │ │ ├── IFActionInputModel.cs │ │ │ │ ├── SystemNotificationActionInputModel.cs │ │ │ │ ├── HttpRequestActionInputModel.cs │ │ │ │ └── ActionInputModel.cs │ │ │ ├── Types │ │ │ │ └── InputType.cs │ │ │ ├── Data │ │ │ │ ├── GetIPAddressActionData.cs │ │ │ │ ├── IFActionConditionData.cs │ │ │ │ ├── HttpRequestActionData.cs │ │ │ │ └── SystemNotificationActionData.cs │ │ │ └── Builders │ │ │ │ ├── IActionBuilder.cs │ │ │ │ └── ShutdownActionBuilder.cs │ │ ├── InputGroup │ │ │ ├── InputType.cs │ │ │ └── Models │ │ │ │ └── InputModel.cs │ │ ├── TabContainer │ │ │ ├── TabItem.cs │ │ │ └── TabHeaderButton.cs │ │ ├── Input │ │ │ └── InputTypes.cs │ │ ├── Navigation │ │ │ └── Models │ │ │ │ └── NavigationItemModel.cs │ │ ├── Converters │ │ │ └── ToStringConverter.cs │ │ ├── ItemSelect │ │ │ └── Models │ │ │ │ └── ItemModel.cs │ │ ├── Window │ │ │ ├── DefaultWindowCommands.cs │ │ │ └── DialogWindow.xaml │ │ └── Base │ │ │ └── Icon.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Types │ │ └── ToastType.cs │ ├── Views │ │ ├── IndexPage.xaml.cs │ │ ├── EventLogPage.xaml.cs │ │ ├── SettingsPage.xaml.cs │ │ ├── AddEventPage.xaml.cs │ │ └── EventLogPage.xaml │ ├── MainWindow.xaml.cs │ ├── App.xaml │ ├── ViewModels │ │ ├── Command.cs │ │ ├── EventLogPageVM.cs │ │ └── EventCommand.cs │ ├── NotifyIconResources.xaml │ └── Base │ │ └── Color │ │ ├── ColorTypes.cs │ │ └── Colors.cs ├── Librarys │ └── InTheHand.Net.Personal.dll ├── ProjectEvent.Core │ ├── Win32 │ │ ├── KeyboardEventHandler.cs │ │ └── CommonWin32API.cs │ ├── Services │ │ ├── ITaskService.cs │ │ ├── Tasks │ │ │ ├── IFileTaskService.cs │ │ │ ├── IDeviceTaskService.cs │ │ │ ├── IProcessTaskService.cs │ │ │ ├── IBluetoothTaskService.cs │ │ │ ├── IKeyboardTaskService.cs │ │ │ ├── INetworkStatusTaskService.cs │ │ │ └── DeviceTaskService.cs │ │ ├── TimerTask │ │ │ └── ITimerTaskService.cs │ │ ├── EventHandler.cs │ │ ├── IMainService.cs │ │ ├── ContainerEventHandler.cs │ │ ├── ActionInvokeHandler.cs │ │ ├── ITimerService.cs │ │ ├── IEventService.cs │ │ ├── NotificationService.cs │ │ ├── MainService.cs │ │ └── MyNotificationActivator.cs │ ├── Action │ │ ├── Models │ │ │ ├── OpenURLActionParamsModel.cs │ │ │ ├── KeyboardActionParamsModel.cs │ │ │ ├── SoundPlayActionParamsModel.cs │ │ │ ├── DeleteFileActionParamsModel.cs │ │ │ ├── ReadFileActionParamsModel.cs │ │ │ ├── SnippingActionParamsModel.cs │ │ │ ├── JsonDeserializeActionParamsModel.cs │ │ │ ├── SetDeviceVolumeActionParamsModel.cs │ │ │ ├── WriteFileActionParameterModel.cs │ │ │ ├── DelayActionParamsModel.cs │ │ │ ├── DownloadFileParamsModel.cs │ │ │ ├── GetIPAddressActionParamsModel.cs │ │ │ ├── RegexActionParamsModel.cs │ │ │ ├── LoopsActionParamsModel.cs │ │ │ ├── BaseGroupActionParamsModel.cs │ │ │ ├── DialogActionParamsModel.cs │ │ │ ├── ActionResultModel.cs │ │ │ ├── KillProcessActionParamsModel.cs │ │ │ ├── StartProcessActionParamsModel.cs │ │ │ ├── SystemNotificationActionParamsModel.cs │ │ │ ├── IFActionParameterModel.cs │ │ │ ├── HttpRequestActionParameterModel.cs │ │ │ └── ActionModel.cs │ │ ├── Types │ │ │ ├── ResultTypes │ │ │ │ ├── LoopsResultType.cs │ │ │ │ ├── DialogResultType.cs │ │ │ │ ├── RegexResultType.cs │ │ │ │ ├── ReadFileResultType.cs │ │ │ │ ├── DeleteFileResultType.cs │ │ │ │ ├── GetIPAddressResultType.cs │ │ │ │ ├── SnippingResultType.cs │ │ │ │ ├── DownloadFileResultType.cs │ │ │ │ ├── HttpResultType.cs │ │ │ │ └── StartProcessResultType.cs │ │ │ ├── CommonResultKeyType.cs │ │ │ ├── GlobalVariableType.cs │ │ │ ├── ActionInvokeStateType.cs │ │ │ └── IFActionConditionType.cs │ │ ├── Checks │ │ │ ├── ICheck.cs │ │ │ └── WriteFileCheck.cs │ │ ├── Actions │ │ │ ├── IAction.cs │ │ │ ├── DelayAction.cs │ │ │ ├── SetDeviceVolumeAction.cs │ │ │ ├── ShutdownAction.cs │ │ │ ├── LoopsAction.cs │ │ │ ├── OpenURLAction.cs │ │ │ ├── DeleteFileAction.cs │ │ │ ├── WriteFileAction.cs │ │ │ ├── SystemNotificationAction.cs │ │ │ ├── RegexAction.cs │ │ │ ├── ReadFileAction.cs │ │ │ └── JsonDeserializeAction.cs │ │ └── ActionParameterConverter.cs │ ├── Net │ │ ├── HttpClient.cs │ │ ├── Types │ │ │ ├── MethodType.cs │ │ │ └── ParamsType.cs │ │ ├── Models │ │ │ └── HttpResultModel.cs │ │ └── NetworkWatcher.cs │ ├── Event │ │ ├── Structs │ │ │ ├── BluetoothEventDataStruct.cs │ │ │ ├── NetworkStatusDataStruct.cs │ │ │ └── KeyboardEventDataStruct.cs │ │ ├── Types │ │ │ ├── WIFIConnectedEventVariableType.cs │ │ │ ├── NetworkStatusEventVariableType.cs │ │ │ ├── RunGameEventVariableType.cs │ │ │ ├── FileChangedEventVariableType.cs │ │ │ ├── BluetoothEventVariableType.cs │ │ │ ├── KeyboardEventVariableType.cs │ │ │ ├── ProcessCreatedEventVariableType.cs │ │ │ └── EventType.cs │ │ ├── EventLoger.cs │ │ └── Models │ │ │ ├── EventLogModel.cs │ │ │ └── EventModel.cs │ ├── Types │ │ ├── GamePlatformType.cs │ │ ├── PipeCallFunctionType.cs │ │ ├── ToastActionType.cs │ │ ├── IPAddressType.cs │ │ ├── LogLevelType.cs │ │ └── ToastScenarioType.cs │ ├── Condition │ │ ├── Models │ │ │ ├── FileChangedDataModel.cs │ │ │ └── ConditionCheckResultModel.cs │ │ ├── Types │ │ │ └── TimeChangedRepetitionType.cs │ │ ├── ICondition.cs │ │ ├── KeyboardEventCondition.cs │ │ ├── RunGameEventCondition.cs │ │ ├── NetworkStatusEventCondition.cs │ │ ├── WIFIConnectedEventCondition.cs │ │ ├── OnDeviceStartupCondition.cs │ │ ├── OnFileChangedCondition.cs │ │ ├── OnIntervalTimerCondition.cs │ │ ├── BluetoothEventCondition.cs │ │ └── OnProcessCreatedCondition.cs │ ├── Structs │ │ ├── PipeCallFunctionStruct.cs │ │ └── PipeCallFunctionFeedbackStruct.cs │ ├── Extensions │ │ └── ManagementBaseObjectExtentions.cs │ ├── Helper │ │ ├── ObjectConvert.cs │ │ └── AudioHelper.cs │ ├── ProjectEvent.Core.csproj │ └── PipeCallFunction.cs └── NotifyIconWpf │ ├── Properties │ └── AssemblyInfo.cs │ ├── NotifyIconWpf.csproj │ ├── Interop │ ├── Point.cs │ ├── IconState.cs │ ├── NotifyIconVersion.cs │ ├── SystemInfo.cs │ ├── WindowClass.cs │ ├── MouseEvent.cs │ ├── NotifyCommand.cs │ └── BalloonFlags.cs │ └── BalloonIcon.cs ├── privacy.txt ├── .github └── ISSUE_TEMPLATE │ ├── feature-request-----.md │ └── bug-report-----.md ├── LICENSE └── readme.md /src/ProjectEvent.UI/Styles/Readme.md: -------------------------------------------------------------------------------- 1 | 控件主题样式 -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/Readme.md: -------------------------------------------------------------------------------- 1 | 自定义控件模板 -------------------------------------------------------------------------------- /privacy.txt: -------------------------------------------------------------------------------- 1 | ## Personal data we collect / 我们收集的数据 2 | 3 | none. 4 | 完全不收集 5 | -------------------------------------------------------------------------------- /src/Librarys/InTheHand.Net.Personal.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/Librarys/InTheHand.Net.Personal.dll -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Icons/tray.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Icons/tray.ico -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Fonts/SegMDL2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Fonts/SegMDL2.ttf -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Icons/icon_max.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Icons/icon_max.ico -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Icons/icon_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Icons/icon_max.png -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Fonts/fabric-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Fonts/fabric-icons.ttf -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Assets/Images/rocket_launch__monochromatic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Planshit/ProjectEvent/HEAD/src/ProjectEvent.UI/Assets/Images/rocket_launch__monochromatic.png -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Win32/KeyboardEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Win32 6 | { 7 | public delegate void KeyboardEventHandler(int keycode); 8 | } 9 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/IEventMangerService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Services 6 | { 7 | public interface IEventMangerService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/ITaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services 6 | { 7 | public interface ITaskService 8 | { 9 | void Run(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/IFileTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface IFileTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/IDeviceTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface IDeviceTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/IProcessTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface IProcessTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Markup; 2 | 3 | //provides simplified declaration in XAML 4 | [assembly: XmlnsPrefix("http://www.hardcodet.net/taskbar", "tb")] 5 | [assembly: XmlnsDefinition("http://www.hardcodet.net/taskbar", "Hardcodet.Wpf.TaskbarNotification")] -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/IBluetoothTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface IBluetoothTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/IKeyboardTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface IKeyboardTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/TimerTask/ITimerTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.TimerTask 6 | { 7 | public interface ITimerTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/INetworkStatusTaskService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services.Tasks 6 | { 7 | public interface INetworkStatusTaskService : ITaskService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/EventHandler.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Services 7 | { 8 | public delegate void EventHandler(EventModel @event, bool isSuccess); 9 | } 10 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/OpenURLActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class OpenURLActionParamsModel 8 | { 9 | public string URL { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/ICallFunctionPipes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Services 6 | { 7 | public interface ICallFunctionPipes 8 | { 9 | void StartServer(); 10 | void CloseServer(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/KeyboardActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class KeyboardActionParamsModel 8 | { 9 | public string Keys { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/SoundPlayActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class SoundPlayActionParamsModel 8 | { 9 | public string Path { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/DeleteFileActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class DeleteFileActionParamsModel 8 | { 9 | public string Path { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/ReadFileActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class ReadFileActionParamsModel 8 | { 9 | public string FilePath { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/SnippingActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class SnippingActionParamsModel 8 | { 9 | public string SavePath { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Net/HttpClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Net 6 | { 7 | public class HttpClient 8 | { 9 | public static readonly System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/JsonDeserializeActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class JsonDeserializeActionParamsModel 8 | { 9 | public string Content { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/SetDeviceVolumeActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class SetDeviceVolumeActionParamsModel 8 | { 9 | public string Volume { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/IMainService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Services 6 | { 7 | public interface IMainService 8 | { 9 | /// 10 | /// 启动 11 | /// 12 | void Run(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Net/Types/MethodType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Net.Types 6 | { 7 | /// 8 | /// 请求方法 9 | /// 10 | public enum MethodType 11 | { 12 | GET = 1, 13 | POST = 2 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Net/Types/ParamsType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Net.Types 6 | { 7 | /// 8 | /// 参数类型 9 | /// 10 | public enum ParamsType 11 | { 12 | Json = 0, 13 | FormData = 1, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/DataModels/ComBoxActionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.DataModels 6 | { 7 | public class ComBoxActionModel 8 | { 9 | public int ID { get; set; } 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/ComBoxModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Controls.Action.Models 6 | { 7 | public class ComBoxModel 8 | { 9 | public int ID { get; set; } 10 | public string DisplayName { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request-----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 功能建议 3 | about: 我希望增加或调整某个功能 4 | title: "[feature] 我希望能增加/调整..." 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **你的建议** 11 | 我希望能增加/调整... 12 | 13 | **这样做能带来什么改变** 14 | ... 15 | 16 | **你使用这个软件多长时间了** 17 | 少于1周 18 | 少于1个月 19 | 少于1年 20 | 大于1年 21 | 22 | **备注** 23 | ... 24 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/DelayActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class DelayActionInputModel 9 | { 10 | public string Seconds { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/KeyboardActionInputModel .cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class KeyboardActionInputModel 9 | { 10 | public string Keys { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/OpenURLActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class OpenURLActionInputModel 9 | { 10 | public string URL { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/NotifyIconWpf.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/DeleteFileActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class DeleteFileActionInputModel 9 | { 10 | public string Path { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/ReadFileActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class ReadFileActionInputModel 9 | { 10 | public string FilePath { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/SnippingActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class SnippingActionInputModel 9 | { 10 | public string SavePath { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/SoundPlayActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class SoundPlayActionInputModel 9 | { 10 | public string Path { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Structs/BluetoothEventDataStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Structs 6 | { 7 | public struct BluetoothEventDataStruct 8 | { 9 | public string DeviceName { get; set; } 10 | public bool IsConnected { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/WIFIConnectedEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum WIFIConnectedEventVariableType 8 | { 9 | /// 10 | /// wifi名称 11 | /// 12 | SSID 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/LoopsResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum LoopsResultType 8 | { 9 | /// 10 | /// 当前次数 11 | /// 12 | Index = 1, 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/NetworkStatusEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum NetworkStatusEventVariableType 8 | { 9 | /// 10 | /// 网络是否连接 11 | /// 12 | IsConnected 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/GetIPAddressActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class GetIPAddressActionInputModel 9 | { 10 | public ComBoxModel Type { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/SetDeviceVolumeActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class SetDeviceVolumeActionInputModel 9 | { 10 | public string Volume { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/WriteFileActionParameterModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class WriteFileActionParameterModel 8 | { 9 | public string FilePath { get; set; } 10 | 11 | public string Content { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/DialogResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum DialogResultType 8 | { 9 | /// 10 | /// 点击的按钮值 11 | /// 12 | ClickButtonValue 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/RegexResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum RegexResultType 8 | { 9 | /// 10 | /// 匹配成功数 11 | /// 12 | Count = -2, 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/GamePlatformType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Types 6 | { 7 | /// 8 | /// 游戏平台类型 9 | /// 10 | public enum GamePlatformType 11 | { 12 | Steam, 13 | Epic, 14 | Tencent, 15 | Other 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/JsonDeserializeActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class JsonDeserializeActionInputModel 9 | { 10 | public string Content { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/RunGameEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum RunGameEventVariableType 8 | { 9 | /// 10 | /// 游戏所属平台(Steam,Epic,Other) 11 | /// 12 | GamePlatform, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/InputGroup/InputType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Controls.InputGroup 6 | { 7 | public enum InputType 8 | { 9 | Text, 10 | Number, 11 | Date, 12 | Time, 13 | DateTime, 14 | Bool, 15 | Select 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Checks/ICheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Checks 6 | { 7 | public interface ICheck 8 | { 9 | 10 | /// 11 | /// 检查操作是否可执行 12 | /// 13 | /// 14 | bool IsCheck(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/DelayActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class DelayActionParamsModel 8 | { 9 | /// 10 | /// 延迟秒数 11 | /// 12 | public int Seconds { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Structs/NetworkStatusDataStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Structs 6 | { 7 | public struct NetworkStatusDataStruct 8 | { 9 | /// 10 | /// 网络是否连接 11 | /// 12 | public bool IsConnected { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/ContainerEventHandler.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Services 7 | { 8 | public delegate void ContainerEventHandler(EventModel ev); 9 | public delegate void EventChangedHandler(EventModel oldValue, EventModel newValue); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/Models/FileChangedDataModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Condition.Models 7 | { 8 | public class FileChangedDataModel 9 | { 10 | public string WatchPath { get; set; } 11 | public FileSystemEventArgs FileSystemEventArgs { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/RegexActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | 9 | public class RegexActionInputModel 10 | { 11 | public string Content { get; set; } 12 | public string Regex { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/IApp.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models.DataModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Services 7 | { 8 | public interface IApp 9 | { 10 | void Run(); 11 | void Add(ProjectModel project); 12 | void Update(ProjectModel project); 13 | void Remove(int id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Net/Models/HttpResultModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Net.Models 6 | { 7 | public class HttpResultModel 8 | { 9 | public bool IsSuccess { get; set; } = false; 10 | public string Content { get; set; } = string.Empty; 11 | public int StatusCode { get; set; } = 0; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/PipeCallFunctionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Types 6 | { 7 | /// 8 | /// pipe call ui function type 9 | /// 10 | public enum PipeCallFunctionType 11 | { 12 | /// 13 | /// 对话框 14 | /// 15 | Dialog 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/KillProcessActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class KillProcessActionInputModel 9 | { 10 | public string ProcessName { get; set; } 11 | public bool IsFuzzy { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/DownloadFileParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class DownloadFileParamsModel 8 | { 9 | public string Url { get; set; } 10 | public string SavePath { get; set; } 11 | public Dictionary Headers { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/CommonResultKeyType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types 6 | { 7 | /// 8 | /// 通用返回 9 | /// 10 | public enum CommonResultKeyType 11 | { 12 | /// 13 | /// 是否成功(true,false) 14 | /// 15 | IsSuccess = 1 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/LoopsActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | 9 | public class LoopsActionInputModel 10 | { 11 | /// 12 | /// 循环次数 13 | /// 14 | public int Count { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/GetIPAddressActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class GetIPAddressActionParamsModel 9 | { 10 | /// 11 | /// 获取类型 12 | /// 13 | public IPAddressType Type { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/ToastActionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Types 6 | { 7 | public enum ToastActionType 8 | { 9 | /// 10 | /// 默认启动程序或显示主窗口 11 | /// 12 | Default = 0, 13 | /// 14 | /// 打开URL 15 | /// 16 | Url = 1, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/RegexActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class RegexActionParamsModel 8 | { 9 | public string Content { get; set; } 10 | /// 11 | /// 正则表达式(不支持任何变量 12 | /// 13 | public string Regex { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Structs/PipeCallFunctionStruct.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Structs 7 | { 8 | public struct PipeCallFunctionStruct 9 | { 10 | public int ID { get; set; } 11 | public PipeCallFunctionType CallFunctionType { get; set; } 12 | public object Data { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/TabContainer/TabItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Controls; 5 | 6 | namespace ProjectEvent.UI.Controls.TabContainer 7 | { 8 | public class TabItem : ContentControl 9 | { 10 | public string Title { get; set; } 11 | public TabItem() 12 | { 13 | DefaultStyleKey = typeof(TabItem); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/FileChangedEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum FileChangedEventVariableType 8 | { 9 | /// 10 | /// 变化类型 11 | /// 12 | Type, 13 | /// 14 | /// 文件路径 15 | /// 16 | Path 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/GlobalVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types 6 | { 7 | public enum GlobalVariableType 8 | { 9 | /// 10 | /// 当前时间戳(秒) 11 | /// 12 | Timestamp, 13 | /// 14 | /// 当前用户名 15 | /// 16 | CurrentUserName, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/LoopsActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class LoopsActionParamsModel : BaseGroupActionParamsModel 9 | { 10 | /// 11 | /// 循环次数(为0时永远循环) 12 | /// 13 | public int Count { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Structs/PipeCallFunctionFeedbackStruct.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Structs 7 | { 8 | public struct PipeCallFunctionFeedbackStruct 9 | { 10 | public int ID { get; set; } 11 | public PipeCallFunctionType CallFunctionType { get; set; } 12 | public object FeedbackData { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/ActionInvokeHandler.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using ProjectEvent.Core.Event.Models; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Services 8 | { 9 | public delegate void ActionInvokeHandler(int taskID, int actionID, ActionInvokeStateType state); 10 | public delegate void ActionsInvokeHandler(int taskID, ActionInvokeStateType state); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/ReadFileResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum ReadFileResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// 读取内容 15 | /// 16 | Content = 2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/BluetoothEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum BluetoothEventVariableType 8 | { 9 | /// 10 | /// 设备名称 11 | /// 12 | DeviceName, 13 | /// 14 | /// 是否连接(True,Flase) 15 | /// 16 | IsConnected, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/BaseGroupActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | /// 8 | /// 组类型的action基础类 9 | /// 10 | public class BaseGroupActionParamsModel 11 | { 12 | /// 13 | /// 组内的action 14 | /// 15 | public List Actions { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/DeleteFileResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum DeleteFileResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// 被删除文件路径 15 | /// 16 | Path = 2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/GetIPAddressResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum GetIPAddressResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// ip地址 15 | /// 16 | IP = 2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/SnippingResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum SnippingResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// 保持路径 15 | /// 16 | SavePath = 2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/ActionModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using ProjectEvent.UI.Models.DataModels; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.UI.Controls.Action.Models 9 | { 10 | public class ActionModel : UINotifyPropertyChanged 11 | { 12 | public ObservableCollection Actions { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/StartProcessActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | /// 9 | /// 启动进程action输入UI模型 10 | /// 11 | public class StartProcessActionInputModel 12 | { 13 | public string Path { get; set; } 14 | public string Args { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/WriteFileActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | /// 9 | /// 写文件action输入UI模型 10 | /// 11 | public class WriteFileActionInputModel 12 | { 13 | public string FilePath { get; set; } 14 | public string Content { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/DownloadFileResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum DownloadFileResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// 文件保存地址 15 | /// 16 | SavePath = 2 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/IPAddressType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Types 6 | { 7 | /// 8 | /// IP地址类型 9 | /// 10 | public enum IPAddressType 11 | { 12 | /// 13 | /// 内网IP 14 | /// 15 | LocalIPV4, 16 | /// 17 | /// 公网IP 18 | /// 19 | PublicIPV4 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/IEventLog.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models.DataModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Services 7 | { 8 | public interface IEventLog 9 | { 10 | void Listen(); 11 | void Save(); 12 | /// 13 | /// 获取最近的一些日志 14 | /// 15 | /// 16 | List GetEventLogs(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/DownloadFileActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class DownloadFileActionInputModel 9 | { 10 | public string Url { get; set; } 11 | 12 | public string SavePath { get; set; } 13 | public Dictionary Headers { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/IGroup.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models.DataModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Services 7 | { 8 | public interface IGroup 9 | { 10 | void Load(); 11 | GroupModel Add(GroupModel group); 12 | void Delete(int gid); 13 | void Update(GroupModel group); 14 | List GetGroups(); 15 | GroupModel GetGroup(int id); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report-----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 问题反馈 3 | about: 软件出现了问题 4 | title: "[bug] 软件有问题" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **简单描述问题** 11 | 软件发生了什么问题? 12 | 13 | **复现步骤** 14 | 怎样操作这个问题才会出现: 15 | 1. 启动软件 16 | 2. 点击 '....' 17 | 3. ... 18 | 19 | **截图或视频** 20 | ... 21 | 22 | **软件版本** 23 | 在设置>关于中可以查看 24 | 核心程序集版本号: 25 | UI程序集版本号: 26 | 27 | **系统信息** 28 | - 版本:win10家庭版 29 | - 操作系统版本:19041 30 | - 设备:普通台式机/Surface Book 3/ThinkPad T430 31 | 32 | **备注** 33 | ... 34 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/DialogActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class DialogActionParamsModel 9 | { 10 | public string Title { get; set; } 11 | public string Content { get; set; } 12 | public string Image { get; set; } 13 | public Dictionary Buttons { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/ActionResultModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class ActionResultModel 8 | { 9 | public int ID { get; set; } 10 | 11 | //public Dictionary Result { get; set; } 12 | public Dictionary Result { get; set; } 13 | 14 | //public Dictionary Result { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/DialogActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class DialogActionInputModel 9 | { 10 | public string Title { get; set; } 11 | public string Content { get; set; } 12 | public string Image { get; set; } 13 | public Dictionary Buttons { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/KillProcessActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class KillProcessActionParamsModel 8 | { 9 | /// 10 | /// 进程名称 11 | /// 12 | public string ProcessName { get; set; } 13 | /// 14 | /// 模糊匹配 15 | /// 16 | public bool IsFuzzy { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/StartProcessActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Models 6 | { 7 | public class StartProcessActionParamsModel 8 | { 9 | /// 10 | /// 进程路径 11 | /// 12 | public string Path { get; set; } 13 | /// 14 | /// 参数(可选) 15 | /// 16 | public string Args{ get; set; } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/IFActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | /// 9 | /// if action输入UI模型 10 | /// 11 | public class IFActionInputModel 12 | { 13 | public string Left { get; set; } 14 | public string Right { get; set; } 15 | public ComBoxModel Condition { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/WIFIConnectedEventConditionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.ConditionModels 6 | { 7 | public class WIFIConnectedEventConditionModel : UINotifyPropertyChanged 8 | { 9 | private string SSID_; 10 | public string SSID 11 | { 12 | get { return SSID_; } 13 | set { SSID_ = value; OnPropertyChanged(); } 14 | } 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/EventLogPageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models 6 | { 7 | public class EventLogPageModel : UINotifyPropertyChanged 8 | { 9 | private string Log_; 10 | public string Log 11 | { 12 | get { return Log_; } 13 | set 14 | { 15 | Log_ = value; 16 | OnPropertyChanged(); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/KeyboardEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum KeyboardEventVariableType 8 | { 9 | /// 10 | /// 动作:up释放按键,down按下按键 11 | /// 12 | Action, 13 | /// 14 | /// 键名 15 | /// 16 | KeyName, 17 | /// 18 | /// 键码 19 | /// 20 | KeyCode 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/Point.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 4 | { 5 | /// 6 | /// Win API struct providing coordinates for a single point. 7 | /// 8 | [StructLayout(LayoutKind.Sequential)] 9 | public struct Point 10 | { 11 | /// 12 | /// X coordinate. 13 | /// 14 | public int X; 15 | /// 16 | /// Y coordinate. 17 | /// 18 | public int Y; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/LogLevelType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Types 6 | { 7 | /// 8 | /// 日志等级 9 | /// 10 | public enum LogLevelType 11 | { 12 | /// 13 | /// 调试 14 | /// 15 | DEBUG, 16 | /// 17 | /// 错误 18 | /// 19 | ERROR, 20 | /// 21 | /// 警告 22 | /// 23 | WARNING 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/HttpResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | public enum HttpResultType 8 | { 9 | /// 10 | /// 是否成功 11 | /// 12 | IsSuccess = 1, 13 | /// 14 | /// 响应内容 15 | /// 16 | Content = 2, 17 | /// 18 | /// 状态码 19 | /// 20 | StatusCode = 3 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Input/InputTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Controls.Input 6 | { 7 | /// 8 | /// 输入框类型 9 | /// 10 | public enum InputTypes 11 | { 12 | /// 13 | /// 文本 14 | /// 15 | Text, 16 | /// 17 | /// 数字 18 | /// 19 | Number, 20 | /// 21 | /// 日期时间 22 | /// 23 | DateTime 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Styles/Light/Base/Text.xaml: -------------------------------------------------------------------------------- 1 | 4 | 10 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/Models/ConditionCheckResultModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Condition.Models 6 | { 7 | /// 8 | /// 条件检查返回模型,在执行条件检查时返回。校验条件是否正确 9 | /// 10 | public class ConditionCheckResultModel 11 | { 12 | /// 13 | /// 是否正确 14 | /// 15 | public bool IsValid { get; set; } 16 | /// 17 | /// 消息 18 | /// 19 | public string Msg { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ActionInvokeStateType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types 6 | { 7 | /// 8 | /// action执行状态 9 | /// 10 | public enum ActionInvokeStateType 11 | { 12 | /// 13 | /// 运行中 14 | /// 15 | Runing, 16 | /// 17 | /// 完成 18 | /// 19 | Done, 20 | /// 21 | /// 繁忙 22 | /// 23 | Busy 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/DataModels/ActionItemModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Base; 2 | using ProjectEvent.UI.Types; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Models.DataModels 8 | { 9 | public class ActionItemModel 10 | { 11 | public int ID { get; set; } 12 | public string ActionName { get; set; } 13 | public IconTypes Icon { get; set; } 14 | public int Index { get; set; } 15 | public ActionType ActionType { get; set; } 16 | public int ParentID { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/DataModels/EventLogModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.DataModels 6 | { 7 | public class EventLogModel 8 | { 9 | /// 10 | /// 日志ID 11 | /// 12 | public long ID { get; set; } 13 | /// 14 | /// 项目ID 15 | /// 16 | public int ProjectID { get; set; } 17 | /// 18 | /// 触发时间 19 | /// 20 | public DateTime Time { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/IAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Services; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ProjectEvent.Core.Action.Actions 10 | { 11 | public interface IAction 12 | { 13 | System.Action GenerateAction(int taskID, ActionModel action); 14 | /// 15 | /// 当action状态发生变化时 16 | /// 17 | event ActionInvokeHandler OnEventStateChanged; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/IconState.cs: -------------------------------------------------------------------------------- 1 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 2 | { 3 | /// 4 | /// The state of the icon - can be set to 5 | /// hide the icon. 6 | /// 7 | public enum IconState 8 | { 9 | /// 10 | /// The icon is visible. 11 | /// 12 | Visible = 0x00, 13 | 14 | /// 15 | /// Hide the icon. 16 | /// 17 | Hidden = 0x01, 18 | 19 | // The icon is shared - currently not supported, thus commented out. 20 | //Shared = 0x02 21 | } 22 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/Types/TimeChangedRepetitionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Condition.Types 6 | { 7 | /// 8 | /// 重复方式 9 | /// 10 | public enum TimeChangedRepetitionType 11 | { 12 | /// 13 | /// 不重复 14 | /// 15 | None = 1, 16 | /// 17 | /// 每天 18 | /// 19 | Day = 2, 20 | /// 21 | /// 每周 22 | /// 23 | Week = 3 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/IProjects.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models.DataModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Services 7 | { 8 | public interface IProjects 9 | { 10 | void LoadProjects(); 11 | bool Add(ProjectModel project, bool isSave = true); 12 | void Update(ProjectModel project); 13 | void Delete(int ID); 14 | List GetProjects(); 15 | ProjectModel GetProject(int ID); 16 | List GetProjects(int GID); 17 | int GetCreateID(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/ICondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Condition 7 | { 8 | public interface ICondition 9 | { 10 | /// 11 | /// 判断当前是否满足执行条件 12 | /// 13 | /// true是,false否 14 | bool IsPass(object data = null); 15 | 16 | /// 17 | /// 提供给外部检查条件是否输入正确 18 | /// 19 | /// 20 | ConditionCheckResultModel Check(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/Settings/SettingsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.Settings 6 | { 7 | public class SettingsModel 8 | { 9 | /// 10 | /// 常规设置 11 | /// 12 | public GeneralModel General { get; set; } 13 | /// 14 | /// UI程序版本号 15 | /// 16 | public string UIVersion { get; set; } 17 | /// 18 | /// 核心程序版本号 19 | /// 20 | public string CoreVersion { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/SystemNotificationActionParamsModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class SystemNotificationActionParamsModel 9 | { 10 | public string Title { get; set; } 11 | public string Content { get; set; } 12 | public ToastScenarioType ToastScenarioType { get; set; } 13 | public string Icon { get; set; } 14 | public ToastActionType ToastActionType { get; set; } 15 | public string Url { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/ResultTypes/StartProcessResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types.ResultTypes 6 | { 7 | /// 8 | /// 启动进程操作返回类型 9 | /// 10 | public enum StartProcessResultType 11 | { 12 | /// 13 | /// 是否成功 14 | /// 15 | IsSuccess = 1, 16 | /// 17 | /// 句柄 18 | /// 19 | Handle = 2, 20 | /// 21 | /// 进程id 22 | /// 23 | Id 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Structs/KeyboardEventDataStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Structs 6 | { 7 | public struct KeyboardEventDataStruct 8 | { 9 | /// 10 | /// 操作up抬起,down按下 11 | /// 12 | public string Action { get; set; } 13 | /// 14 | /// 按键名字符串 15 | /// 16 | public string KeyName { get; set; } 17 | /// 18 | /// 按键虚拟键码 19 | /// 20 | public int KeyCode { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/SystemNotificationActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class SystemNotificationActionInputModel 9 | { 10 | public string Title { get; set; } 11 | public string Content { get; set; } 12 | public ComBoxModel ToastScenarioType { get; set; } 13 | public string Icon { get; set; } 14 | public ComBoxModel ToastActionType { get; set; } 15 | public string Url { get; set; } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] 4 | 5 | // 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅 6 | // https://aka.ms/assembly-info-properties 7 | 8 | 9 | // 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible 10 | // 属性设置为 true。 11 | 12 | [assembly: ComVisible(false)] 13 | 14 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。 15 | 16 | [assembly: Guid("61cfe2cb-1ebe-42c1-bf15-8498eaee2724")] 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Types/ToastType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Types 6 | { 7 | /// 8 | /// 提醒类型 9 | /// 10 | public enum ToastType 11 | { 12 | /// 13 | /// 成功 14 | /// 15 | Success, 16 | /// 17 | /// 失败 18 | /// 19 | Failed, 20 | /// 21 | /// 警告 22 | /// 23 | Warning, 24 | /// 25 | /// 一般 26 | /// 27 | Normal 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/Settings/GeneralModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.Settings 6 | { 7 | public class GeneralModel : UINotifyPropertyChanged 8 | { 9 | private bool IsDeviceStartupRun_; 10 | /// 11 | /// 是否启用开机启动 12 | /// 13 | public bool IsDeviceStartupRun 14 | { 15 | get { return IsDeviceStartupRun_; } 16 | set 17 | { 18 | IsDeviceStartupRun_ = value; 19 | OnPropertyChanged(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/ProcessCreatedEventVariableType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | public enum ProcessCreatedEventVariableType 8 | { 9 | /// 10 | /// 进程名称 11 | /// 12 | ProcessName, 13 | /// 14 | /// 执行路径 15 | /// 16 | ExecutablePath, 17 | /// 18 | /// 句柄 19 | /// 20 | Handle, 21 | /// 22 | /// 命令行参数 23 | /// 24 | CommandLine 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Services/ISettingsService.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models.Settings; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Services 7 | { 8 | public interface ISettingsService 9 | { 10 | void Load(); 11 | /// 12 | /// 更新程序设置 13 | /// 14 | /// 模块类型 15 | /// 模块数据 16 | void Update(T model); 17 | /// 18 | /// 获取程序设置 19 | /// 20 | /// 21 | SettingsModel GetSettings(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Navigation/Models/NavigationItemModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Base.Color; 2 | using ProjectEvent.UI.Controls.Base; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Controls.Navigation.Models 8 | { 9 | public class NavigationItemModel 10 | { 11 | public int ID { get; set; } 12 | public string Title { get; set; } 13 | public IconTypes Icon { get; set; } 14 | public ColorTypes IconColor { get; set; } 15 | public string BadgeText { get; set; } 16 | public string Uri { get; set; } 17 | //public bool IsSelected { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/KeyboardEventCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class KeyboardEventCondition : ICondition 10 | { 11 | public ConditionCheckResultModel Check() 12 | { 13 | //特殊事件直接通过 14 | var result = new ConditionCheckResultModel(); 15 | result.IsValid = true; 16 | return result; 17 | } 18 | 19 | public bool IsPass(object data = null) 20 | { 21 | //特殊事件直接通过 22 | return true; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/RunGameEventCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class RunGameEventCondition : ICondition 10 | { 11 | public ConditionCheckResultModel Check() 12 | { 13 | //特殊事件直接通过 14 | var result = new ConditionCheckResultModel(); 15 | result.IsValid = true; 16 | return result; 17 | } 18 | 19 | public bool IsPass(object data = null) 20 | { 21 | //特殊事件直接通过 22 | return true; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Views/IndexPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace ProjectEvent.UI.Views 15 | { 16 | /// 17 | /// IndexPage.xaml 的交互逻辑 18 | /// 19 | public partial class IndexPage : Page 20 | { 21 | public IndexPage() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Window; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Shapes; 13 | 14 | namespace ProjectEvent.UI 15 | { 16 | /// 17 | /// MainWindow.xaml 的交互逻辑 18 | /// 19 | public partial class MainWindow : DefaultWindow 20 | { 21 | public MainWindow() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/IntervalTimerConditionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.ConditionModels 6 | { 7 | public class IntervalTimerConditionModel : UINotifyPropertyChanged 8 | { 9 | private string Second_ = "60"; 10 | public string Second 11 | { 12 | get { return Second_; } 13 | set { Second_ = value; OnPropertyChanged(); } 14 | } 15 | 16 | private string Num_ = "1"; 17 | public string Num 18 | { 19 | get { return Num_; } 20 | set { Num_ = value; OnPropertyChanged(); } 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/NetworkStatusEventCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class NetworkStatusEventCondition : ICondition 10 | { 11 | public ConditionCheckResultModel Check() 12 | { 13 | //特殊事件直接通过 14 | var result = new ConditionCheckResultModel(); 15 | result.IsValid = true; 16 | return result; 17 | } 18 | 19 | public bool IsPass(object data = null) 20 | { 21 | //特殊事件直接通过 22 | return true; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Views/EventLogPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace ProjectEvent.UI.Views 15 | { 16 | /// 17 | /// EventLogPage.xaml 的交互逻辑 18 | /// 19 | public partial class EventLogPage : Page 20 | { 21 | public EventLogPage() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Views/SettingsPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace ProjectEvent.UI.Views 15 | { 16 | /// 17 | /// SettingsPage.xaml 的交互逻辑 18 | /// 19 | public partial class SettingsPage : Page 20 | { 21 | public SettingsPage() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/FileChangedConditionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.ConditionModels 6 | { 7 | public class FileChangedConditionModel : UINotifyPropertyChanged 8 | { 9 | private string WatchPath_; 10 | public string WatchPath 11 | { 12 | get { return WatchPath_; } 13 | set { WatchPath_ = value; OnPropertyChanged(); } 14 | } 15 | private string Extname_ = "*.*"; 16 | public string Extname 17 | { 18 | get { return Extname_; } 19 | set { Extname_ = value; OnPropertyChanged(); } 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/IFActionParameterModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class IFActionParameterModel 9 | { 10 | //public BaseIFActionInputModel LeftInput { get; set; } 11 | //public BaseIFActionInputModel RightInput { get; set; } 12 | public string LeftInput { get; set; } 13 | public string RightInput { get; set; } 14 | public IFActionConditionType Condition { get; set; } 15 | 16 | public List PassActions { get; set; } 17 | 18 | public List NoPassActions { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/HttpRequestActionParameterModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Net.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class HttpRequestActionParameterModel 9 | { 10 | public string Url { get; set; } 11 | public int Timeout { get; set; } 12 | public Dictionary Headers { get; set; } 13 | public Dictionary QueryParams { get; set; } 14 | public Dictionary Files { get; set; } 15 | public ParamsType ParamsType { get; set; } 16 | public MethodType Method { get; set; } 17 | public string JsonStr { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/InputGroup/Models/InputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Action.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace ProjectEvent.UI.Controls.InputGroup.Models 8 | { 9 | public class InputModel 10 | { 11 | public InputType Type { get; set; } 12 | public string BindingName { get; set; } 13 | public string Placeholder { get; set; } 14 | 15 | public DependencyProperty BindingProperty { get; set; } 16 | public string Title { get; set; } 17 | /// 18 | /// 可选择项(仅输入类型是select时有效) 19 | /// 20 | public List SelectItems { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Types/ToastScenarioType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Types 6 | { 7 | public enum ToastScenarioType 8 | { 9 | /// 10 | /// 默认 11 | /// 12 | Default, 13 | /// 14 | /// 提醒通知。 这类通知将以预先展开的状态显示在用户屏幕上并一直显示,直至消失。 15 | /// 16 | Reminder, 17 | /// 18 | /// 警报通知。 这类通知将以预先展开的状态显示在用户屏幕上并一直显示,直至消失。 音频在默认情况下将循环播放,并将使用警报音频。 19 | /// 20 | Alarm, 21 | /// 22 | /// 来电通知。 这将以特殊通话格式以预先展开的形式显示在用户屏幕上并一直显示,直至消失。 音频在默认情况下将循环播放,并将使用铃声音频。 23 | /// 24 | IncomingCall 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/UINotifyPropertyChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Runtime.CompilerServices; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Models 8 | { 9 | public class UINotifyPropertyChanged : INotifyPropertyChanged 10 | { 11 | public event PropertyChangedEventHandler PropertyChanged; 12 | 13 | public void OnPropertyChanged([CallerMemberName]string propertyName = "") 14 | { 15 | 16 | PropertyChangedEventHandler handler = PropertyChanged; 17 | if (handler != null) 18 | { 19 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName)); 20 | } 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Converters/ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | using System.Windows.Data; 6 | 7 | namespace ProjectEvent.UI.Controls.Converters 8 | { 9 | [ValueConversion(typeof(object), typeof(string))] 10 | public class ToStringConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return value == null ? null : value.ToString(); 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/ItemSelect/Models/ItemModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Base.Color; 2 | using ProjectEvent.UI.Controls.Base; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Controls.ItemSelect.Models 8 | { 9 | public class ItemModel 10 | { 11 | public int ID { get; set; } 12 | public string Title { get; set; } 13 | public string Tag { get; set; } = string.Empty; 14 | 15 | public string Description { get; set; } = string.Empty; 16 | public string ImageUri { get; set; } 17 | public IconTypes Icon { get; set; } = IconTypes.AppIconDefault; 18 | public bool IsSelected { get; set; } 19 | public ColorTypes Color { get; set; } = ColorTypes.White; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/EventLoger.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event.Models; 2 | using ProjectEvent.Core.Event.Types; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Event 9 | { 10 | public static class EventLoger 11 | { 12 | private static List _logs = new List(); 13 | 14 | public static void Add(EventLogModel eventLog) 15 | { 16 | eventLog.ID = _logs.Count + 1; 17 | eventLog.Time = DateTime.Now; 18 | _logs.Add(eventLog); 19 | } 20 | 21 | public static List Get(EventType eventType) 22 | { 23 | return _logs.Where(m => m.EventType == eventType).ToList(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/DataModels/GroupModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Base; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Models.DataModels 7 | { 8 | /// 9 | /// 分组数据模型 10 | /// 11 | public class GroupModel 12 | { 13 | /// 14 | /// 分组ID 15 | /// 16 | public int ID { get; set; } 17 | /// 18 | /// 分组名称 19 | /// 20 | public string Name { get; set; } 21 | /// 22 | /// 分组图标 23 | /// 24 | public IconTypes Icon { get; set; } 25 | /// 26 | /// 排序 27 | /// 28 | public int Index { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Extensions/ManagementBaseObjectExtentions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Extensions 6 | { 7 | public static class ManagementBaseObjectExtentions 8 | { 9 | public static string TryGetProperty(this System.Management.ManagementBaseObject wmiObj, string propertyName) 10 | { 11 | string retval; 12 | try 13 | { 14 | var p = wmiObj.GetPropertyValue(propertyName); 15 | retval = p != null ? p.ToString() : string.Empty; 16 | } 17 | catch (System.Management.ManagementException) 18 | { 19 | retval = string.Empty; 20 | } 21 | return retval; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Types/InputType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Controls.Action.Types 6 | { 7 | public enum InputType 8 | { 9 | /// 10 | /// 文本输入 11 | /// 12 | Text, 13 | /// 14 | /// 下拉选择 15 | /// 16 | Select, 17 | /// 18 | /// 自定义键值 19 | /// 20 | CustomKeyValue, 21 | /// 22 | /// 数字 23 | /// 24 | Number, 25 | /// 26 | /// 单选 27 | /// 28 | Bool, 29 | /// 30 | /// 多行文本输入 31 | /// 32 | MultiLineText, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Models/ActionModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Action.Models 7 | { 8 | public class ActionModel 9 | { 10 | /// 11 | /// action id 12 | /// 13 | public int ID { get; set; } 14 | /// 15 | /// 执行次数 16 | /// 17 | public int Num { get; set; } 18 | 19 | /// 20 | /// 执行操作 21 | /// 22 | public ActionType Action { get; set; } 23 | 24 | /// 25 | /// 操作参数 26 | /// 27 | public object Parameter { get; set; } 28 | //public BaseParameterModel Parameter { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Views/AddEventPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace ProjectEvent.UI.Views 15 | { 16 | /// 17 | /// AddEventPage.xaml 的交互逻辑 18 | /// 19 | public partial class AddEventPage : Page 20 | { 21 | public AddEventPage() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) 27 | { 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Models/EventLogModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Event.Models 7 | { 8 | /// 9 | /// 事件日志模型 10 | /// 11 | public class EventLogModel 12 | { 13 | public int ID { get; set; } 14 | /// 15 | /// 执行时间 16 | /// 17 | public DateTime Time { get; set; } 18 | /// 19 | /// 是否成功 20 | /// 21 | public bool IsSuccess { get; set; } 22 | /// 23 | /// 事件类型 24 | /// 25 | public EventType EventType { get; set; } 26 | /// 27 | /// 自定义标签 28 | /// 29 | public object Tag { get; set; } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/NotifyIconVersion.cs: -------------------------------------------------------------------------------- 1 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 2 | { 3 | /// 4 | /// The notify icon version that is used. The higher 5 | /// the version, the more capabilities are available. 6 | /// 7 | public enum NotifyIconVersion 8 | { 9 | /// 10 | /// Default behavior (legacy Win95). Expects 11 | /// a size of 488. 12 | /// 13 | Win95 = 0x0, 14 | 15 | /// 16 | /// Behavior representing Win2000 an higher. Expects 17 | /// a size of 504. 18 | /// 19 | Win2000 = 0x3, 20 | 21 | /// 22 | /// Extended tooltip support, which is available 23 | /// for Vista and later. 24 | /// 25 | Vista = 0x4 26 | } 27 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Checks/WriteFileCheck.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using ProjectEvent.Core.Action.Models; 3 | using ProjectEvent.Core.Helper; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Action.Checks 9 | { 10 | public class WriteFileCheck : ICheck 11 | { 12 | private readonly object parameter; 13 | public WriteFileCheck(object parameter) 14 | { 15 | this.parameter = parameter; 16 | } 17 | public bool IsCheck() 18 | { 19 | var p = ObjectConvert.Get(parameter); 20 | if (p == null) 21 | { 22 | return false; 23 | } 24 | else if (p.FilePath == string.Empty) 25 | { 26 | return false; 27 | } 28 | return true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/WIFIConnectedEventCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class WIFIConnectedEventCondition : ICondition 10 | { 11 | /// 12 | /// 连接指定WIFI名称 13 | /// 14 | public string SSID { get; set; } 15 | public ConditionCheckResultModel Check() 16 | { 17 | //特殊事件直接通过 18 | var result = new ConditionCheckResultModel(); 19 | result.IsValid = true; 20 | return result; 21 | } 22 | 23 | public bool IsPass(object data = null) 24 | { 25 | var filterSSID = data != null ? data.ToString() : string.Empty; 26 | return string.IsNullOrEmpty(SSID) || SSID == filterSSID; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Styles/Light/Controls.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/BluetoothEventConditionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.ConditionModels 6 | { 7 | public class BluetoothEventConditionModel : UINotifyPropertyChanged 8 | { 9 | private string DeviceName_; 10 | public string DeviceName 11 | { 12 | get { return DeviceName_; } 13 | set { DeviceName_ = value; OnPropertyChanged(); } 14 | } 15 | 16 | private bool Caseinsensitive_; 17 | public bool Caseinsensitive 18 | { 19 | get { return Caseinsensitive_; } 20 | set { Caseinsensitive_ = value; OnPropertyChanged(); } 21 | } 22 | private bool FuzzyMatch_; 23 | public bool FuzzyMatch 24 | { 25 | get { return FuzzyMatch_; } 26 | set { FuzzyMatch_ = value; OnPropertyChanged(); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/ProcessCreatedConditionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Models.ConditionModels 6 | { 7 | public class ProcessCreatedConditionModel : UINotifyPropertyChanged 8 | { 9 | private string ProcessName_; 10 | public string ProcessName 11 | { 12 | get { return ProcessName_; } 13 | set { ProcessName_ = value; OnPropertyChanged(); } 14 | } 15 | 16 | private bool Caseinsensitive_; 17 | public bool Caseinsensitive 18 | { 19 | get { return Caseinsensitive_; } 20 | set { Caseinsensitive_ = value; OnPropertyChanged(); } 21 | } 22 | private bool FuzzyMatch_; 23 | public bool FuzzyMatch 24 | { 25 | get { return FuzzyMatch_; } 26 | set { FuzzyMatch_ = value; OnPropertyChanged(); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/OnDeviceStartupCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class OnDeviceStartupCondition : ICondition 10 | { 11 | 12 | public ConditionCheckResultModel Check() 13 | { 14 | //开机启动不需要输入条件,直接通过 15 | var result = new ConditionCheckResultModel(); 16 | result.IsValid = true; 17 | return result; 18 | } 19 | 20 | public bool IsPass(object data = null) 21 | { 22 | Windows.ApplicationModel.Activation.IActivatedEventArgs args = 23 | global::Windows.ApplicationModel.AppInstance.GetActivatedEventArgs(); 24 | return args.Kind == Windows.ApplicationModel.Activation.ActivationKind.StartupTask; 25 | //return Environment.GetCommandLineArgs().Contains("-autorun");//注册表 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Models/EventModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Condition; 3 | using ProjectEvent.Core.Event.Types; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Event.Models 9 | { 10 | public class EventModel 11 | { 12 | public int ID { get; set; } 13 | public bool IsEnabled { get; set; } 14 | public string Name { get; set; } 15 | public EventType EventType { get; set; } 16 | public ICondition Condition { get; set; } 17 | 18 | public List Actions { get; set; } 19 | 20 | public EventModel Copy() 21 | { 22 | return new EventModel() 23 | { 24 | ID = ID, 25 | Actions = Actions, 26 | Condition = Condition, 27 | EventType = EventType, 28 | IsEnabled = IsEnabled, 29 | Name = Name 30 | }; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/ConditionModels/TimeChangedConditionModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Types; 2 | using ProjectEvent.UI.Controls.Action.Models; 3 | using ProjectEvent.UI.Event; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.UI.Models.ConditionModels 9 | { 10 | public class TimeChangedConditionModel : UINotifyPropertyChanged 11 | { 12 | private DateTime Time_ = DateTime.Now; 13 | public DateTime Time 14 | { 15 | get { return Time_; } 16 | set { Time_ = value; OnPropertyChanged(); } 17 | } 18 | 19 | private ComBoxModel RepetitionType_ = new ComBoxModel() 20 | { 21 | ID = (int)TimeChangedRepetitionType.None, 22 | DisplayName = "不重复" 23 | }; 24 | public ComBoxModel RepetitionType 25 | { 26 | get { return RepetitionType_; } 27 | set { RepetitionType_ = value; OnPropertyChanged(); } 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/ViewModels/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Input; 5 | 6 | namespace ProjectEvent.UI.ViewModels 7 | { 8 | public class Command : ICommand 9 | { 10 | private Action _action; 11 | 12 | public Command(Action action) 13 | { 14 | _action = action; 15 | } 16 | 17 | 18 | #region ICommand Members 19 | public bool CanExecute(object parameter) 20 | { 21 | return true; 22 | } 23 | public event EventHandler CanExecuteChanged; 24 | public void Execute(object parameter) 25 | { 26 | _action(parameter); 27 | OnExecuted(); 28 | } 29 | public delegate void ExecutedHandler(object parameter); 30 | public event ExecutedHandler Executed; 31 | public void OnExecuted() 32 | { 33 | Executed?.Invoke(null); 34 | } 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Types/IFActionConditionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Action.Types 6 | { 7 | public enum IFActionConditionType 8 | { 9 | /// 10 | /// 等于 11 | /// 12 | Equal = 1, 13 | /// 14 | /// 不等于 15 | /// 16 | UnEqual = 2, 17 | /// 18 | /// 包含 19 | /// 20 | Has = 3, 21 | /// 22 | /// 不包含 23 | /// 24 | Miss = 4, 25 | /// 26 | /// 大于 27 | /// 28 | Greater = 5, 29 | /// 30 | /// 小于 31 | /// 32 | Less = 6, 33 | /// 34 | /// 大于或等于 35 | /// 36 | GreaterOrEqual = 7, 37 | /// 38 | /// 小于或等于 39 | /// 40 | LessOrEqual = 8, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Window/DefaultWindowCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Input; 5 | 6 | namespace ProjectEvent.UI.Controls.Window 7 | { 8 | public class DefaultWindowCommands 9 | { 10 | public static RoutedUICommand MinimizeWindowCommand { get; } = new RoutedUICommand("", "MinimizeWindowCommand", typeof(DefaultWindowCommands)); 11 | public static RoutedUICommand RestoreWindowCommand { get; } = new RoutedUICommand("", "RestoreWindowCommand", typeof(DefaultWindowCommands)); 12 | public static RoutedUICommand MaximizeWindowCommand { get; } = new RoutedUICommand("", "MaximizeWindowCommand", typeof(DefaultWindowCommands)); 13 | public static RoutedUICommand CloseWindowCommand { get; } = new RoutedUICommand("", "CloseWindowCommand", typeof(DefaultWindowCommands)); 14 | 15 | public static RoutedUICommand LogoButtonClickCommand { get; } = new RoutedUICommand("", "LogoButtonClickCommand", typeof(DefaultWindowCommands)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/OnFileChangedCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Condition 9 | { 10 | public class OnFileChangedCondition : ICondition 11 | { 12 | /// 13 | /// 监听的文件夹路径 14 | /// 15 | public string WatchPath { get; set; } 16 | /// 17 | /// 监听的后缀 18 | /// 19 | public string Extname { get; set; } 20 | public ConditionCheckResultModel Check() 21 | { 22 | var result = new ConditionCheckResultModel(); 23 | result.IsValid = Directory.Exists(WatchPath); 24 | return result; 25 | } 26 | 27 | public bool IsPass(object data = null) 28 | { 29 | var evargs = data as FileChangedDataModel; 30 | return evargs.WatchPath.ToLower() == WatchPath.ToLower(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/SystemInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Interop; 2 | 3 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 4 | { 5 | public static class SystemInfo 6 | { 7 | private static System.Windows.Point? dpiFactors; 8 | 9 | private static System.Windows.Point? DpiFactors 10 | { 11 | get 12 | { 13 | if (dpiFactors == null) 14 | using (var source = new HwndSource(new HwndSourceParameters())) 15 | dpiFactors = new System.Windows.Point(source.CompositionTarget.TransformToDevice.M11, source.CompositionTarget.TransformToDevice.M22); 16 | return dpiFactors; 17 | } 18 | } 19 | 20 | public static double DpiXFactor 21 | { 22 | get 23 | { 24 | var factors = DpiFactors; 25 | return factors.HasValue ? factors.Value.X : 1; 26 | } 27 | } 28 | 29 | public static double DpiYFactor 30 | { 31 | get 32 | { 33 | var factors = DpiFactors; 34 | return factors.HasValue ? factors.Value.Y : 1; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/HttpRequestActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | public class HttpRequestActionInputModel 9 | { 10 | public string Url { get; set; } 11 | /// 12 | /// 方法 13 | /// 14 | public ComBoxModel Method{ get; set; } 15 | 16 | /// 17 | /// 请求参数 18 | /// 19 | public Dictionary QueryParams { get; set; } 20 | /// 21 | /// 参数类型 22 | /// 23 | public ComBoxModel PamramsType { get; set; } 24 | /// 25 | /// 文件 26 | /// 27 | public Dictionary Files { get; set; } 28 | /// 29 | /// 请求头信息 30 | /// 31 | public Dictionary Headers { get; set; } 32 | public string JsonStr { get; set; } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Little Panda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/IndexPageModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.ItemSelect.Models; 2 | using ProjectEvent.UI.Controls.Navigation.Models; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.UI.Models 9 | { 10 | public class IndexPageModel : UINotifyPropertyChanged 11 | { 12 | public ObservableCollection Projects { get; set; } 13 | 14 | private int SelectedProjectID_ = 0; 15 | public int SelectedProjectID 16 | { 17 | get { return SelectedProjectID_; } 18 | set { SelectedProjectID_ = value; OnPropertyChanged(); } 19 | } 20 | private string Title_; 21 | public string Title 22 | { 23 | get { return Title_; } 24 | set { Title_ = value; OnPropertyChanged(); } 25 | } 26 | 27 | private ItemModel SelectItem_; 28 | public ItemModel SelectItem 29 | { 30 | get { return SelectItem_; } 31 | set { SelectItem_ = value; OnPropertyChanged(); } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/InputGroup/InputGroup.xaml: -------------------------------------------------------------------------------- 1 | 4 | 20 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Helper/ObjectConvert.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Helper 8 | { 9 | public static class ObjectConvert 10 | { 11 | /// 12 | /// 尝试使用指定对象类型转换匿名对象 13 | /// 14 | /// 15 | /// 16 | /// 17 | public static T Get(object obj) where T : class 18 | { 19 | if (obj == null) 20 | { 21 | return null; 22 | } 23 | var result = obj as T; 24 | if (result == null) 25 | { 26 | var jobject = obj as JObject; 27 | result = jobject.ToObject(); 28 | } 29 | if (result != null) 30 | { 31 | string jstr = JsonConvert.SerializeObject(result); 32 | result = JsonConvert.DeserializeObject(jstr); 33 | } 34 | return result; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/Tasks/DeviceTaskService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using ProjectEvent.Core.Action; 3 | using ProjectEvent.Core.Event.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace ProjectEvent.Core.Services.Tasks 10 | { 11 | public class DeviceTaskService : IDeviceTaskService 12 | { 13 | private readonly IEventService eventService; 14 | 15 | 16 | public DeviceTaskService(IEventService eventContainerService) 17 | { 18 | eventService = eventContainerService; 19 | } 20 | 21 | 22 | public void Run() 23 | { 24 | var events = eventService. 25 | GetEvents(). 26 | Where(m => m.EventType == Event.Types.EventType.OnDeviceStartup 27 | ). 28 | ToList(); 29 | 30 | foreach (var ev in events) 31 | { 32 | Handle(ev); 33 | } 34 | } 35 | 36 | 37 | private void Handle(EventModel ev) 38 | { 39 | eventService.Invoke(ev, null); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Models/ActionInputModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Action.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Controls.Action.Models 7 | { 8 | /// 9 | /// action输入模型 10 | /// 11 | public class ActionInputModel 12 | { 13 | /// 14 | /// 输入类型 15 | /// 16 | public InputType InputType { get; set; } 17 | /// 18 | /// 标题 19 | /// 20 | public string Title { get; set; } 21 | /// 22 | /// 绑定到数据键名 23 | /// 24 | public string BindingName { get; set; } 25 | /// 26 | /// 占位符 27 | /// 28 | public string Placeholder { get; set; } 29 | /// 30 | /// 可选择的项目(仅在输入类型是下拉选择时有效) 31 | /// 32 | 33 | public List SelectItems { get; set; } 34 | /// 35 | /// 是否拉伸(仅在单行输入模板中且仅有一个参数时有效) 36 | /// 37 | public bool IsStretch { get; set; } = false; 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/WindowClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 5 | { 6 | /// 7 | /// Callback delegate which is used by the Windows API to 8 | /// submit window messages. 9 | /// 10 | public delegate IntPtr WindowProcedureHandler(IntPtr hwnd, uint uMsg, IntPtr wparam, IntPtr lparam); 11 | 12 | 13 | /// 14 | /// Win API WNDCLASS struct - represents a single window. 15 | /// Used to receive window messages. 16 | /// 17 | [StructLayout(LayoutKind.Sequential)] 18 | public struct WindowClass 19 | { 20 | #pragma warning disable 1591 21 | 22 | public uint style; 23 | public WindowProcedureHandler lpfnWndProc; 24 | public int cbClsExtra; 25 | public int cbWndExtra; 26 | public IntPtr hInstance; 27 | public IntPtr hIcon; 28 | public IntPtr hCursor; 29 | public IntPtr hbrBackground; 30 | [MarshalAs(UnmanagedType.LPWStr)] public string lpszMenuName; 31 | [MarshalAs(UnmanagedType.LPWStr)] public string lpszClassName; 32 | 33 | #pragma warning restore 1591 34 | } 35 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/ITimerService.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Services 7 | { 8 | public interface ITimerService 9 | { 10 | /// 11 | /// 启动一个周期任务 12 | /// 13 | /// 执行方法 14 | /// 指定时间 15 | /// 重复方式 16 | void StartNew(int id, System.Action action, DateTime dateTime, TimeChangedRepetitionType repetitionType); 17 | /// 18 | /// 启动一个定时器任务 19 | /// 20 | /// 执行方法 21 | /// 多少秒后执行 22 | /// 循环次数(为0时无限) 23 | /// 计时器关闭后执行方法 24 | void StartNew(int id, System.Action action, double seconds, int num = 0, System.Action timerClosedAction = null); 25 | 26 | /// 27 | /// 关闭一个event任务 28 | /// 29 | /// 30 | void Close(int id); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Data/GetIPAddressActionData.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using ProjectEvent.Core.Action.Types.ResultTypes; 3 | using ProjectEvent.Core.Net.Types; 4 | using ProjectEvent.Core.Types; 5 | using ProjectEvent.UI.Controls.Action.Models; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | 11 | namespace ProjectEvent.UI.Controls.Action.Data 12 | { 13 | public class GetIPAddressActionData 14 | { 15 | public static List IPAddressTypes = new List() 16 | { 17 | new ComBoxModel() 18 | { 19 | ID=(int)IPAddressType.LocalIPV4, 20 | DisplayName="内网IPV4" 21 | }, 22 | new ComBoxModel() 23 | { 24 | ID=(int)IPAddressType.PublicIPV4, 25 | DisplayName="公网IPV4" 26 | }, 27 | }; 28 | public static ComBoxModel GetIPAddressType(int id) 29 | { 30 | return IPAddressTypes.Where(m => m.ID == id).FirstOrDefault(); 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/DataModels/ProjectModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Base; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.UI.Models.DataModels 7 | { 8 | public class ProjectModel 9 | { 10 | public int ID { get; set; } 11 | /// 12 | /// 方案名称 13 | /// 14 | public string ProjectName { get; set; } 15 | /// 16 | /// 方案描述 17 | /// 18 | public string ProjectDescription { get; set; } 19 | 20 | /// 21 | /// 事件ID 22 | /// 23 | public int EventID { get; set; } 24 | /// 25 | /// 条件数据 26 | /// 27 | public object ConditionData { get; set; } 28 | /// 29 | /// 操作 30 | /// 31 | public List Actions { get; set; } 32 | /// 33 | /// 分组ID 34 | /// 35 | public int GroupID { get; set; } 36 | /// 37 | /// 图标 38 | /// 39 | public IconTypes Icon { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Views/EventLogPage.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/DelayAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using ProjectEvent.Core.Win32; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Diagnostics; 10 | using System.Drawing; 11 | using System.Drawing.Imaging; 12 | using System.IO; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | 17 | namespace ProjectEvent.Core.Action.Actions 18 | { 19 | public class DelayAction : IAction 20 | { 21 | public event ActionInvokeHandler OnEventStateChanged; 22 | 23 | public System.Action GenerateAction(int taskID, ActionModel action) 24 | { 25 | return () => 26 | { 27 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 28 | var p = ObjectConvert.Get(action.Parameter); 29 | Task.Delay(p.Seconds * 1000).Wait(); 30 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 31 | }; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/TabContainer/TabHeaderButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | namespace ProjectEvent.UI.Controls.TabContainer 8 | { 9 | public class TabHeaderButton : Control 10 | { 11 | public string Title 12 | { 13 | get { return (string)GetValue(TitleProperty); } 14 | set { SetValue(TitleProperty, value); } 15 | } 16 | public static readonly DependencyProperty TitleProperty = 17 | DependencyProperty.Register("Title", 18 | typeof(string), 19 | typeof(TabHeaderButton)); 20 | 21 | public bool IsSelected 22 | { 23 | get { return (bool)GetValue(IsSelectedProperty); } 24 | set { SetValue(IsSelectedProperty, value); } 25 | } 26 | public static readonly DependencyProperty IsSelectedProperty = 27 | DependencyProperty.Register("IsSelected", 28 | typeof(bool), 29 | typeof(TabHeaderButton)); 30 | public TabHeaderButton() 31 | { 32 | DefaultStyleKey = typeof(TabHeaderButton); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/ViewModels/EventLogPageVM.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Models; 2 | using ProjectEvent.UI.Services; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.UI.ViewModels 9 | { 10 | public class EventLogPageVM : EventLogPageModel 11 | { 12 | private readonly IEventLog eventLog; 13 | private readonly IProjects projects; 14 | public EventLogPageVM( 15 | IEventLog eventLog, 16 | IProjects projects) 17 | { 18 | this.eventLog = eventLog; 19 | this.projects = projects; 20 | ReadLogText(); 21 | } 22 | 23 | private void ReadLogText() 24 | { 25 | var logs = eventLog.GetEventLogs().OrderByDescending(m => m.ID); 26 | foreach (var log in logs) 27 | { 28 | var project = projects.GetProject(log.ProjectID); 29 | string name = "[已被删除]"; 30 | if (project != null) 31 | { 32 | name = project.ProjectName; 33 | } 34 | Log += $"{log.ID}\r\n方案:{name},时间:{log.Time.ToString()}\r\n-----\r\n"; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Win32/CommonWin32API.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Helper; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Win32 9 | { 10 | /// 11 | /// 通用win32 api 12 | /// 13 | public class CommonWin32API 14 | { 15 | #region 获取屏幕分辨率 16 | public const int SM_CXSCREEN = 0; 17 | public const int SM_CYSCREEN = 1; 18 | [DllImport("user32.dll", EntryPoint = "GetSystemMetrics")] 19 | public static extern int GetSystemMetrics(int SM); 20 | 21 | /// 22 | /// 获取屏幕分辨率 23 | /// 24 | /// 25 | public static Rectangle GetScreenResolution() 26 | { 27 | var res = new Rectangle(); 28 | res.Width = GetSystemMetrics(SM_CXSCREEN); 29 | res.Height = GetSystemMetrics(SM_CYSCREEN); 30 | return res; 31 | } 32 | #endregion 33 | 34 | #region 获取网络状态 35 | [DllImport("wininet.dll")] 36 | public static extern bool InternetGetConnectedState(out long lpdwFlags, long dwReserved); 37 | 38 | 39 | #endregion 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Models/SettingsPageModel.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.InputGroup.Models; 2 | using ProjectEvent.UI.Models.Settings; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Models 8 | { 9 | public class SettingsPageModel : UINotifyPropertyChanged 10 | { 11 | private List GeneralInputModels_; 12 | public List GeneralInputModels 13 | { 14 | get { return GeneralInputModels_; } 15 | set { GeneralInputModels_ = value; OnPropertyChanged(); } 16 | } 17 | 18 | private SettingsModel Settings_; 19 | public SettingsModel Settings 20 | { 21 | get { return Settings_; } 22 | set 23 | { 24 | Settings_ = value; 25 | OnPropertyChanged(); 26 | } 27 | } 28 | //private GeneralModel GeneralData_; 29 | //public GeneralModel GeneralData 30 | //{ 31 | // get 32 | // { 33 | // return GeneralData_; 34 | // } 35 | // set 36 | // { 37 | // GeneralData_ = value; 38 | // OnPropertyChanged(); 39 | // } 40 | //} 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/ItemSelect/ItemSelect.xaml: -------------------------------------------------------------------------------- 1 | 4 | 25 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/SetDeviceVolumeAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using ProjectEvent.Core.Win32; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Diagnostics; 10 | using System.Drawing; 11 | using System.Drawing.Imaging; 12 | using System.IO; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Threading.Tasks; 16 | 17 | namespace ProjectEvent.Core.Action.Actions 18 | { 19 | public class SetDeviceVolumeAction : IAction 20 | { 21 | public event ActionInvokeHandler OnEventStateChanged; 22 | 23 | public System.Action GenerateAction(int taskID, ActionModel action) 24 | { 25 | return () => 26 | { 27 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 28 | var p = ObjectConvert.Get(action.Parameter); 29 | p.Volume = ActionParameterConverter.ConvertToString(taskID, p.Volume); 30 | AudioHelper.SetMasterVolume(int.Parse(p.Volume)); 31 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 32 | }; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/NotifyIconResources.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Base/Color/ColorTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.UI.Base.Color 6 | { 7 | public enum ColorTypes 8 | { 9 | /// 10 | /// 红色 11 | /// 12 | Red, 13 | /// 14 | /// 橙色 15 | /// 16 | Orange, 17 | /// 18 | /// 黄色 19 | /// 20 | Yellow, 21 | /// 22 | /// 金色 23 | /// 24 | Gold, 25 | /// 26 | /// 绿色 27 | /// 28 | Green, 29 | /// 30 | /// 碧绿色 31 | /// 32 | Aquamarine, 33 | /// 34 | /// 青色 35 | /// 36 | Cyan, 37 | /// 38 | /// 蓝色 39 | /// 40 | Blue, 41 | /// 42 | /// 紫色 43 | /// 44 | Violet, 45 | /// 46 | /// 粉色 47 | /// 48 | Pink, 49 | /// 50 | /// 灰色 51 | /// 52 | Gray, 53 | /// 54 | /// 黑色 55 | /// 56 | Black, 57 | /// 58 | /// 白色 59 | /// 60 | White 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/Input/TextField.xaml: -------------------------------------------------------------------------------- 1 | 5 | 23 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/Base/Icon.xaml: -------------------------------------------------------------------------------- 1 | 4 | 26 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/OnIntervalTimerCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using ProjectEvent.Core.Event; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Condition 8 | { 9 | public class OnIntervalTimerCondition : ICondition 10 | { 11 | /// 12 | /// 间隔秒数 13 | /// 14 | public double Seconds { get; set; } 15 | /// 16 | /// 循环次数 17 | /// 18 | public int Num { get; set; } 19 | 20 | public ConditionCheckResultModel Check() 21 | { 22 | var result = new ConditionCheckResultModel(); 23 | result.IsValid = true; 24 | 25 | if (Seconds <= 0) 26 | { 27 | result.IsValid = false; 28 | result.Msg = "间隔秒数不能小于等于0"; 29 | } 30 | if (Num < 0) 31 | { 32 | result.IsValid = false; 33 | result.Msg = "循环次数不能小于0"; 34 | } 35 | 36 | return result; 37 | } 38 | 39 | public bool IsPass(object data = null) 40 | { 41 | var eventLogs = EventLoger.Get(Event.Types.EventType.OnIntervalTimer); 42 | if (Num > 0 && eventLogs.Count >= Num) 43 | { 44 | return false; 45 | } 46 | return true; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/ViewModels/EventCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Input; 6 | using System.Windows.Interactivity; 7 | 8 | namespace ProjectEvent.UI.ViewModels 9 | { 10 | public class EventCommand : TriggerAction 11 | { 12 | public ICommand Command 13 | { 14 | get { return (ICommand)GetValue(CommandProperty); } 15 | set { SetValue(CommandProperty, value); } 16 | } 17 | 18 | public static readonly DependencyProperty CommandProperty = 19 | DependencyProperty.Register("Command", typeof(ICommand), typeof(EventCommand), new PropertyMetadata(null)); 20 | 21 | public object CommandParateter 22 | { 23 | get { return (object)GetValue(CommandParateterProperty); } 24 | set { SetValue(CommandParateterProperty, value); } 25 | } 26 | 27 | public static readonly DependencyProperty CommandParateterProperty = 28 | DependencyProperty.Register("CommandParateter", typeof(object), typeof(EventCommand), new PropertyMetadata(null)); 29 | 30 | protected override void Invoke(object parameter) 31 | { 32 | if (CommandParateter != null) 33 | parameter = CommandParateter; 34 | var cmd = Command; 35 | if (cmd != null) 36 | cmd.Execute(parameter); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Project Event 2 | 3 | [Microsoft Store →](https://www.microsoft.com/store/apps/9PDZ8MHCVCFR) 4 | 5 | 一个类似于iOS自动化快捷指令的PC版软件,提供了可以在Windows上创建事件监听方案的能力,当事件触发时自动执行方案所设定的操作。 6 | 7 |

8 | Project Event 9 |

10 | 11 | ### 基本使用 12 | 13 | 安装启动软件后你可以在右下角状态栏看到⚡图标,左键双击直接进入主界面,右键单击显示快捷菜单。 14 | 15 | ##### 创建事件监听/自动化方案 16 | 17 | 在主界面点击右上角的`+`按钮,进入创建方案界面。可以看到4个选项卡 18 | 19 | 描述:表示方案的一些信息,主要用于分辨该方案的用途; 20 | 21 | 事件:触发的前提条件; 22 | 23 | 条件:事件触发所需要的后续条件,但并不是所有事件都需要后续条件; 24 | 25 | 操作:成功触发事件后执行的操作。鼠标按住移动可以上下调整顺序,以从上往下的顺序依次执行。 26 | 27 | ##### 变量 28 | 29 | 部分`操作`支持输入内容作为选项,就可以在输入框中使用`变量`作为选项的一部分。变量有三种: **全局变量 **(即所有支持输入的`操作`随时都可以直接使用); **事件变量 **(每个`事件`所产生的变量都不相同,有些事件不会产生变量); **操作结果变量 **(当某些`操作`被执行完成后可以产生一些返回数据,在被执行的操作以下的操作中都可以通过`操作结果变量`获取到返回的数据)。点击输入框的位置可以看到变量选择框,点击需要的变量将被添加到当前输入框中。如果获取变量的时机不对时,你会看到输入框变成红色,表示输入框中存在错误且无法获取的变量。 30 | 31 | ### 反馈 32 | 33 | [问题反馈](https://github.com/Planshit/ProjectEvent/issues/new?assignees=&labels=bug&template=bug-report-----.md&title=%5Bbug%5D+%E8%BD%AF%E4%BB%B6%E6%9C%89%E9%97%AE%E9%A2%98) 34 | 35 | [功能建议](https://github.com/Planshit/ProjectEvent/issues/new?assignees=&labels=enhancement&template=feature-request-----.md&title=%5Bfeature%5D+%E6%88%91%E5%B8%8C%E6%9C%9B%E8%83%BD%E5%A2%9E%E5%8A%A0%2F%E8%B0%83%E6%95%B4...) 36 | 37 | ### 其他 38 | 39 | [Todo](https://github.com/Planshit/ProjectEvent/projects) [追踪开发进度和版本计划] 40 | 41 | [用户帮助文档](https://littlepanda.gitbook.io/project-event/) 42 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/MouseEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 2 | { 3 | /// 4 | /// Event flags for clicked events. 5 | /// 6 | public enum MouseEvent 7 | { 8 | /// 9 | /// The mouse was moved withing the 10 | /// taskbar icon's area. 11 | /// 12 | MouseMove, 13 | 14 | /// 15 | /// The right mouse button was clicked. 16 | /// 17 | IconRightMouseDown, 18 | 19 | /// 20 | /// The left mouse button was clicked. 21 | /// 22 | IconLeftMouseDown, 23 | 24 | /// 25 | /// The right mouse button was released. 26 | /// 27 | IconRightMouseUp, 28 | 29 | /// 30 | /// The left mouse button was released. 31 | /// 32 | IconLeftMouseUp, 33 | 34 | /// 35 | /// The middle mouse button was clicked. 36 | /// 37 | IconMiddleMouseDown, 38 | 39 | /// 40 | /// The middle mouse button was released. 41 | /// 42 | IconMiddleMouseUp, 43 | 44 | /// 45 | /// The taskbar icon was double clicked. 46 | /// 47 | IconDoubleClick, 48 | 49 | /// 50 | /// The balloon tip was clicked. 51 | /// 52 | BalloonToolTipClicked 53 | } 54 | } -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/NotifyCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 2 | { 3 | /// 4 | /// Main operations performed on the 5 | /// function. 6 | /// 7 | public enum NotifyCommand 8 | { 9 | /// 10 | /// The taskbar icon is being created. 11 | /// 12 | Add = 0x00, 13 | 14 | /// 15 | /// The settings of the taskbar icon are being updated. 16 | /// 17 | Modify = 0x01, 18 | 19 | /// 20 | /// The taskbar icon is deleted. 21 | /// 22 | Delete = 0x02, 23 | 24 | /// 25 | /// Focus is returned to the taskbar icon. Currently not in use. 26 | /// 27 | SetFocus = 0x03, 28 | 29 | /// 30 | /// Shell32.dll version 5.0 and later only. Instructs the taskbar 31 | /// to behave according to the version number specified in the 32 | /// uVersion member of the structure pointed to by lpdata. 33 | /// This message allows you to specify whether you want the version 34 | /// 5.0 behavior found on Microsoft Windows 2000 systems, or the 35 | /// behavior found on earlier Shell versions. The default value for 36 | /// uVersion is zero, indicating that the original Windows 95 notify 37 | /// icon behavior should be used. 38 | /// 39 | SetVersion = 0x04 40 | } 41 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Helper/AudioHelper.cs: -------------------------------------------------------------------------------- 1 | using AudioSwitcher.AudioApi.CoreAudio; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Helper 7 | { 8 | public static class AudioHelper 9 | { 10 | static CoreAudioController controller; 11 | private static void Init() 12 | { 13 | if (controller == null) 14 | { 15 | controller = new CoreAudioController(); 16 | } 17 | } 18 | /// 19 | /// 获取当前声音播放设备的音量 20 | /// 21 | /// 22 | public static double GetMasterVolume() 23 | { 24 | try 25 | { 26 | Init(); 27 | var device = controller.DefaultPlaybackDevice; 28 | return device.Volume; 29 | } 30 | catch (Exception e) 31 | { 32 | LogHelper.Error(e.ToString()); 33 | } 34 | return -1; 35 | } 36 | /// 37 | /// 设置当前声音播放设备的音量 38 | /// 39 | /// 40 | public static void SetMasterVolume(double value) 41 | { 42 | try 43 | { 44 | Init(); 45 | var device = controller.DefaultPlaybackDevice; 46 | device.Volume = value; 47 | } 48 | catch (Exception e) 49 | { 50 | LogHelper.Error(e.ToString()); 51 | } 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/ShutdownAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Helper; 4 | using ProjectEvent.Core.Services; 5 | using ProjectEvent.Core.Win32; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.IO; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace ProjectEvent.Core.Action.Actions 15 | { 16 | public class ShutdownAction : IAction 17 | { 18 | public event ActionInvokeHandler OnEventStateChanged; 19 | 20 | public System.Action GenerateAction(int taskID, ActionModel action) 21 | { 22 | return () => 23 | { 24 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 25 | var result = new ActionResultModel(); 26 | result.ID = action.ID; 27 | result.Result = new Dictionary(); 28 | result.Result.Add((int)CommonResultKeyType.IsSuccess, false); 29 | try 30 | { 31 | ShutDownSys.ShutDown(); 32 | Debug.WriteLine("执行关机"); 33 | result.Result[(int)CommonResultKeyType.IsSuccess] = true; 34 | } 35 | catch 36 | { 37 | } 38 | //返回数据 39 | ActionTaskResulter.Add(taskID, result); 40 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 41 | }; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/BluetoothEventCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using ProjectEvent.Core.Event.Structs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Condition 9 | { 10 | public class BluetoothEventCondition : ICondition 11 | { 12 | /// 13 | /// 过滤设备名称 14 | /// 15 | public string DeviceName { get; set; } 16 | /// 17 | /// 不区分大小写 18 | /// 19 | public bool Caseinsensitive { get; set; } 20 | /// 21 | /// 模糊匹配 22 | /// 23 | public bool FuzzyMatch { get; set; } 24 | public ConditionCheckResultModel Check() 25 | { 26 | //特殊事件直接通过 27 | var result = new ConditionCheckResultModel(); 28 | result.IsValid = true; 29 | return result; 30 | } 31 | 32 | public bool IsPass(object data = null) 33 | { 34 | var eventData = (BluetoothEventDataStruct)data; 35 | if (string.IsNullOrEmpty(DeviceName)) 36 | { 37 | return true; 38 | } 39 | 40 | if (Caseinsensitive) 41 | { 42 | DeviceName = DeviceName.ToLower(); 43 | eventData.DeviceName = eventData.DeviceName.ToLower(); 44 | } 45 | if (FuzzyMatch) 46 | { 47 | return eventData.DeviceName.Contains(DeviceName); 48 | } 49 | return DeviceName == eventData.DeviceName; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Window/DialogWindow.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/IEventService.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace ProjectEvent.Core.Services 7 | { 8 | public interface IEventService 9 | { 10 | /// 11 | /// 添加一个事件 12 | /// 13 | /// 14 | /// 成功返回true,失败返回false 15 | bool Add(EventModel eventModel); 16 | /// 17 | /// 添加事件时发生 18 | /// 19 | event ContainerEventHandler OnAddEvent; 20 | /// 21 | /// 移除事件时发生 22 | /// 23 | event ContainerEventHandler OnRemoveEvent; 24 | /// 25 | /// 更新事件时发生 26 | /// 27 | event EventChangedHandler OnUpdateEvent; 28 | 29 | /// 30 | /// 获取所有事件 31 | /// 32 | /// 33 | IEnumerable GetEvents(); 34 | /// 35 | /// 事件被触发时发生 36 | /// 37 | 38 | event EventHandler OnEventTrigger; 39 | /// 40 | /// 尝试触发事件 41 | /// 42 | /// 事件模型 43 | /// 事件数据 44 | void Invoke(EventModel ev, object data); 45 | /// 46 | /// 移除一个event 47 | /// 48 | /// 49 | void Remove(int id); 50 | /// 51 | /// 更新 52 | /// 53 | /// 54 | void Update(EventModel ev); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Base/Icon.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Base; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace ProjectEvent.UI.Controls.Base 10 | { 11 | public class Icon : Control 12 | { 13 | public IconTypes IconType 14 | { 15 | get { return (IconTypes)GetValue(IconTypeProperty); } 16 | set { SetValue(IconTypeProperty, value); } 17 | } 18 | public static readonly DependencyProperty IconTypeProperty = 19 | DependencyProperty.Register("IconType", 20 | typeof(IconTypes), 21 | typeof(Icon), new PropertyMetadata(IconTypes.Back, new PropertyChangedCallback(OnIconTypeChanged))); 22 | 23 | private static void OnIconTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 24 | { 25 | var control = d as Icon; 26 | if (e.NewValue != e.OldValue) 27 | { 28 | control.Unicode = IconConverter.ToUnicode((IconTypes)e.NewValue); 29 | } 30 | } 31 | 32 | public string Unicode 33 | { 34 | get { return (string)GetValue(UnicodeProperty); } 35 | set { SetValue(UnicodeProperty, value); } 36 | } 37 | public static readonly DependencyProperty UnicodeProperty = 38 | DependencyProperty.Register("Unicode", 39 | typeof(string), 40 | typeof(Icon), 41 | new PropertyMetadata(IconConverter.ToUnicode(IconTypes.Back))); 42 | public Icon() 43 | { 44 | DefaultStyleKey = typeof(Icon); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Event/Types/EventType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ProjectEvent.Core.Event.Types 6 | { 7 | /// 8 | /// 事件类型 9 | /// 10 | public enum EventType 11 | { 12 | /// 13 | /// 周期事件 14 | /// 15 | OnTimeChanged = 11, 16 | 17 | /// 18 | /// 设备启动 19 | /// 20 | OnDeviceStartup = 2, 21 | 22 | ///// 23 | ///// 设备关闭 24 | ///// 25 | //OnDeviceShutdown = 3, 26 | 27 | /// 28 | /// 网络状态变化事件 29 | /// 30 | NetworkStatusEvent = 4, 31 | 32 | /// 33 | /// 进程创建 34 | /// 35 | OnProcessCreated = 5, 36 | 37 | /// 38 | /// 进程关闭 39 | /// 40 | OnProcessShutdown = 6, 41 | 42 | /// 43 | /// 鼠标单击 44 | /// 45 | OnMouseClick = 7, 46 | 47 | /// 48 | /// 计时器 49 | /// 50 | OnIntervalTimer = 8, 51 | /// 52 | /// 文件发生更改(添加,删除,重命名) 53 | /// 54 | OnFileChanged = 9, 55 | /// 56 | /// 键盘事件 57 | /// 58 | KeyboardEvent = 10, 59 | /// 60 | /// wifi连接事件(仅在支持无线网络的设备上有效) 61 | /// 62 | WIFIConnectedEvent = 12, 63 | /// 64 | /// 蓝牙事件 65 | /// 66 | BluetoothEvent = 13, 67 | /// 68 | /// 启动游戏事件 69 | /// 70 | RunGameEvent = 14 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/ProjectEvent.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | 0.0.4 6 | Plan Panda 7 | Little Panda 8 | Project Event 9 | Project Event核心类库 10 | http://thelittlepandaisbehind.com/ 11 | https://github.com/Planshit/ProjectEvent 12 | 0.0.4.0 13 | 0.0.4.0 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ..\Librarys\InTheHand.Net.Personal.dll 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/PipeCallFunction.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using ProjectEvent.Core.Net; 3 | using ProjectEvent.Core.Structs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | using System.IO; 8 | using System.IO.Pipes; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace ProjectEvent.Core 13 | { 14 | public class PipeCallFunction 15 | { 16 | static object connectLock = new object(); 17 | static PipeNet pipeNet; 18 | static bool isConnected = false; 19 | public delegate void PipeCallFeedbackEventHandler(PipeCallFunctionFeedbackStruct fb); 20 | public static event PipeCallFeedbackEventHandler OnCallFeedback; 21 | public static void Connect() 22 | { 23 | lock (connectLock) 24 | { 25 | if (!isConnected) 26 | { 27 | isConnected = true; 28 | pipeNet = new PipeNet("callfunction"); 29 | pipeNet.OnReceiveMsg += PipeNet_OnReceiveMsg; 30 | pipeNet.Start(); 31 | } 32 | } 33 | } 34 | 35 | private static void PipeNet_OnReceiveMsg(PipeNet sender, string msg) 36 | { 37 | var fb = JsonConvert.DeserializeObject(msg); 38 | OnCallFeedback?.Invoke(fb); 39 | } 40 | 41 | public static void Close() 42 | { 43 | if (isConnected) 44 | { 45 | 46 | isConnected = false; 47 | } 48 | } 49 | 50 | 51 | public static void Call(PipeCallFunctionStruct data) 52 | { 53 | Connect(); 54 | pipeNet.Send(JsonConvert.SerializeObject(data)); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Builders/IActionBuilder.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.UI.Controls.Action.Models; 2 | using ProjectEvent.UI.Models.DataModels; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.UI.Controls.Action.Builders 8 | { 9 | public interface IActionBuilder 10 | { 11 | /// 12 | /// 获取支持的操作结果返回 13 | /// 14 | /// 15 | List GetResultKeys(); 16 | /// 17 | /// 获取用于UI的action item model 18 | /// 19 | /// 20 | ActionItemModel GetActionItemModel(); 21 | /// 22 | /// 获取用于core action model 23 | /// 24 | /// 25 | Core.Action.Models.ActionModel GetCoreActionModel(); 26 | /// 27 | /// 获取用于UI的基本输入模板 28 | /// 29 | /// 30 | List GetBaseActionInputModels(); 31 | /// 32 | /// 获取用于UI的更多选项输入模板 33 | /// 34 | /// 35 | List GetDetailActionInputModels(); 36 | /// 37 | ///获取输入数据 38 | /// 39 | /// 40 | object GetInputModelData(); 41 | /// 42 | /// 导入一个core action 43 | /// 44 | /// 45 | void ImportAction(Core.Action.Models.ActionModel action); 46 | /// 47 | /// 导入一个actoin item 48 | /// 49 | /// 50 | void ImportActionItem(ActionItemModel actionItem); 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/BalloonIcon.cs: -------------------------------------------------------------------------------- 1 | // hardcodet.net NotifyIcon for WPF 2 | // Copyright (c) 2009 - 2013 Philipp Sumi 3 | // Contact and Information: http://www.hardcodet.net 4 | // 5 | // This library is free software; you can redistribute it and/or 6 | // modify it under the terms of the Code Project Open License (CPOL); 7 | // either version 1.0 of the License, or (at your option) any later 8 | // version. 9 | // 10 | // The above copyright notice and this permission notice shall be 11 | // included in all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 17 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | // OTHER DEALINGS IN THE SOFTWARE. 21 | // 22 | // THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE 23 | 24 | 25 | namespace Hardcodet.Wpf.TaskbarNotification 26 | { 27 | /// 28 | /// Supported icons for the tray's balloon messages. 29 | /// 30 | public enum BalloonIcon 31 | { 32 | /// 33 | /// The balloon message is displayed without an icon. 34 | /// 35 | None, 36 | 37 | /// 38 | /// An information is displayed. 39 | /// 40 | Info, 41 | 42 | /// 43 | /// A warning is displayed. 44 | /// 45 | Warning, 46 | 47 | /// 48 | /// An error is displayed. 49 | /// 50 | Error 51 | } 52 | } -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/Navigation/Navigation.xaml: -------------------------------------------------------------------------------- 1 | 5 | 34 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/LoopsAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ProjectEvent.Core.Action.Actions 12 | { 13 | public class LoopsAction : IAction 14 | { 15 | public event ActionInvokeHandler OnEventStateChanged; 16 | 17 | public System.Action GenerateAction(int taskID, ActionModel action) 18 | { 19 | return () => 20 | { 21 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 22 | var p = ObjectConvert.Get(action.Parameter); 23 | int i = 0; 24 | if (p.Count <= 0) 25 | { 26 | p.Count = 1; 27 | } 28 | var result = new ActionResultModel(); 29 | result.ID = action.ID; 30 | result.Result = new Dictionary(); 31 | result.Result.Add((int)LoopsResultType.Index, "1"); 32 | ActionTaskResulter.Add(taskID, result); 33 | while (true) 34 | { 35 | result.Result[(int)LoopsResultType.Index] = i.ToString(); 36 | ActionTask.Invoke(taskID, p.Actions, taskID == ActionTask.TestTaskID, true); 37 | i++; 38 | 39 | if (i == p.Count) 40 | { 41 | break; 42 | } 43 | } 44 | 45 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 46 | }; 47 | 48 | } 49 | 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/OpenURLAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Helper; 4 | using ProjectEvent.Core.Services; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Diagnostics; 8 | using System.Text; 9 | 10 | namespace ProjectEvent.Core.Action.Actions 11 | { 12 | public class OpenURLAction : IAction 13 | { 14 | public event ActionInvokeHandler OnEventStateChanged; 15 | 16 | public System.Action GenerateAction(int taskID, ActionModel action) 17 | { 18 | return () => 19 | { 20 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 21 | var p = ObjectConvert.Get(action.Parameter); 22 | var result = new ActionResultModel(); 23 | result.ID = action.ID; 24 | result.Result = new Dictionary(); 25 | result.Result.Add((int)CommonResultKeyType.IsSuccess, false); 26 | p.URL = ActionParameterConverter.ConvertToString(taskID, p.URL); 27 | try 28 | { 29 | ProcessStartInfo psi = new ProcessStartInfo 30 | { 31 | FileName = p.URL, 32 | UseShellExecute = true 33 | }; 34 | Process.Start(psi); 35 | result.Result[(int)CommonResultKeyType.IsSuccess] = true; 36 | } 37 | catch (Exception e) 38 | { 39 | LogHelper.Error(e.ToString()); 40 | } 41 | //返回数据 42 | ActionTaskResulter.Add(taskID, result); 43 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 44 | }; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/NotificationService.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Types; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using Windows.Data.Xml.Dom; 6 | using Windows.UI.Notifications; 7 | namespace ProjectEvent.Core.Services 8 | { 9 | public class NotificationService 10 | { 11 | /// 12 | /// 显示一条通知 13 | /// 14 | /// 通知标题 15 | /// 通知内容 16 | /// 通知类型 17 | /// 图标(支持网络图片和本地图片) 18 | public void ShowNotification(string title, string content, ToastScenarioType toastScenarioType = ToastScenarioType.Default, string img = null, ToastActionType toastActionType = ToastActionType.Default, string actionUrl = null) 19 | { 20 | string launchStr = " launch=\"" + (int)toastActionType + "`\" "; 21 | if (toastActionType == ToastActionType.Url && actionUrl != null) 22 | { 23 | launchStr = " launch=\"" + (int)toastActionType + "`" + actionUrl + "\" "; 24 | } 25 | string imgChild = !string.IsNullOrEmpty(img) ? $@"" : ""; 26 | string xml = $@" 27 | 28 | 29 | {title} 30 | {content} 31 | {imgChild} 32 | 33 | 34 | "; 35 | 36 | XmlDocument doc = new XmlDocument(); 37 | doc.LoadXml(xml); 38 | ToastNotification toast = new ToastNotification(doc); 39 | ToastNotificationManager.CreateToastNotifier().Show(toast); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/DeleteFileAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using ProjectEvent.Core.Win32; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Diagnostics; 10 | using System.Drawing; 11 | using System.Drawing.Imaging; 12 | using System.IO; 13 | using System.Linq; 14 | using System.Text; 15 | 16 | namespace ProjectEvent.Core.Action.Actions 17 | { 18 | public class DeleteFileAction : IAction 19 | { 20 | public event ActionInvokeHandler OnEventStateChanged; 21 | 22 | public System.Action GenerateAction(int taskID, ActionModel action) 23 | { 24 | return () => 25 | { 26 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 27 | var p = ObjectConvert.Get(action.Parameter); 28 | var result = new ActionResultModel(); 29 | result.ID = action.ID; 30 | result.Result = new Dictionary(); 31 | result.Result.Add((int)DeleteFileResultType.IsSuccess, false); 32 | result.Result.Add((int)DeleteFileResultType.Path, p.Path); 33 | p.Path = ActionParameterConverter.ConvertToString(taskID, p.Path); 34 | try 35 | { 36 | File.Delete(p.Path); 37 | result.Result[(int)DeleteFileResultType.IsSuccess] = true; 38 | } 39 | catch (Exception e) 40 | { 41 | LogHelper.Error(e.ToString()); 42 | } 43 | //返回数据 44 | ActionTaskResulter.Add(taskID, result); 45 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 46 | }; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/WriteFileAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Helper; 4 | using ProjectEvent.Core.Services; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Diagnostics; 8 | using System.IO; 9 | using System.Text; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace ProjectEvent.Core.Action.Actions 14 | { 15 | public class WriteFileAction : IAction 16 | { 17 | public event ActionInvokeHandler OnEventStateChanged; 18 | 19 | public System.Action GenerateAction(int taskID, ActionModel action) 20 | { 21 | return () => 22 | { 23 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 24 | var p = ObjectConvert.Get(action.Parameter); 25 | var result = new ActionResultModel(); 26 | result.ID = action.ID; 27 | result.Result = new Dictionary(); 28 | result.Result.Add((int)CommonResultKeyType.IsSuccess, false); 29 | p.FilePath = ActionParameterConverter.ConvertToString(taskID, p.FilePath); 30 | p.Content = ActionParameterConverter.ConvertToString(taskID, p.Content); 31 | 32 | Debug.WriteLine("write file:" + p.FilePath); 33 | try 34 | { 35 | File.WriteAllText(p.FilePath, p.Content); 36 | result.Result[(int)CommonResultKeyType.IsSuccess] = true; 37 | } 38 | catch (Exception e) 39 | { 40 | LogHelper.Error(e.ToString()); 41 | } 42 | //返回数据 43 | ActionTaskResulter.Add(taskID, result); 44 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 45 | }; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Data/IFActionConditionData.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using ProjectEvent.UI.Controls.Action.Models; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.UI.Controls.Action.Data 9 | { 10 | public class IFActionConditionData 11 | { 12 | public static List ComBoxData = new List() 13 | { 14 | new ComBoxModel() 15 | { 16 | ID = (int)IFActionConditionType.Equal, 17 | DisplayName = "等于" 18 | }, 19 | new ComBoxModel() 20 | { 21 | ID = (int)IFActionConditionType.UnEqual, 22 | DisplayName = "不等于" 23 | }, 24 | new ComBoxModel() 25 | { 26 | ID = (int)IFActionConditionType.Has, 27 | DisplayName = "包含" 28 | }, 29 | new ComBoxModel() 30 | { 31 | ID = (int)IFActionConditionType.Miss, 32 | DisplayName = "不包含" 33 | }, 34 | new ComBoxModel() 35 | { 36 | ID = (int)IFActionConditionType.Greater, 37 | DisplayName = "大于" 38 | }, 39 | new ComBoxModel() 40 | { 41 | ID = (int)IFActionConditionType.GreaterOrEqual, 42 | DisplayName = "大于或等于" 43 | }, 44 | new ComBoxModel() 45 | { 46 | ID = (int)IFActionConditionType.Less, 47 | DisplayName = "小于" 48 | }, 49 | new ComBoxModel() 50 | { 51 | ID = (int)IFActionConditionType.LessOrEqual, 52 | DisplayName = "小于或等于" 53 | } 54 | }; 55 | public static ComBoxModel GetCombox(int id) 56 | { 57 | return ComBoxData.Where(m => m.ID == id).FirstOrDefault(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/SystemNotificationAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using ProjectEvent.Core.Win32; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Diagnostics; 10 | using System.Drawing; 11 | using System.Drawing.Imaging; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace ProjectEvent.Core.Action.Actions 16 | { 17 | public class SystemNotificationAction : IAction 18 | { 19 | public event ActionInvokeHandler OnEventStateChanged; 20 | 21 | public System.Action GenerateAction(int taskID, ActionModel action) 22 | { 23 | return () => 24 | { 25 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 26 | var p = ObjectConvert.Get(action.Parameter); 27 | p.Title = ActionParameterConverter.ConvertToString(taskID, p.Title); 28 | p.Content = ActionParameterConverter.ConvertToString(taskID, p.Content); 29 | p.Icon = ActionParameterConverter.ConvertToString(taskID, p.Icon); 30 | p.Url = ActionParameterConverter.ConvertToString(taskID, p.Url); 31 | 32 | try 33 | { 34 | NotificationService notificationService = new NotificationService(); 35 | notificationService.ShowNotification(p.Title, p.Content, p.ToastScenarioType, p.Icon, p.ToastActionType, p.Url); 36 | } 37 | catch (Exception e) 38 | { 39 | LogHelper.Error(e.ToString()); 40 | } 41 | //返回数据 42 | //ActionTaskResulter.Add(taskID, result); 43 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 44 | }; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Net/NetworkWatcher.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Win32; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Net.NetworkInformation; 5 | using System.Text; 6 | 7 | namespace ProjectEvent.Core.Net 8 | { 9 | public class NetworkWatcher 10 | { 11 | /// 12 | /// 网络连接时发生 13 | /// 14 | public event EventHandler NetworkConnected; 15 | /// 16 | /// 网络断开时发生 17 | /// 18 | public event EventHandler NetworkDisconnect; 19 | 20 | /// 21 | /// 当前网络状态 22 | /// 23 | private bool isconnected = false; 24 | 25 | private bool iswatching = false; 26 | private long lfag; 27 | public NetworkWatcher() 28 | { 29 | isconnected = CommonWin32API.InternetGetConnectedState(out lfag, 0); 30 | } 31 | 32 | public void Watch() 33 | { 34 | if (!iswatching) 35 | { 36 | iswatching = true; 37 | NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; 38 | } 39 | } 40 | 41 | public void StopWatch() 42 | { 43 | if (iswatching) 44 | { 45 | iswatching = false; 46 | NetworkChange.NetworkAddressChanged -= NetworkChange_NetworkAddressChanged; 47 | } 48 | } 49 | 50 | private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) 51 | { 52 | bool isc = CommonWin32API.InternetGetConnectedState(out lfag, 0); 53 | if (isc != isconnected) 54 | { 55 | isconnected = isc; 56 | if (isc) 57 | { 58 | NetworkConnected?.Invoke(this, e); 59 | } 60 | else 61 | { 62 | NetworkDisconnect?.Invoke(this, e); 63 | } 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/RegexAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.Text; 10 | using System.Text.RegularExpressions; 11 | 12 | namespace ProjectEvent.Core.Action.Actions 13 | { 14 | public class RegexAction : IAction 15 | { 16 | public event ActionInvokeHandler OnEventStateChanged; 17 | 18 | public System.Action GenerateAction(int taskID, ActionModel action) 19 | { 20 | return () => 21 | { 22 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 23 | var p = ObjectConvert.Get(action.Parameter); 24 | var result = new ActionResultModel(); 25 | result.ID = action.ID; 26 | result.Result = new Dictionary(); 27 | result.Result.Add((int)RegexResultType.Count, "0"); 28 | p.Content = ActionParameterConverter.ConvertToString(taskID, p.Content); 29 | 30 | try 31 | { 32 | var matchs = Regex.Matches(p.Content, p.Regex); 33 | int i = 0; 34 | foreach (Match match in matchs) 35 | { 36 | result.Result.Add(i, match.Value); 37 | i++; 38 | } 39 | result.Result[(int)RegexResultType.Count] = matchs.Count.ToString(); 40 | } 41 | catch (Exception e) 42 | { 43 | LogHelper.Error(e.ToString()); 44 | } 45 | //返回数据 46 | ActionTaskResulter.Add(taskID, result); 47 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 48 | }; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/ActionParameterConverter.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Event; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace ProjectEvent.Core.Action 8 | { 9 | /// 10 | /// action参数转换器,将参数中的变量转换为相应的数据字符串 11 | /// 12 | public static class ActionParameterConverter 13 | { 14 | public static string ConvertToString(int taskID, string parameter, bool isBreak = false) 15 | { 16 | if (parameter == null) 17 | { 18 | return string.Empty; 19 | } 20 | //事件变量 21 | parameter = EventTemporaryObject.ConvertToContent(taskID, parameter); 22 | //action result value 23 | parameter = ActionTaskResulter.GetActionResultsString(taskID, parameter); 24 | //全局变量 25 | parameter = GlobalVariable.ConvertToContent(parameter); 26 | if (IsHasVariable(parameter) && !isBreak) 27 | { 28 | parameter = ConvertToString(taskID, parameter, true); 29 | } 30 | return parameter; 31 | } 32 | private static bool IsHasVariable(string value) 33 | { 34 | return Regex.IsMatch(value, @"\{(?[0-9]{1,5})\.(?-?[0-9]{1,25})\}") || Regex.IsMatch(value, @"\{@(?[a-zA-Z]{1,25})\}") || Regex.IsMatch(value, @"\{(?[a-zA-Z]{1,25})\}"); 35 | } 36 | public static Dictionary ConvertToKeyValues(int taskID, Dictionary data) 37 | { 38 | var resval = new Dictionary(); 39 | foreach (var item in data) 40 | { 41 | string key = ConvertToString(taskID, item.Key); 42 | string value = ConvertToString(taskID, item.Value); 43 | if (!resval.ContainsKey(key)) 44 | { 45 | resval.Add(key, value); 46 | } 47 | } 48 | return resval; 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/ReadFileAction.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Action.Types.ResultTypes; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.IO; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace ProjectEvent.Core.Action.Actions 15 | { 16 | public class ReadFileAction : IAction 17 | { 18 | public event ActionInvokeHandler OnEventStateChanged; 19 | 20 | public System.Action GenerateAction(int taskID, ActionModel action) 21 | { 22 | return () => 23 | { 24 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 25 | var p = ObjectConvert.Get(action.Parameter); 26 | var result = new ActionResultModel(); 27 | result.ID = action.ID; 28 | result.Result = new Dictionary(); 29 | result.Result.Add((int)ReadFileResultType.IsSuccess, false); 30 | result.Result.Add((int)ReadFileResultType.Content, string.Empty); 31 | 32 | p.FilePath = ActionParameterConverter.ConvertToString(taskID, p.FilePath); 33 | Debug.WriteLine("read file:" + p.FilePath); 34 | try 35 | { 36 | result.Result[(int)ReadFileResultType.Content] = File.ReadAllText(p.FilePath); 37 | result.Result[(int)ReadFileResultType.IsSuccess] = true; 38 | 39 | } 40 | catch (Exception e) 41 | { 42 | LogHelper.Error(e.ToString()); 43 | } 44 | //返回数据 45 | ActionTaskResulter.Add(taskID, result); 46 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 47 | }; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/TabContainer/TabHeaderButton.xaml: -------------------------------------------------------------------------------- 1 | 4 | 35 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Condition/OnProcessCreatedCondition.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Condition.Models; 2 | using ProjectEvent.Core.Event; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Management; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Condition 9 | { 10 | public class OnProcessCreatedCondition : ICondition 11 | { 12 | /// 13 | /// 进程名 14 | /// 15 | public string ProcessName { get; set; } 16 | /// 17 | /// 不区分大小写 18 | /// 19 | public bool Caseinsensitive { get; set; } 20 | /// 21 | /// 模糊匹配 22 | /// 23 | public bool FuzzyMatch { get; set; } 24 | 25 | 26 | public ConditionCheckResultModel Check() 27 | { 28 | //特殊事件,直接通过 29 | var result = new ConditionCheckResultModel(); 30 | result.IsValid = true; 31 | return result; 32 | } 33 | 34 | public bool IsPass(object data = null) 35 | { 36 | if (data == null) 37 | { 38 | return false; 39 | } 40 | var e = data as ManagementBaseObject; 41 | string Name = ((ManagementBaseObject)e["TargetInstance"])["Name"].ToString(); 42 | //string ExecutablePath = ((ManagementBaseObject)e["TargetInstance"])["ExecutablePath"].ToString(); 43 | if (string.IsNullOrEmpty(Name)) 44 | { 45 | return false; 46 | } 47 | //事件条件为空时直接通过 48 | if (string.IsNullOrEmpty(ProcessName)) 49 | { 50 | return true; 51 | } 52 | if (Caseinsensitive) 53 | { 54 | Name = Name.ToLower(); 55 | ProcessName = ProcessName.ToLower(); 56 | } 57 | if (FuzzyMatch) 58 | { 59 | return Name.IndexOf(ProcessName) != -1; 60 | } 61 | else 62 | { 63 | return Name == ProcessName; 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/PageContainer.xaml: -------------------------------------------------------------------------------- 1 | 5 | 34 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/MainService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Toolkit.Uwp.Notifications; 2 | using ProjectEvent.Core.Services.Tasks; 3 | using ProjectEvent.Core.Services.TimerTask; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ProjectEvent.Core.Services 9 | { 10 | public class MainService : IMainService 11 | { 12 | private readonly IDeviceTaskService deviceTaskService; 13 | private readonly ITimerTaskService timerTaskService; 14 | private readonly IProcessTaskService processTaskService; 15 | private readonly IFileTaskService fileTaskService; 16 | private readonly IKeyboardTaskService keyboardTaskService; 17 | private readonly INetworkStatusTaskService networkStatusTaskService; 18 | private readonly IBluetoothTaskService bluetoothTaskService; 19 | public MainService(IDeviceTaskService deviceTaskService, 20 | ITimerTaskService timerTaskService, 21 | IProcessTaskService processTaskService, 22 | IFileTaskService fileTaskService, 23 | IKeyboardTaskService keyboardTaskService, 24 | INetworkStatusTaskService networkStatusTaskService, 25 | IBluetoothTaskService bluetoothTaskService) 26 | { 27 | this.deviceTaskService = deviceTaskService; 28 | this.timerTaskService = timerTaskService; 29 | this.processTaskService = processTaskService; 30 | this.fileTaskService = fileTaskService; 31 | this.keyboardTaskService = keyboardTaskService; 32 | this.networkStatusTaskService = networkStatusTaskService; 33 | this.bluetoothTaskService = bluetoothTaskService; 34 | 35 | } 36 | public void Run() 37 | { 38 | DesktopNotificationManagerCompat.RegisterActivator(); 39 | 40 | //启动所有task service 41 | deviceTaskService.Run(); 42 | timerTaskService.Run(); 43 | processTaskService.Run(); 44 | fileTaskService.Run(); 45 | keyboardTaskService.Run(); 46 | networkStatusTaskService.Run(); 47 | bluetoothTaskService.Run(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Styles/Light/Base/ContextMenu.xaml: -------------------------------------------------------------------------------- 1 | 4 | 46 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Base/Color/Colors.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Media; 5 | 6 | namespace ProjectEvent.UI.Base.Color 7 | { 8 | public class Colors 9 | { 10 | public struct IColor 11 | { 12 | /// 13 | /// 颜色名称 14 | /// 15 | public string Name; 16 | /// 17 | /// 颜色 18 | /// 19 | public string Color; 20 | } 21 | public static Dictionary ColorList = new Dictionary() { 22 | {ColorTypes.Aquamarine,new IColor{Name="碧绿", Color="#00AA90"} }, 23 | {ColorTypes.Black,new IColor{Name="暗黑", Color="#080808"} }, 24 | {ColorTypes.Blue,new IColor{Name="蓝色", Color="#0078d4"} }, 25 | {ColorTypes.Cyan,new IColor{Name="青色", Color="#51A8DD"} }, 26 | {ColorTypes.Gold,new IColor{Name="金色", Color="#EFBB24"} }, 27 | {ColorTypes.Gray,new IColor{Name="灰色", Color="#828282"} }, 28 | {ColorTypes.Green,new IColor{Name="绿色", Color="#56C773"} }, 29 | {ColorTypes.Orange,new IColor{Name="橙色", Color="#E98B2A"} }, 30 | {ColorTypes.Pink,new IColor{Name="粉红", Color="#B5495B"} }, 31 | {ColorTypes.Red,new IColor{Name="赤红", Color="#F3221B"} }, 32 | {ColorTypes.Violet,new IColor{Name="紫色", Color="#77428D"} }, 33 | {ColorTypes.Yellow,new IColor{Name="黄色", Color="#FFC408"} }, 34 | {ColorTypes.White,new IColor{Name="白色", Color="#FFFFFF"} }, 35 | 36 | }; 37 | 38 | public static IColor Get(ColorTypes color) 39 | { 40 | return ColorList[color]; 41 | } 42 | public static SolidColorBrush GetColor(ColorTypes color, double opacity = 1) 43 | { 44 | return GetFromString(ColorList[color].Color, opacity); 45 | } 46 | public static SolidColorBrush GetFromString(string color, double opacity = 1) 47 | { 48 | return new SolidColorBrush((System.Windows.Media.Color)ColorConverter.ConvertFromString(color)) 49 | { 50 | Opacity = opacity 51 | }; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/NotifyIconWpf/Interop/BalloonFlags.cs: -------------------------------------------------------------------------------- 1 | namespace Hardcodet.Wpf.TaskbarNotification.Interop 2 | { 3 | /// 4 | /// Flags that define the icon that is shown on a balloon 5 | /// tooltip. 6 | /// 7 | public enum BalloonFlags 8 | { 9 | /// 10 | /// No icon is displayed. 11 | /// 12 | None = 0x00, 13 | 14 | /// 15 | /// An information icon is displayed. 16 | /// 17 | Info = 0x01, 18 | 19 | /// 20 | /// A warning icon is displayed. 21 | /// 22 | Warning = 0x02, 23 | 24 | /// 25 | /// An error icon is displayed. 26 | /// 27 | Error = 0x03, 28 | 29 | /// 30 | /// Windows XP Service Pack 2 (SP2) and later. 31 | /// Use a custom icon as the title icon. 32 | /// 33 | User = 0x04, 34 | 35 | /// 36 | /// Windows XP (Shell32.dll version 6.0) and later. 37 | /// Do not play the associated sound. Applies only to balloon ToolTips. 38 | /// 39 | NoSound = 0x10, 40 | 41 | /// 42 | /// Windows Vista (Shell32.dll version 6.0.6) and later. The large version 43 | /// of the icon should be used as the balloon icon. This corresponds to the 44 | /// icon with dimensions SM_CXICON x SM_CYICON. If this flag is not set, 45 | /// the icon with dimensions XM_CXSMICON x SM_CYSMICON is used.
46 | /// - This flag can be used with all stock icons.
47 | /// - Applications that use older customized icons (NIIF_USER with hIcon) must 48 | /// provide a new SM_CXICON x SM_CYICON version in the tray icon (hIcon). These 49 | /// icons are scaled down when they are displayed in the System Tray or 50 | /// System Control Area (SCA).
51 | /// - New customized icons (NIIF_USER with hBalloonIcon) must supply an 52 | /// SM_CXICON x SM_CYICON version in the supplied icon (hBalloonIcon). 53 | ///
54 | LargeIcon = 0x20, 55 | 56 | /// 57 | /// Windows 7 and later. 58 | /// 59 | RespectQuietTime = 0x80 60 | } 61 | } -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Action/Actions/JsonDeserializeAction.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using ProjectEvent.Core.Action.Models; 3 | using ProjectEvent.Core.Action.Types; 4 | using ProjectEvent.Core.Helper; 5 | using ProjectEvent.Core.Services; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.IO; 10 | using System.Text; 11 | using System.Text.RegularExpressions; 12 | using System.Threading; 13 | using System.Threading.Tasks; 14 | 15 | namespace ProjectEvent.Core.Action.Actions 16 | { 17 | public class JsonDeserializeAction : IAction 18 | { 19 | public event ActionInvokeHandler OnEventStateChanged; 20 | 21 | public System.Action GenerateAction(int taskID, ActionModel action) 22 | { 23 | return () => 24 | { 25 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Runing); 26 | var p = ObjectConvert.Get(action.Parameter); 27 | var result = new ActionResultModel(); 28 | result.ID = action.ID; 29 | result.Result = new Dictionary(); 30 | result.Result.Add((int)CommonResultKeyType.IsSuccess, false.ToString()); 31 | p.Content = ActionParameterConverter.ConvertToString(taskID, p.Content); 32 | 33 | Debug.WriteLine("JsonDeserialize:" + p.Content); 34 | try 35 | { 36 | //尝试用正则表达式取出有效范围 37 | var regx = Regex.Match(p.Content, @"\{([\s\S]*)\}"); 38 | if (regx.Success) 39 | { 40 | p.Content = regx.Value; 41 | } 42 | result.Result[-1] = JsonConvert.DeserializeObject(p.Content); 43 | result.Result[(int)CommonResultKeyType.IsSuccess] = true; 44 | 45 | } 46 | catch (Exception e) 47 | { 48 | LogHelper.Error(e.ToString()); 49 | } 50 | //返回数据 51 | ActionTaskResulter.Add(taskID, result); 52 | OnEventStateChanged?.Invoke(taskID, action.ID, ActionInvokeStateType.Done); 53 | }; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/Action/ActionContainer.xaml: -------------------------------------------------------------------------------- 1 | 6 | 40 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Data/HttpRequestActionData.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using ProjectEvent.Core.Action.Types.ResultTypes; 3 | using ProjectEvent.Core.Net.Types; 4 | using ProjectEvent.UI.Controls.Action.Models; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | 10 | namespace ProjectEvent.UI.Controls.Action.Data 11 | { 12 | public class HttpRequestActionData 13 | { 14 | public static List PamramsTypes = new List() 15 | { 16 | new ComBoxModel() 17 | { 18 | ID = (int)ParamsType.Json, 19 | DisplayName = "Json" 20 | }, 21 | new ComBoxModel() 22 | { 23 | ID = (int)ParamsType.FormData, 24 | DisplayName = "Form" 25 | }, 26 | 27 | }; 28 | public static ComBoxModel GetPamramsType(int id) 29 | { 30 | return PamramsTypes.Where(m => m.ID == id).FirstOrDefault(); 31 | } 32 | 33 | public static List MethodTypes = new List() 34 | { 35 | new ComBoxModel() 36 | { 37 | ID = (int)MethodType.GET, 38 | DisplayName = "GET" 39 | }, 40 | new ComBoxModel() 41 | { 42 | ID = (int)MethodType.POST, 43 | DisplayName = "POST" 44 | }, 45 | 46 | }; 47 | public static ComBoxModel GetMethodType(int id) 48 | { 49 | return MethodTypes.Where(m => m.ID == id).FirstOrDefault(); 50 | } 51 | 52 | //public static List ActionResults = new List() 53 | //{ 54 | // new ComBoxModel() 55 | // { 56 | // ID = (int)HttpResultType.IsSuccess, 57 | // DisplayName = "是否成功(true,false)" 58 | // }, 59 | // new ComBoxModel() 60 | // { 61 | // ID = (int)HttpResultType.StatusCode, 62 | // DisplayName = "状态码" 63 | // }, 64 | // new ComBoxModel() 65 | // { 66 | // ID = (int)HttpResultType.Content, 67 | // DisplayName = "响应内容" 68 | // }, 69 | 70 | //}; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/ProjectEvent.Core/Services/MyNotificationActivator.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Toolkit.Uwp.Notifications; 2 | using ProjectEvent.Core.Types; 3 | using System; 4 | using System.Diagnostics; 5 | using System.IO; 6 | using System.IO.Pipes; 7 | using System.Runtime.InteropServices; 8 | using System.Windows; 9 | 10 | namespace ProjectEvent.Core.Services 11 | { 12 | [ClassInterface(ClassInterfaceType.None)] 13 | [ComSourceInterfaces(typeof(INotificationActivationCallback))] 14 | [Guid("891c9d99-9e37-4119-bad1-0505feed12b2"), ComVisible(true)] 15 | public class MyNotificationActivator : NotificationActivator 16 | { 17 | public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId) 18 | { 19 | 20 | Application.Current.Dispatcher.Invoke(delegate 21 | { 22 | if (invokedArgs.Length > 0) 23 | { 24 | ToastActionType actionType = (ToastActionType)int.Parse(invokedArgs.Split('`')[0]); 25 | switch (actionType) 26 | { 27 | case ToastActionType.Url: 28 | string url = invokedArgs.Split('`')[1]; 29 | if (!string.IsNullOrEmpty(url)) 30 | { 31 | //MessageBox.Show("打开URL:" + url); 32 | ProcessStartInfo psi = new ProcessStartInfo 33 | { 34 | FileName = url, 35 | UseShellExecute = true 36 | }; 37 | Process.Start(psi); 38 | } 39 | break; 40 | default: 41 | var client = new NamedPipeClientStream(nameof(ProjectEvent)); 42 | client.Connect(); 43 | StreamWriter writer = new StreamWriter(client); 44 | string input = "0"; 45 | writer.WriteLine(input); 46 | writer.Flush(); 47 | break; 48 | } 49 | } 50 | }); 51 | // TODO: Handle activation 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Themes/IconSelection/IconSelection.xaml: -------------------------------------------------------------------------------- 1 | 5 | 41 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Data/SystemNotificationActionData.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Types; 2 | using ProjectEvent.Core.Action.Types.ResultTypes; 3 | using ProjectEvent.Core.Net.Types; 4 | using ProjectEvent.Core.Types; 5 | using ProjectEvent.UI.Controls.Action.Models; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | 11 | namespace ProjectEvent.UI.Controls.Action.Data 12 | { 13 | public class SystemNotificationActionData 14 | { 15 | public static List ToastScenarioTypes = new List() 16 | { 17 | new ComBoxModel() 18 | { 19 | ID=(int)ToastScenarioType.Default, 20 | DisplayName="默认" 21 | }, 22 | new ComBoxModel() 23 | { 24 | ID=(int)ToastScenarioType.Reminder, 25 | DisplayName="提醒通知" 26 | }, 27 | new ComBoxModel() 28 | { 29 | ID=(int)ToastScenarioType.Alarm, 30 | DisplayName="警报通知" 31 | }, 32 | new ComBoxModel() 33 | { 34 | ID=(int)ToastScenarioType.IncomingCall, 35 | DisplayName="来电通知" 36 | }, 37 | }; 38 | public static ComBoxModel GetToastScenarioType(int id) 39 | { 40 | return ToastScenarioTypes.Where(m => m.ID == id).FirstOrDefault(); 41 | } 42 | public static List ToastActionTypes = new List() 43 | { 44 | new ComBoxModel() 45 | { 46 | ID=(int)ToastActionType.Default, 47 | DisplayName="默认(启动主程序或显示主窗口)" 48 | }, 49 | new ComBoxModel() 50 | { 51 | ID=(int)ToastActionType.Url, 52 | DisplayName="打开一个链接" 53 | }, 54 | 55 | }; 56 | public static ComBoxModel GetToastActionType(int id) 57 | { 58 | return ToastActionTypes.Where(m => m.ID == id).FirstOrDefault(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/ProjectEvent.UI/Controls/Action/Builders/ShutdownActionBuilder.cs: -------------------------------------------------------------------------------- 1 | using ProjectEvent.Core.Action.Models; 2 | using ProjectEvent.Core.Action.Types; 3 | using ProjectEvent.Core.Helper; 4 | using ProjectEvent.UI.Controls.Action.Data; 5 | using ProjectEvent.UI.Controls.Action.Models; 6 | using ProjectEvent.UI.Models.DataModels; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace ProjectEvent.UI.Controls.Action.Builders 12 | { 13 | public class ShutdownActionBuilder : IActionBuilder 14 | { 15 | private ActionItemModel actionItem; 16 | private Core.Action.Models.ActionModel action; 17 | private List actionResultKeys; 18 | public ShutdownActionBuilder() 19 | { 20 | actionItem = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Shutdown); 21 | action = new Core.Action.Models.ActionModel(); 22 | action.Action = Core.Action.Types.ActionType.Shutdown; 23 | actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Shutdown); 24 | 25 | 26 | } 27 | public ActionItemModel GetActionItemModel() 28 | { 29 | ImportAction(action); 30 | return actionItem; 31 | } 32 | public Core.Action.Models.ActionModel GetCoreActionModel() 33 | { 34 | ImportActionItem(actionItem); 35 | return action; 36 | } 37 | public List GetBaseActionInputModels() 38 | { 39 | return null; 40 | } 41 | 42 | public List GetDetailActionInputModels() 43 | { 44 | return null; 45 | } 46 | 47 | public object GetInputModelData() 48 | { 49 | return null; 50 | } 51 | 52 | public List GetResultKeys() 53 | { 54 | return actionResultKeys; 55 | } 56 | 57 | public void ImportAction(Core.Action.Models.ActionModel action) 58 | { 59 | this.action = action; 60 | //构建ui action 61 | actionItem.ID = action.ID; 62 | } 63 | 64 | public void ImportActionItem(ActionItemModel actionItem) 65 | { 66 | this.actionItem = actionItem; 67 | //构建core action 68 | action.ID = actionItem.ID; 69 | } 70 | } 71 | } 72 | --------------------------------------------------------------------------------