From d9a55349ec98f58074de9d1fb271658ada5c589f Mon Sep 17 00:00:00 2001 From: Nguyen Quy Hy Date: Mon, 16 Dec 2024 02:34:45 -0500 Subject: [PATCH] Update to use dialUp and dialDown from SD 6.1 --- .gitmodules | 3 +++ FlightStreamDeck.AddOn/manifest.json | 2 +- FlightStreamDeck.Logics/Actions/BaseAction.cs | 27 +++++++++---------- .../FlightStreamDeck.Logics.csproj | 2 +- FlightStreamDeck.sln | 6 +++++ SharpDeck | 1 + 6 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 .gitmodules create mode 160000 SharpDeck diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3c28aa9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "SharpDeck"] + path = SharpDeck + url = https://github.com/nguyenquyhy/SharpDeck diff --git a/FlightStreamDeck.AddOn/manifest.json b/FlightStreamDeck.AddOn/manifest.json index c4a51a3..374c275 100644 --- a/FlightStreamDeck.AddOn/manifest.json +++ b/FlightStreamDeck.AddOn/manifest.json @@ -437,6 +437,6 @@ } ], "Software": { - "MinimumVersion": "4.1" + "MinimumVersion": "6.1" } } \ No newline at end of file diff --git a/FlightStreamDeck.Logics/Actions/BaseAction.cs b/FlightStreamDeck.Logics/Actions/BaseAction.cs index 3c68352..ba98a16 100644 --- a/FlightStreamDeck.Logics/Actions/BaseAction.cs +++ b/FlightStreamDeck.Logics/Actions/BaseAction.cs @@ -86,27 +86,26 @@ public async Task SetFeedbackSafeAsync(object feedback) protected virtual Task OnDialLongPress(ActionEventArgs args) => Task.CompletedTask; - protected override Task OnDialPress(ActionEventArgs args) + protected override Task OnDialDown(ActionEventArgs args) { - if (args.Payload.Pressed) + DialPressStack.Push(args); + if (LongKeyPressInterval > TimeSpan.Zero) { - DialPressStack.Push(args); - if (LongKeyPressInterval > TimeSpan.Zero) + Task.Run(async delegate { - Task.Run(async delegate - { - await Task.Delay(LongKeyPressInterval); - TryHandleDialPress(OnDialLongPress); - }); - } - } - else - { - TryHandleDialPress(OnDialShortPress); + await Task.Delay(LongKeyPressInterval); + TryHandleDialPress(OnDialLongPress); + }); } return Task.CompletedTask; } + protected override Task OnDialUp(ActionEventArgs args) + { + TryHandleDialPress(OnDialShortPress); + return Task.CompletedTask; + } + private void TryHandleDialPress(Func, Task> handler) { if (DialPressStack.TryPop(out var result)) diff --git a/FlightStreamDeck.Logics/FlightStreamDeck.Logics.csproj b/FlightStreamDeck.Logics/FlightStreamDeck.Logics.csproj index 690a96e..942056b 100644 --- a/FlightStreamDeck.Logics/FlightStreamDeck.Logics.csproj +++ b/FlightStreamDeck.Logics/FlightStreamDeck.Logics.csproj @@ -7,12 +7,12 @@ - + diff --git a/FlightStreamDeck.sln b/FlightStreamDeck.sln index eae17df..7558b39 100644 --- a/FlightStreamDeck.sln +++ b/FlightStreamDeck.sln @@ -22,6 +22,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlightStreamDeck.Core", "Fl EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlightStreamDeck.LogicsTests", "FlightStreamDeck.LogicsTests\FlightStreamDeck.LogicsTests.csproj", "{2476F8A1-5018-414A-AF30-D75C7B189C25}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDeck", "SharpDeck\src\SharpDeck\SharpDeck.csproj", "{56FE4160-9205-44D5-A70C-F31B5D42B53A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,6 +50,10 @@ Global {2476F8A1-5018-414A-AF30-D75C7B189C25}.Debug|Any CPU.Build.0 = Debug|Any CPU {2476F8A1-5018-414A-AF30-D75C7B189C25}.Release|Any CPU.ActiveCfg = Release|Any CPU {2476F8A1-5018-414A-AF30-D75C7B189C25}.Release|Any CPU.Build.0 = Release|Any CPU + {56FE4160-9205-44D5-A70C-F31B5D42B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56FE4160-9205-44D5-A70C-F31B5D42B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56FE4160-9205-44D5-A70C-F31B5D42B53A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56FE4160-9205-44D5-A70C-F31B5D42B53A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SharpDeck b/SharpDeck new file mode 160000 index 0000000..3bffaab --- /dev/null +++ b/SharpDeck @@ -0,0 +1 @@ +Subproject commit 3bffaab393d03776eebcf72f5aeb06144b023c1c