public async void LearnIRCodeAsync(IRCode irCode, string BlasterName) { Rm RMBlaster = GetRMBlasterByName(BlasterName); WLog("Enter learning mode on {0}", BlasterName); var x = await RMBlaster.Auth(); if (x) { x = await RMBlaster.EnterLearning(); if (x) { MessageBox.Show(" Point the remote control to be learned to RM Pro, and press the button. Hit OK finally", "Learning...", MessageBoxButtons.OK); var data = await RMBlaster.CheckData(); if (data.Length > 0) { string code = StringHelper.CreateHexPrintableString(data); WLog("Code={0}", code); irCode.Command = code; } } else { WLog("! Blaster [{0}] not respond", BlasterName); } } else { WLog("! Blaster [{0}] not respond", BlasterName); } }
private async void StartLearningAsync() { var DevName = ((IRCode)dgvIRCodes.CurrentRow.DataBoundItem).Blaster; Rm RMBlaster = GetRMBlasterByName(DevName); WLog("Enter learning mode on {0}", DevName); var x = await RMBlaster.Auth(); if (x) { x = await RMBlaster.EnterLearning(); if (x) { MessageBox.Show(" Point the remote control to be learned to RM Pro, and press the button. Hit OK finally", "Learning...", MessageBoxButtons.OK); var data = await RMBlaster.CheckData(); if (data.Length > 0) { string code = StringHelper.CreateHexPrintableString(data); WLog("Code={0}", code); ((IRCode)dgvIRCodes.CurrentRow.DataBoundItem).Command = code; dgvIRCodes.Refresh(); } } else { WLog("! Blaster [{0}] not respond", DevName); } } else { WLog("! Blaster [{0}] not respond", DevName); } }