private void BTClassic_PairInfoRequested(object sender, BT_PairInfoRequest e) { ErrReport report; WrapErr.ToErrReport(out report, 20017, "Failure on BTClassic_PairInfoRequested", () => { if (this.BT_PairInfoRequested != null) { // Build title BT_PairingInfoDataModel dataModel = new BT_PairingInfoDataModel() { RequestTitle = string.Format("{0} ({1})", this.GetText(MsgCode.PairBluetooth), e.DeviceName) }; dataModel.IsPinRequested = e.PinRequested; // Build message dataModel.RequestMsg = e.PinRequested ? this.GetText(MsgCode.EnterPin) : this.GetText(MsgCode.Continue); // push up to user this.BT_PairInfoRequested(sender, dataModel); // copy data from user so BT calling up can determine what to do e.Response = dataModel.HasUserConfirmed; e.Pin = dataModel.PIN; } else { this.log.Error(9999, "No subscribers to the wrapper pair info"); } }); this.RaiseIfException(report); }
private void BT_PairInfoRequestedHandler(object sender, BT_PairingInfoDataModel info) { this.log.InfoEntry("BT_PairInfoRequestedHandler"); this.Dispatcher.Invoke(() => { this.gridWait.Collapse(); if (info.IsPinRequested) { var result = MsgBoxEnterText.ShowBox(this, info.RequestTitle, info.RequestMsg); info.PIN = result.Text; info.HasUserConfirmed = (result.Result == MsgBoxEnterText.MsgBoxTextInputResult.OK); } else { MsgBoxYesNo.MsgBoxResult result2 = MsgBoxYesNo.ShowBox(this, info.RequestMsg, info.RequestMsg); info.HasUserConfirmed = (result2 == MsgBoxYesNo.MsgBoxResult.Yes); } }); }