| | |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// wifi名 |
| | | /// </summary> |
| | | private string wifiName = string.Empty; |
| | | /// <summary> |
| | | /// wifi密码 |
| | | /// </summary> |
| | | private string wifiPassword = string.Empty; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | public void ShowForm() |
| | | /// <param name="i_wifiName">wifi名(别的界面传过来的)</param> |
| | | /// <param name="i_wifiPassword">(别的界面传过来的)</param> |
| | | public void ShowForm(string i_wifiName, string i_wifiPassword) |
| | | { |
| | | this.wifiName = i_wifiName; |
| | | this.wifiPassword = i_wifiPassword; |
| | | |
| | | //设置头部信息 |
| | | base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); |
| | | //这个界面的背景需要白色 |
| | |
| | | //搜索时间(秒) |
| | | int searchTime = 5; |
| | | |
| | | #if __IOS__ |
| | | #endif |
| | | #if __Android__ |
| | | //安卓搜索蓝牙(特效问题,加1秒) |
| | | this.StartSearchBluetoothOnAndriod(searchTime + 1); |
| | | #endif |
| | | //搜索蓝牙(特效问题,加1秒) |
| | | this.StartSearchBluetooth(searchTime + 1); |
| | | |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //进度条特效 |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 安卓搜索蓝牙_______________________ |
| | | #region ■ 搜索蓝牙___________________________ |
| | | |
| | | #if __Android__ |
| | | /// <summary> |
| | | /// 安卓搜索蓝牙 |
| | | /// </summary> |
| | | /// <param name="i_searchTime">搜索时间(秒)</param> |
| | | private void StartSearchBluetoothOnAndriod(int i_searchTime) |
| | | private void StartSearchBluetooth(int i_searchTime) |
| | | { |
| | | //开始搜索蓝牙 |
| | | HdlAndroidBluetoothLogic.Current.ScanBluetooth(i_searchTime, (listBluetooth) => |
| | | HdlBluetoothLogic.Current.ScanBluetooth(i_searchTime, (listBluetooth) => |
| | | { |
| | | var listDevice = new List<HdlAndroidBluetoothLogic.BluetoothInfo>(); |
| | | var listDevice = new List<HdlBluetoothLogic.BluetoothInfo>(); |
| | | foreach (var device in listBluetooth) |
| | | { |
| | | //只有这个标识,才是红外宝 |
| | |
| | | if (listDevice.Count == 0) |
| | | { |
| | | //摧毁蓝牙缓存 |
| | | HdlAndroidBluetoothLogic.Current.Dispone(); |
| | | HdlBluetoothLogic.Current.Dispone(); |
| | | //显示失败界面 |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | |
| | | else if (listDevice.Count == 1) |
| | | { |
| | | //如果只检测到一个,则直接连接 |
| | | HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[0], (result) => |
| | | HdlBluetoothLogic.Current.ContectBluetooth(listDevice[0], (result) => |
| | | { |
| | | if (result == true) |
| | | { |
| | |
| | | { |
| | | this.CloseForm(); |
| | | var form = new AddMiniRemoteControlDirection3Page(); |
| | | form.AddForm(); |
| | | form.AddForm(this.wifiName, this.wifiPassword); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | HdlBluetoothLogic.Current.Dispone(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | this.ShowBluetoothListView(listName, (index) => |
| | | { |
| | | //如果只检测到一个,则直接连接 |
| | | HdlAndroidBluetoothLogic.Current.ContectBluetooth(listDevice[index], (result) => |
| | | HdlBluetoothLogic.Current.ContectBluetooth(listDevice[index], (result) => |
| | | { |
| | | if (result == true) |
| | | { |
| | |
| | | { |
| | | this.CloseForm(); |
| | | var form = new AddMiniRemoteControlDirection3Page(); |
| | | form.AddForm(); |
| | | form.AddForm(this.wifiName, this.wifiPassword); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | HdlBluetoothLogic.Current.Dispone(); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | #endif |
| | | |
| | | #endregion |
| | | |
| | |
| | | var btnReSearch = this.AddBottomClickButton(Language.StringByID(StringId.ReSearch)); |
| | | btnReSearch.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | //检测蓝牙需要的东西 |
| | | btnReSearch.CanClick = false; |
| | | HdlBluetoothLogic.Current.CheckCanScanBluetooth((result) => |
| | | { |
| | | btnReSearch.CanClick = true; |
| | | if (result == true) |
| | | { |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | }); |
| | | }; |
| | | } |
| | | |