| | |
| | | |
| | | public void ControlScene (string sceneFilePath) |
| | | { |
| | | if (CommonPage.IsRemote) { |
| | | if (!SmartHome.MqttCommon.IsGatewayOnline) { |
| | | new Alert ("", "Gateway offline" + ErrorCode.ControlFailure, "Close").Show (); |
| | | return; |
| | | } |
| | | } |
| | | var tempScene = Scene.GetSceneByFilePath (sceneFilePath); |
| | | if (tempScene == null) |
| | | return; |
| | | showTip = true; |
| | | MainPage.Loading.Start ("Sending..."); |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | int sceneDeviceCount = tempScene.DeviceFilePathList.Count; |
| | | int controlDeviceIndex = 0; |
| | |
| | | replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, device.SubnetID, device.DeviceID, new byte [] { |
| | | device.AreaID,device.AreaSceneID}); |
| | | } |
| | | Application.RunOnMainThread (() => { |
| | | |
| | | try { |
| | | if (showTip) { |
| | | if (replyBytes == null) { |
| | | Application.RunOnMainThread (() => { |
| | | string tipString = Language.StringByID (R.MyInternationalizationString.ControlFailure); |
| | | var btnTip = new Button () { |
| | | Height = Application.GetRealHeight (140), |
| | |
| | | MainPage.MainFrameLayout.AddChidren (btnTip); |
| | | btnTip.MouseUpEventHandler += (sender, e) => { |
| | | btnTip.RemoveFromParent (); |
| | | showTip = false; |
| | | //MainPage.MainFrameLayout.Remove (btnTip); |
| | | }; |
| | | System.Threading.Tasks.Task.Run (() => { |
| | |
| | | Application.RunOnMainThread (() => { |
| | | btnTip.RemoveFromParent (); |
| | | //MainPage.MainFrameLayout.Remove (btnTip); |
| | | showTip = false; |
| | | //showTip = false; |
| | | }); |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | } catch { } |
| | | }); |
| | | |
| | | } |
| | | } else { |
| | | foreach (var common in tempScene.GlobalSceneDeviceList) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | }); |
| | | } |
| | | |