private async void cbH2SkullToggleChecked(object sender, RoutedEventArgs e) { var checkbox = sender as CheckBox; if (checkbox == null) { return; } Halo2Skull skull = (Halo2Skull)checkbox.Tag; bool newEnabled = checkbox.IsChecked ?? false; await H2EngineFunctions.SetSkullEnabled(skull, newEnabled); }
public static async Task SetSkullEnabled(Halo2Skull skull, bool enabled) { InteropRequest request = new InteropRequest(); request.header.RequestType = InteropRequestType.Halo2SetCheatEnabled; request.header.RequestPayloadSize = Marshal.SizeOf(typeof(Halo2SetSkullEnabledRequest)); var payload = new Halo2SetSkullEnabledRequest(); payload.Skull = (int)skull; payload.Enabled = enabled; request.requestData = TASInterop.MarshalObjectToArray(payload); var response = await TASInterop.MakeRequestAsync(request); if (response?.header.ResponseType != InteropResponseType.Success) { // Something went wrong } }