private async void cbH1CheatToggleChecked(object sender, RoutedEventArgs e) { var checkbox = sender as CheckBox; if (checkbox == null) { return; } Halo1Cheat cheat = (Halo1Cheat)checkbox.Tag; bool newEnabled = checkbox.IsChecked ?? false; await H1EngineFunctions.SetCheatEnabled(cheat, newEnabled); }
public static async Task SetCheatEnabled(Halo1Cheat cheat, bool enabled) { InteropRequest request = new InteropRequest(); request.header.RequestType = InteropRequestType.Halo1SetCheatEnabled; request.header.RequestPayloadSize = Marshal.SizeOf(typeof(Halo1SetCheatEnabledRequest)); var payload = new Halo1SetCheatEnabledRequest(); payload.Cheat = (int)cheat; payload.Enabled = enabled; request.requestData = TASInterop.MarshalObjectToArray(payload); var response = await TASInterop.MakeRequestAsync(request); if (response?.header.ResponseType != InteropResponseType.Success) { // Something went wrong } }