1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-25 15:20:10 +00:00
msfs-popout-panel-manager/SimconnectAgent/TouchPanel/MobiFlightWasmClient.cs

57 lines
1.5 KiB
C#
Raw Normal View History

2022-07-23 19:23:32 +00:00
using Microsoft.FlightSimulator.SimConnect;
namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
{
public class MobiFlightWasmClient
{
public static void Ping(SimConnect simConnect)
{
if (simConnect == null) return;
SendWasmCmd(simConnect, "MF.Ping");
DummyCommand(simConnect);
}
public static void Stop(SimConnect simConnect)
{
if (simConnect == null)
return;
SendWasmCmd(simConnect, "MF.SimVars.Clear");
}
public static void GetLVarList(SimConnect simConnect)
{
if (simConnect == null) return;
SendWasmCmd(simConnect, "MF.LVars.List");
DummyCommand(simConnect);
}
public static void DummyCommand(SimConnect simConnect)
{
if (simConnect == null)
return;
SendWasmCmd(simConnect, "MF.DummyCmd");
}
public static void SendWasmCmd(SimConnect simConnect, string command)
{
if (simConnect == null)
return;
try
{
simConnect.SetClientData(
SIMCONNECT_CLIENT_DATA_ID.MOBIFLIGHT_CMD,
(SIMCONNECT_CLIENT_DATA_ID)0,
SIMCONNECT_CLIENT_DATA_SET_FLAG.DEFAULT, 0,
new ClientDataString(command)
);
}
catch { }
}
}
}