-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from pulimento/feature/media_actions
Add media actions
- Loading branch information
Showing
6 changed files
with
71 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using FluentResults; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using Serilog; | ||
|
||
namespace WinRemoteControl.Actions | ||
{ | ||
class MediaNextSongAction : IAction | ||
{ | ||
[DllImport("user32.dll")] | ||
public static extern void keybd_event(byte virtualKey, byte scanCode, uint flags, IntPtr extraInfo); | ||
|
||
public Result DoAction() | ||
{ | ||
Log.Information("Skipping to next song"); | ||
keybd_event(Constants.VK_MEDIA_NEXT_TRACK, 0, Constants.KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); // Next Track | ||
return Result.Ok(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using FluentResults; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using Serilog; | ||
|
||
namespace WinRemoteControl.Actions | ||
{ | ||
class MediaPrevSongAction : IAction | ||
{ | ||
[DllImport("user32.dll")] | ||
public static extern void keybd_event(byte virtualKey, byte scanCode, uint flags, IntPtr extraInfo); | ||
|
||
public Result DoAction() | ||
{ | ||
Log.Information("Skipping to previous song"); | ||
keybd_event(Constants.VK_MEDIA_PREV_TRACK, 0, Constants.KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); // Next Track | ||
return Result.Ok(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters