Media Buttons
This commit is contained in:
parent
d66abc1f07
commit
b26a183624
@ -12,7 +12,7 @@ namespace FakeeDeck.ButtonType
|
||||
{
|
||||
return
|
||||
"<div class=\"m-2\">" +
|
||||
" <form style=\"margin-bottom: 0px;\" method=\"post\" action=\"keyboard\\stratogem\">" +
|
||||
" <form style=\"margin-bottom: 0px;\" method=\"post\" action=\"button\\stratogem\">" +
|
||||
" <input type=\"hidden\" name=\"stratogem\" value=>" +
|
||||
" <input style=\"background-size: cover; ; width: 150px;height: 150px;background-color: aquamarine;\" type=\"submit\" value=\"\">" +
|
||||
" </form>" +
|
||||
|
43
FakeeDeck/ButtonType/MediaMacro.cs
Normal file
43
FakeeDeck/ButtonType/MediaMacro.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FakeeDeck.ButtonType
|
||||
{
|
||||
internal class MediaMacro
|
||||
{
|
||||
public static Dictionary<string, uint[]> mediaControls = new Dictionary<string, uint[]>
|
||||
{
|
||||
{ "play/pause", new uint[] { 0xB3}},
|
||||
{ "mute", new uint[] { 0xAD }},
|
||||
};
|
||||
|
||||
public static Dictionary<string, string> mediaIcons = new Dictionary<string, string>
|
||||
{
|
||||
{ "play/pause", "fa-play"},
|
||||
{ "mute", "fa-volume-xmark"},
|
||||
};
|
||||
|
||||
public static string getButton(string Key)
|
||||
{
|
||||
return
|
||||
"<div class=\"m-2\">" +
|
||||
" <form style=\"margin-bottom: 0px;\" method=\"post\" action=\"button\\MediaMacro\">" +
|
||||
" <input type=\"hidden\" name=\"control_action\" value=\"" + Key + "\">" +
|
||||
" <button type=\"submit\" value=\"" + Key + "\" style=\"width: 150px;height: 150px;background-color: aquamarine;\" >" +
|
||||
" <i class=\"fa-solid "+ mediaIcons[Key] +"\"></i>" +
|
||||
" </button>" +
|
||||
" </form>" +
|
||||
"</div>";
|
||||
}
|
||||
|
||||
public static bool invokeAction(string control_action)
|
||||
{
|
||||
KeyboardMacro.SendKey(mediaControls[control_action][0]);
|
||||
Console.WriteLine(control_action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -119,8 +119,6 @@ namespace FakeeDeck
|
||||
"</html>";
|
||||
public static string pageData = "";
|
||||
|
||||
|
||||
|
||||
public static async Task HandleIncomingConnections()
|
||||
{
|
||||
bool runServer = true;
|
||||
@ -143,6 +141,7 @@ namespace FakeeDeck
|
||||
Console.WriteLine(req.UserAgent);
|
||||
Console.WriteLine();
|
||||
|
||||
//Parse Port Parameters
|
||||
Dictionary<string, string> postParams = new Dictionary<string, string>();
|
||||
if (req.HttpMethod == "POST")
|
||||
{
|
||||
@ -171,7 +170,6 @@ namespace FakeeDeck
|
||||
{
|
||||
string module = req.Url.AbsolutePath.Replace("/button", "");
|
||||
Console.WriteLine("Call module " + module);
|
||||
Console.WriteLine(postParams["stratogem"]);
|
||||
|
||||
callButtonAction(module, postParams);
|
||||
|
||||
@ -265,6 +263,11 @@ namespace FakeeDeck
|
||||
pageData += HelldiversTwoMacro.getButton(stratogem.Key);
|
||||
}
|
||||
|
||||
foreach (var control in MediaMacro.mediaControls)
|
||||
{
|
||||
pageData += MediaMacro.getButton(control.Key);
|
||||
}
|
||||
|
||||
// Create a Http server and start listening for incoming connections
|
||||
listener = new HttpListener();
|
||||
listener.Prefixes.Add(url);
|
||||
|
Loading…
Reference in New Issue
Block a user