| | |
| | | DataString = device.AreaSceneID.ToString () |
| | | }); |
| | | } |
| | | } else if (common.Type == DeviceType.UniversalDevice) {//2020-09-02 新增通用开关 |
| | | var device = Newtonsoft.Json.JsonConvert.DeserializeObject<UniversalDevice> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath))); |
| | | if (device != null) { |
| | | uploadScene.DeviceListObject.Add (new AddCloudSceneDeviceData () { |
| | | Command = (int)Command.SetCommonSwitch, SubnetId = device.SubnetID, DeviceId = device.DeviceID, |
| | | DeviceName = device.Name, DeviceType = "UniversalDevice", LoopId = device.LoopID, |
| | | DataString = device.SendBytes[1].ToString(), |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | alexaDeviceLista = ReadDeviceList (); |
| | | Application.RunOnMainThread (() => { |
| | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="bodyView"></param> |
| | | /// <param name="isScene"></param> |
| | | void AddTopTitleView (VerticalScrolViewLayout bodyView, bool isScene = false) { |
| | | var chooseTypeView = new RowLayout () { |
| | | Height = Application.GetRealHeight (80), |
| | | BackgroundColor = SkinStyle.Current.TitileView, |
| | | }; |
| | | bodyView.AddChidren (chooseTypeView); |
| | | Button btnEquipmentIcon = new Button () { |
| | | Width = Application.GetRealHeight (65), |
| | | Height = Application.GetRealHeight (65), |
| | | UnSelectedImagePath = "Item/LogicModule.png", |
| | | X = Application.GetRealWidth (30), |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | chooseTypeView.AddChidren (btnEquipmentIcon); |
| | | |
| | | Button btnEquipmentType = new Button () { |
| | | Width = Application.GetRealHeight (460), |
| | | X = btnEquipmentIcon.Right, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = Language.StringByID (R.MyInternationalizationString.Device), |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | | SelectedTextColor = SkinStyle.Current.DialogTextColor |
| | | }; |
| | | chooseTypeView.AddChidren (btnEquipmentType); |
| | | |
| | | if (isScene) { |
| | | btnEquipmentIcon.UnSelectedImagePath = "Scene/Scene.png"; |
| | | btnEquipmentType.Text = Language.StringByID (R.MyInternationalizationString.Scenes); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加设备界面 |
| | | /// </summary> |
| | | public void InitDevcieRow (List<UpdateDeviceObj> list, VerticalScrolViewLayout bodyView) |
| | | { |
| | | bodyView.RemoveAll (); |
| | | |
| | | if (list.Count > 0) { |
| | | //添加标题 |
| | | AddTopTitleView (bodyView); |
| | | } |
| | | |
| | | foreach (var device in list) { |
| | | var rowView = new RowLayout () { |
| | | Height = Application.GetRealHeight (110), |
| | |
| | | alert.Show (); |
| | | alert.ResultEventHandler += (s, dd) => { |
| | | if (dd) { |
| | | if (DelDevice (device.Id)) { |
| | | //if (DelDevice (device.Id)) { |
| | | // rowView.RemoveFromParent (); |
| | | // list.Remove (device); |
| | | //} |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load)); |
| | | }); |
| | | try { |
| | | var result = DelDevice (device.Id); |
| | | Application.RunOnMainThread (() => { |
| | | if (result) { |
| | | rowView.RemoveFromParent (); |
| | | list.Remove (device); |
| | | } |
| | | }); |
| | | |
| | | } catch { } finally { |
| | | |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | }; |
| | |
| | | /// </summary> |
| | | public void InitSceneRow (List<SceneByRegion> list, VerticalScrolViewLayout bodyView) |
| | | { |
| | | if (list.Count > 0) { |
| | | //添加标题 |
| | | AddTopTitleView (bodyView, true); |
| | | } |
| | | |
| | | foreach (var scene in list) { |
| | | var rowView = new RowLayout () { |
| | | Height = Application.GetRealHeight (110), |
| | |
| | | alert.Show (); |
| | | alert.ResultEventHandler += (s, dd) => { |
| | | if (dd) { |
| | | if (DelScene (scene.SceneId)) { |
| | | //if (DelScene (scene.SceneId)) { |
| | | // rowView.RemoveFromParent (); |
| | | // list.Remove (scene); |
| | | //} |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load)); |
| | | }); |
| | | try { |
| | | var result = DelScene (scene.SceneId); |
| | | Application.RunOnMainThread (() => { |
| | | if (result) { |
| | | rowView.RemoveFromParent (); |
| | | list.Remove (scene); |
| | | } |
| | | }); |
| | | |
| | | } catch { } finally { |
| | | |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | }; |