From 07929fe25e4d4ce07e27e3632ceaaff668920f89 Mon Sep 17 00:00:00 2001 From: NathanGuo Date: Thu, 12 Jun 2025 17:34:21 +0800 Subject: [PATCH 1/3] add command --- .../.idea.AndroidPDACommand/.idea/.gitignore | 13 ++++ .idea/.idea.AndroidPDACommand/.idea/.name | 1 + .../.idea/indexLayout.xml | 8 ++ .idea/.idea.AndroidPDACommand/.idea/vcs.xml | 6 ++ AndroidPDACommand.csproj | 13 ++-- OnKeyDown_Listen_Start_Async.cs | 24 ++++++ OnKeyDown_Listen_Stop.cs | 20 +++++ OnKeyDown_Listen_Stop_All.cs | 15 ++++ Resources/AndroidPDACommand.js | 78 +++++++++++++++++++ 9 files changed, 173 insertions(+), 5 deletions(-) create mode 100644 .idea/.idea.AndroidPDACommand/.idea/.gitignore create mode 100644 .idea/.idea.AndroidPDACommand/.idea/.name create mode 100644 .idea/.idea.AndroidPDACommand/.idea/indexLayout.xml create mode 100644 .idea/.idea.AndroidPDACommand/.idea/vcs.xml create mode 100644 OnKeyDown_Listen_Start_Async.cs create mode 100644 OnKeyDown_Listen_Stop.cs create mode 100644 OnKeyDown_Listen_Stop_All.cs diff --git a/.idea/.idea.AndroidPDACommand/.idea/.gitignore b/.idea/.idea.AndroidPDACommand/.idea/.gitignore new file mode 100644 index 0000000..34a0510 --- /dev/null +++ b/.idea/.idea.AndroidPDACommand/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.AndroidPDACommand.iml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.AndroidPDACommand/.idea/.name b/.idea/.idea.AndroidPDACommand/.idea/.name new file mode 100644 index 0000000..03a2f9c --- /dev/null +++ b/.idea/.idea.AndroidPDACommand/.idea/.name @@ -0,0 +1 @@ +AndroidPDACommand \ No newline at end of file diff --git a/.idea/.idea.AndroidPDACommand/.idea/indexLayout.xml b/.idea/.idea.AndroidPDACommand/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.AndroidPDACommand/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.AndroidPDACommand/.idea/vcs.xml b/.idea/.idea.AndroidPDACommand/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.AndroidPDACommand/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AndroidPDACommand.csproj b/AndroidPDACommand.csproj index 0a48bc3..0054ddd 100644 --- a/AndroidPDACommand.csproj +++ b/AndroidPDACommand.csproj @@ -41,17 +41,17 @@ - C:\Program Files\Forguncy 8\Website\designerBin\Forguncy.Commands.dll + D:\Forguncy 8\Website\designerBin\Forguncy.Commands.dll - C:\Program Files\Forguncy 8\Website\designerBin\Forguncy.Commands.Design.dll + D:\Forguncy 8\Website\designerBin\Forguncy.Commands.Design.dll - C:\Program Files\Forguncy 8\Website\designerBin\GrapeCity.Forguncy.Plugin.dll + D:\Forguncy 8\Website\designerBin\GrapeCity.Forguncy.Plugin.dll False - C:\Program Files\Forguncy 8\Website\bin\GrapeCity.Forguncy.ServerApi.dll + D:\Forguncy 8\Website\bin\GrapeCity.Forguncy.ServerApi.dll packages\Jiguang.JPush.1.2.5\lib\net45\Jiguang.JPush.dll @@ -85,6 +85,9 @@ + + + @@ -201,6 +204,6 @@ - "E:\CODE\PluginTools\PluginPackageTool\bin\Release\PluginPackageTool.exe" "$(ProjectDir)\" "$(ConfigurationName)" + "D:\ForguncyCode\puglin\PluginTools\PluginPackageTool\bin\Release\PluginPackageTool.exe" "$(ProjectDir)\" "$(ConfigurationName)" \ No newline at end of file diff --git a/OnKeyDown_Listen_Start_Async.cs b/OnKeyDown_Listen_Start_Async.cs new file mode 100644 index 0000000..fbfae7a --- /dev/null +++ b/OnKeyDown_Listen_Start_Async.cs @@ -0,0 +1,24 @@ +using System.ComponentModel; +using GrapeCity.Forguncy.Commands; +using GrapeCity.Forguncy.Plugin; + +namespace AndroidPDACommand +{ + [Category("活字格安卓容器(HAC)")] + [OrderWeight(780)] + public class OnKeyDown_Listen_Start_Async : BaseAsyncCommand + { + public override string ToString() + { + return "开始监听物理按键"; // 命令列表中默认显示的名称 + } + + [DisplayName("按键")] + [ComboProperty(ValueList = "a|b|c", IsSelectOnly = false)] + public string TheKey { get; set; } + + [Browsable(false)] + [ResultToProperty] + public string SubCommandParam1 { get; set; } = "key"; + } +} \ No newline at end of file diff --git a/OnKeyDown_Listen_Stop.cs b/OnKeyDown_Listen_Stop.cs new file mode 100644 index 0000000..5d5077c --- /dev/null +++ b/OnKeyDown_Listen_Stop.cs @@ -0,0 +1,20 @@ +using System.ComponentModel; +using GrapeCity.Forguncy.Plugin; + +namespace AndroidPDACommand +{ + + [Category("活字格安卓容器(HAC)")] + [OrderWeight(781)] + public class OnKeyDown_Listen_Stop : BaseCommand + { + public override string ToString() + { + return "停止监听指定物理按键"; + } + + [DisplayName("按键")] + [ComboProperty(ValueList = "a|b|c", IsSelectOnly = false)] + public string TheKey { get; set; } + } +} \ No newline at end of file diff --git a/OnKeyDown_Listen_Stop_All.cs b/OnKeyDown_Listen_Stop_All.cs new file mode 100644 index 0000000..ac893e9 --- /dev/null +++ b/OnKeyDown_Listen_Stop_All.cs @@ -0,0 +1,15 @@ +using System.ComponentModel; +using GrapeCity.Forguncy.Plugin; + +namespace AndroidPDACommand +{ + [Category("活字格安卓容器(HAC)")] + [OrderWeight(782)] + public class OnKeyDown_Listen_Stop_All : BaseCommand + { + public override string ToString() + { + return "停止监听所有物理按键"; + } + } +} \ No newline at end of file diff --git a/Resources/AndroidPDACommand.js b/Resources/AndroidPDACommand.js index 8a20f24..22b0081 100644 --- a/Resources/AndroidPDACommand.js +++ b/Resources/AndroidPDACommand.js @@ -2403,3 +2403,81 @@ var GenericBroadcast_Start_Async_Command = (function (_super) { Forguncy.CommandFactory.registerCommand("AndroidPDACommand.GenericBroadcast_Start_Async, AndroidPDACommand", GenericBroadcast_Start_Async_Command); +var OnKeyDown_Listen_Start_Async_Command = (function (_super) { + __extends(OnKeyDown_Listen_Start_Async_Command, _super); + function OnKeyDown_Listen_Start_Async_Command() { + return _super !== null && _super.apply(this, arguments) || this; + } + + OnKeyDown_Listen_Start_Async_Command.prototype.execute = function () { + var params = this.CommandParam; + var theKey = this.evaluateFormula(params.TheKey); + var me = this; + + var ticket = HAC_GenerateCallbackTicket(me, function (payload, payload2) { + me.CommandExecutor.excuteCommand(me.CommandParam.CommandList, { + runTimePageName: me.CommandExecutingInfo.runTimePageName, + commandID: new Date().valueOf().toString(), + initParams: { + "ExtrasInJSON": payload, + "IsSuccess": true, + "Error": "" + }, + locationString: "执行window.onKeyDownListen.startOnKeyDownListenAsync的回调" + }); + }); + + if (window.onKeyDownListen && window.onKeyDownListen.startOnKeyDownListenAsync) { + window.onKeyDownListen.startOnKeyDownListenAsync(ticket, theKey); + } else { + HAC_CallFunctionOutOfHAC(); + } + } + + return OnKeyDown_Async_Command; +}(Forguncy.CommandBase)); + +Forguncy.CommandFactory.registerCommand("AndroidPDACommand.OnKeyDown_Listen_Start_Async, AndroidPDACommand", OnKeyDown_Listen_Start_Async_Command); + +var OnKeyDown_Listen_Stop_Command = (function (_super) { + __extends(OnKeyDown_Listen_Stop_Command, _super); + function OnKeyDown_Listen_Stop_Command() { + return _super !== null && _super.apply(this, arguments) || this; + } + + OnKeyDown_Listen_Stop_Command.prototype.execute = function () { + + var params = this.CommandParam; + var theKey = this.evaluateFormula(params.TheKey); + + if (window.onKeyDownListen && window.onKeyDownListen.stopOnKeyDownListen) { + window.onKeyDownListen.stopOnKeyDownListen(theKey); + } else { + HAC_CallFunctionOutOfHAC(); + } + }; + + return OnKeyDown_Listen_Stop_Command; +}(Forguncy.CommandBase)); + +Forguncy.CommandFactory.registerCommand("AndroidPDACommand.OnKeyDown_Listen_Stop, AndroidPDACommand", OnKeyDown_Listen_Stop_Command); + +var OnKeyDown_Listen_Stop_All_Command = (function (_super) { + __extends(OnKeyDown_Listen_Stop_All_Command, _super); + function OnKeyDown_Listen_Stop_All_Command() { + return _super !== null && _super.apply(this, arguments) || this; + } + + OnKeyDown_Listen_Stop_All_Command.prototype.execute = function () { + + if (window.onKeyDownListen && window.onKeyDownListen.stopAllOnKeyDownListen) { + window.onKeyDownListen.stopAllOnKeyDownListen(); + } else { + HAC_CallFunctionOutOfHAC(); + } + }; + + return OnKeyDown_Listen_Stop_Command; +}(Forguncy.CommandBase)); + +Forguncy.CommandFactory.registerCommand("AndroidPDACommand.OnKeyDown_Listen_Stop_All, AndroidPDACommand", OnKeyDown_Listen_Stop_All_Command); \ No newline at end of file -- Gitee From af40b7974ebba3e39500fd9e216b7bd2f1041eaa Mon Sep 17 00:00:00 2001 From: NathanGuo Date: Mon, 16 Jun 2025 12:21:33 +0800 Subject: [PATCH 2/3] change name and select option --- AndroidPDACommand.csproj | 3 +++ OnKeyDown_Listen_Start_Async.cs | 13 +++++++------ OnKeyDown_Listen_Stop.cs | 7 +++++-- OnKeyDown_Listen_Stop_All.cs | 1 + PluginConfig.json | 2 +- Resources/AndroidPDACommand.js | 4 ++-- Resources/Icon_OnKeyDown.png | Bin 0 -> 299 bytes 7 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 Resources/Icon_OnKeyDown.png diff --git a/AndroidPDACommand.csproj b/AndroidPDACommand.csproj index 0054ddd..965a4eb 100644 --- a/AndroidPDACommand.csproj +++ b/AndroidPDACommand.csproj @@ -202,6 +202,9 @@ + + + "D:\ForguncyCode\puglin\PluginTools\PluginPackageTool\bin\Release\PluginPackageTool.exe" "$(ProjectDir)\" "$(ConfigurationName)" diff --git a/OnKeyDown_Listen_Start_Async.cs b/OnKeyDown_Listen_Start_Async.cs index fbfae7a..e6b0174 100644 --- a/OnKeyDown_Listen_Start_Async.cs +++ b/OnKeyDown_Listen_Start_Async.cs @@ -4,6 +4,7 @@ using GrapeCity.Forguncy.Plugin; namespace AndroidPDACommand { + [Icon("pack://application:,,,/AndroidPDACommand;component/Resources/Icon_OnKeyDown.png")] [Category("活字格安卓容器(HAC)")] [OrderWeight(780)] public class OnKeyDown_Listen_Start_Async : BaseAsyncCommand @@ -12,13 +13,13 @@ namespace AndroidPDACommand { return "开始监听物理按键"; // 命令列表中默认显示的名称 } - + [DisplayName("按键")] - [ComboProperty(ValueList = "a|b|c", IsSelectOnly = false)] + [ComboProperty( + ValueList = "82|4|3|24|25|26|84|27|5|6|19|20|21|22|23|7|8|9|10|11|12|13|14|15|16|17|18", + DisplayList = "菜单键|返回键|主页键|音量加键|音量减键|电源键|搜索键|相机键|调用键|挂断键|方向键上|方向键下|方向键左|方向键右|中央选择键|数字键0|数字键1|数字键2|数字键3|数字键4|数字键5|数字键6|数字键7|数字键8|数字键9|星号键|井号键" + )] public string TheKey { get; set; } - - [Browsable(false)] - [ResultToProperty] - public string SubCommandParam1 { get; set; } = "key"; + } } \ No newline at end of file diff --git a/OnKeyDown_Listen_Stop.cs b/OnKeyDown_Listen_Stop.cs index 5d5077c..b6e732a 100644 --- a/OnKeyDown_Listen_Stop.cs +++ b/OnKeyDown_Listen_Stop.cs @@ -3,7 +3,7 @@ using GrapeCity.Forguncy.Plugin; namespace AndroidPDACommand { - + [Icon("pack://application:,,,/AndroidPDACommand;component/Resources/Icon_OnKeyDown.png")] [Category("活字格安卓容器(HAC)")] [OrderWeight(781)] public class OnKeyDown_Listen_Stop : BaseCommand @@ -14,7 +14,10 @@ namespace AndroidPDACommand } [DisplayName("按键")] - [ComboProperty(ValueList = "a|b|c", IsSelectOnly = false)] + [ComboProperty( + ValueList = "82|4|3|24|25|26|84|27|5|6|19|20|21|22|23|7|8|9|10|11|12|13|14|15|16|17|18", + DisplayList = "菜单键|返回键|主页键|音量加键|音量减键|电源键|搜索键|相机键|调用键|挂断键|方向键上|方向键下|方向键左|方向键右|中央选择键|数字键0|数字键1|数字键2|数字键3|数字键4|数字键5|数字键6|数字键7|数字键8|数字键9|星号键|井号键" + )] public string TheKey { get; set; } } } \ No newline at end of file diff --git a/OnKeyDown_Listen_Stop_All.cs b/OnKeyDown_Listen_Stop_All.cs index ac893e9..390597d 100644 --- a/OnKeyDown_Listen_Stop_All.cs +++ b/OnKeyDown_Listen_Stop_All.cs @@ -3,6 +3,7 @@ using GrapeCity.Forguncy.Plugin; namespace AndroidPDACommand { + [Icon("pack://application:,,,/AndroidPDACommand;component/Resources/Icon_OnKeyDown.png")] [Category("活字格安卓容器(HAC)")] [OrderWeight(782)] public class OnKeyDown_Listen_Stop_All : BaseCommand diff --git a/PluginConfig.json b/PluginConfig.json index 0e96309..8c2da3b 100644 --- a/PluginConfig.json +++ b/PluginConfig.json @@ -12,7 +12,7 @@ "name": "PDA(Android)交互命令", "pluginType": "command", "guid": "{16B8DF69-1379-41C1-9194-BE89BAF8BB32}", - "version": "1.19.0.1", + "version": "1.20.0.0", "dependenceVersion": "8.0.0.0", "bundleJavaScript": true, "bundleCSS": true diff --git a/Resources/AndroidPDACommand.js b/Resources/AndroidPDACommand.js index 22b0081..9a994d4 100644 --- a/Resources/AndroidPDACommand.js +++ b/Resources/AndroidPDACommand.js @@ -2434,7 +2434,7 @@ var OnKeyDown_Listen_Start_Async_Command = (function (_super) { } } - return OnKeyDown_Async_Command; + return OnKeyDown_Listen_Start_Async_Command; }(Forguncy.CommandBase)); Forguncy.CommandFactory.registerCommand("AndroidPDACommand.OnKeyDown_Listen_Start_Async, AndroidPDACommand", OnKeyDown_Listen_Start_Async_Command); @@ -2477,7 +2477,7 @@ var OnKeyDown_Listen_Stop_All_Command = (function (_super) { } }; - return OnKeyDown_Listen_Stop_Command; + return OnKeyDown_Listen_Stop_All_Command; }(Forguncy.CommandBase)); Forguncy.CommandFactory.registerCommand("AndroidPDACommand.OnKeyDown_Listen_Stop_All, AndroidPDACommand", OnKeyDown_Listen_Stop_All_Command); \ No newline at end of file diff --git a/Resources/Icon_OnKeyDown.png b/Resources/Icon_OnKeyDown.png new file mode 100644 index 0000000000000000000000000000000000000000..d87a4d465de8afb8d8c0853152023420e774e351 GIT binary patch literal 299 zcmV+`0o4A9P)Px# Date: Mon, 16 Jun 2025 16:55:06 +0800 Subject: [PATCH 3/3] change to 8.0 --- AndroidPDACommand.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AndroidPDACommand.csproj b/AndroidPDACommand.csproj index 965a4eb..bf8628c 100644 --- a/AndroidPDACommand.csproj +++ b/AndroidPDACommand.csproj @@ -41,17 +41,17 @@ - D:\Forguncy 8\Website\designerBin\Forguncy.Commands.dll + D:\ForguncyOtherVersion\8.0.6.0\Website\designerBin\Forguncy.Commands.dll - D:\Forguncy 8\Website\designerBin\Forguncy.Commands.Design.dll + D:\ForguncyOtherVersion\8.0.6.0\Website\designerBin\Forguncy.Commands.Design.dll - D:\Forguncy 8\Website\designerBin\GrapeCity.Forguncy.Plugin.dll + D:\ForguncyOtherVersion\8.0.6.0\Website\designerBin\GrapeCity.Forguncy.Plugin.dll False - D:\Forguncy 8\Website\bin\GrapeCity.Forguncy.ServerApi.dll + D:\ForguncyOtherVersion\8.0.6.0\Website\bin\GrapeCity.Forguncy.ServerApi.dll packages\Jiguang.JPush.1.2.5\lib\net45\Jiguang.JPush.dll -- Gitee