//using System;
|
//using System.Collections.Generic;
|
|
//namespace Shared.SimpleControl.Phone
|
//{
|
// public class UserSensorAutomationPage : FrameLayout
|
// {
|
// SensorAutomationDevice autonmationDevice;
|
// List<Common> SensorDeviceList;
|
// VerticalScrolViewLayout bodyScrolView;
|
|
// public UserSensorAutomationPage (List<Common> common)
|
// {
|
// autonmationDevice = new SensorAutomationDevice () { SubnetID = common [0].SubnetID, DeviceID = common [0].DeviceID };
|
// SensorDeviceList = common;
|
// }
|
|
// public void ShowPage ()
|
// {
|
// BackgroundColor = SkinStyle.Current.ViewColor;
|
// this.RemoveAll ();
|
// #region 标题
|
// var topView = new FrameLayout () {
|
// Y = Application.GetRealHeight (36),
|
// Height = Application.GetRealHeight (90),
|
// BackgroundColor = SkinStyle.Current.MainColor
|
// };
|
// AddChidren (topView);
|
|
// var title = new Button () {
|
// TextAlignment = TextAlignment.Center,
|
// TextID = R.MyInternationalizationString.AutomationSetting,
|
// TextColor = SkinStyle.Current.TextColor1,
|
// TextSize = 19,
|
// };
|
// topView.AddChidren (title);
|
|
// var logo = new Button () {
|
// Width = Application.GetRealWidth (154),
|
// Height = Application.GetRealHeight (90),
|
// X = Application.GetRealWidth (486),
|
// UnSelectedImagePath = MainPage.LogoString,
|
// };
|
// topView.AddChidren (logo);
|
// //Button ItemButton = new Button () {
|
// // Width = Application.GetRealWidth (55),
|
// // Height = Application.GetRealHeight (55),
|
// // UnSelectedImagePath = "Item/+.png",
|
// // SelectedImagePath = "Item/+.png",
|
// // Y = Application.GetRealHeight (17),
|
// // X = Application.GetRealWidth (640 - 80),
|
// //};
|
// //topView.AddChidren (ItemButton);
|
|
// //ItemButton.MouseUpEventHandler += (sender, e) => {
|
// // Action<string> refLoad = (obj) => {
|
// // InitAutomation ();
|
// // };
|
|
// // var addSensorAutomation = new SensorAutomation ();
|
// // for (int i = 0; i < autonmationDevice.AutomationEnableList.Length; i++) {
|
// // if (autonmationDevice.AutomationEnableList [i] == 255 || autonmationDevice.AutomationEnableList [i] == 0) {
|
// // addSensorAutomation.AutomationId = (byte)i;
|
// // addSensorAutomation.AutomationStatus = 0;
|
// // break;
|
// // }
|
// // }
|
// // var uslp = new UserSensorAutomationSettingPage (SensorDeviceList, autonmationDevice);
|
// // UserMiddle.DevicePageView.AddChidren (uslp);
|
// // uslp.ShowPage (addSensorAutomation,refLoad);
|
// // UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
// //};
|
|
// var back = new Button () {
|
// Height = Application.GetRealHeight (90),
|
// Width = Application.GetRealWidth (85),
|
// UnSelectedImagePath = "Item/Back.png",
|
// SelectedImagePath = "Item/BackSelected.png",
|
// };
|
// topView.AddChidren (back);
|
// back.MouseUpEventHandler += (sender, e) => {
|
// (Parent as PageLayout).PageIndex -= 1;
|
// };
|
// #endregion
|
|
// bodyScrolView = new VerticalScrolViewLayout () {
|
// Y = topView.Bottom,
|
// Height = Application.GetRealHeight (Application.DesignHeight - 126)
|
// };
|
// AddChidren (bodyScrolView);
|
|
// InitAutomation ();
|
// }
|
|
// int loadingCount = 0;
|
|
// void InitAutomation ()
|
// {
|
// bodyScrolView.RemoveAll ();
|
// MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
|
|
// System.Threading.Tasks.Task.Factory.StartNew (() => {
|
// var conditianEnableList = Control.ControlBytesSendHasReturn (Command.ReadSensorAutomationEnableList, autonmationDevice.SubnetID, autonmationDevice.DeviceID, new byte [] { });
|
// var conditionIdList = Control.ControlBytesSendHasReturn (Command.ReadSensorAutomationListID, autonmationDevice.SubnetID, autonmationDevice.DeviceID, new byte [] { });
|
|
// try {
|
// if (conditianEnableList == null || conditionIdList == null) {
|
// //if(loadingCount <2){
|
// // loadingCount++;
|
// // Application.RunOnMainThread (() => {
|
// // MainPage.Loading.Hide ();
|
// // InitAutomation ();
|
// // });
|
// //}
|
// Application.RunOnMainThread (() => {
|
// try {
|
// new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
// MainPage.Loading.Hide ();
|
// if (Parent != null)
|
// (Parent as PageLayout).PageIndex -= 1;
|
// }catch{}
|
// });
|
// return;
|
// }
|
// loadingCount = 0;
|
// this.autonmationDevice.ConditionIdList = conditionIdList;
|
// this.autonmationDevice.AutomationEnableList = conditianEnableList;
|
|
// for (int i = 0; i < this.autonmationDevice.sensorAutomationList.Count; i++) {
|
// var tempAutonmation = this.autonmationDevice.sensorAutomationList [i];
|
// //var targetNameBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorTargetRemark, autonmationDevice.SubnetID, autonmationDevice.DeviceID, new byte [] { (byte)(tempAutonmation.AutomationId / 8),(byte)(tempAutonmation.AutomationId % 8) });
|
// //if (targetNameBytes.Length < 21)
|
// //continue;
|
// Application.RunOnMainThread (() => {
|
// //tempAutonmation.AutomationName = CommonPage.MyEncodingGB2312.GetString (targetNameBytes, 1, 20).Trim ('\0');
|
// switch(tempAutonmation.AutomationId) {
|
// case 0:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorPM25) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipPM25Level1);
|
// break;
|
// case 1:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorPM25) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipPM25Level2);
|
// break;
|
// case 2:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorPM25) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipPM25Level3);
|
// break;
|
// case 3:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorPM25) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipPM25Level4);
|
// break;
|
// case 4:
|
// case 5:
|
// case 6:
|
// case 7:
|
// break;
|
// //----
|
// case 8:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorCO2) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipCO2Level1);
|
// break;
|
// case 9:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorCO2) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipCO2Level2);
|
// break;
|
// case 10:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorCO2) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipCO2Level3);
|
// break;
|
// case 11:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorCO2) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTipCO2Level4);
|
// break;
|
// case 12:
|
// case 13:
|
// case 14:
|
// case 15:
|
// break;
|
// //----
|
// case 16:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTVOC) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTVOCTipLevel1);
|
// break;
|
// case 17:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTVOC) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTVOCTipLevel2);
|
// break;
|
// case 18:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTVOC) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTVOCTipLevel3);
|
// break;
|
// case 19:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTVOC) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTVOCTipLevel4);
|
// break;
|
// case 20:
|
// case 21:
|
// case 22:
|
// case 23:
|
// break;
|
// //----
|
// case 24:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTemperature) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel1);
|
// break;
|
// case 25:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTemperature) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel2);
|
// break;
|
// case 26:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTemperature) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel3);
|
// break;
|
// case 27:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorTemperature) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel4);
|
// break;
|
// case 28:
|
// case 29:
|
// case 30:
|
// case 31:
|
// break;
|
// //----
|
// case 32:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorHumidity) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel1);
|
// break;
|
// case 33:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorHumidity) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel2);
|
// break;
|
// case 34:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorHumidity) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel3);
|
// break;
|
// case 35:
|
// tempAutonmation.AutomationName = Language.StringByID (R.MyInternationalizationString.SensorHumidity) + " " + Language.StringByID (R.MyInternationalizationString.SensorReferenceTempTipLevel4);
|
// break;
|
// case 36:
|
// case 37:
|
// case 38:
|
// case 39:
|
// break;
|
// }
|
// var rowView = new RowLayout () {
|
// Height = Application.GetRealHeight (100),
|
// BackgroundColor = SkinStyle.Current.ViewColor,
|
// };
|
// bodyScrolView.AddChidren (rowView);
|
// var btnPoint = new Button () {
|
// Width = Application.GetMinRealAverage (10),
|
// Height = Application.GetMinRealAverage (10),
|
// Radius = (uint)Application.GetMinRealAverage (5),
|
// X = Application.GetRealWidth (50),
|
// Gravity = Gravity.CenterVertical,
|
// BackgroundColor = SkinStyle.Current.TextColor1,
|
// SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
|
// Tag = i
|
// };
|
// rowView.AddChidren (btnPoint);
|
// var btnDeviceName = new Button () {
|
// Width = Application.GetRealWidth (300),
|
// X = Application.GetRealWidth (80),
|
// Text = tempAutonmation.AutomationName,
|
// TextColor = SkinStyle.Current.TextColor1,
|
// SelectedTextColor = SkinStyle.Current.SelectedColor,
|
// TextAlignment = TextAlignment.CenterLeft,
|
// Tag = i
|
// };
|
// rowView.AddChidren (btnDeviceName);
|
|
// var tempSwitch = new Button () {
|
// Width = Application.GetMinRealAverage (90),
|
// Height = Application.GetMinRealAverage (53),
|
// X = Application.GetRealWidth (640 - 90 - 30),
|
// Gravity = Gravity.CenterVertical,
|
// IsSelected = tempAutonmation.AutomationStatus == 2 ? false : true,
|
// UnSelectedImagePath = "Item/SwitchClose.png",
|
// SelectedImagePath = "Item/SwitchOpen.png",
|
// Tag = tempAutonmation.AutomationId
|
// };
|
// rowView.AddChidren (tempSwitch);
|
|
// tempSwitch.MouseUpEventHandler += (ddff, ffdd) => {
|
// tempSwitch.IsSelected = !tempSwitch.IsSelected;
|
// byte autoEnalbeByte = tempSwitch.IsSelected == true ? (byte)1 : (byte)2;
|
// //MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
|
// System.Threading.Tasks.Task.Run (() => {
|
// try {
|
// var updateId = Convert.ToByte (((Button)ddff).Tag);
|
// var delSensorAutomation = autonmationDevice.sensorAutomationList.Find ((obj) => obj.AutomationId == updateId);//根据自动化ID找到需要删除的自动化
|
// if (delSensorAutomation == null)
|
// return;
|
// autonmationDevice.AutomationEnableList [updateId] = autoEnalbeByte;//将自动化相应的使能改为无效
|
|
// var conditianStatusListRevice = Control.ControlBytesSendHasReturn (Command.SetSensorAutomationEnableList, autonmationDevice.SubnetID, autonmationDevice.DeviceID, autonmationDevice.AutomationEnableList);
|
// } catch (Exception ex) {
|
// Console.WriteLine (ex.Message);
|
// } finally {
|
// //Application.RunOnMainThread (() => {
|
// //MainPage.Loading.Hide ();
|
// //InitAutomation ();
|
// //});
|
// }
|
// });
|
// };
|
|
// //var editor = new Button () {
|
// // UnSelectedImagePath = "Item/EditInRightView.png",
|
// // BackgroundColor = SkinStyle.Current.MainColor,
|
// //};
|
// //if (MainPage.LoginUser.AccountString == "464027401@qq.com")
|
// // rowView.AddRightView (editor);
|
// //editor.MouseUpEventHandler += (sender, e) => {
|
// // Action<string> refLoad = (obj) => {
|
// // btnDeviceName.Text = obj;
|
// // };
|
// // var uslp = new UserSensorAutomationSettingPage (SensorDeviceList, autonmationDevice);
|
// // UserMiddle.DevicePageView.AddChidren (uslp);
|
// // uslp.ShowPage (tempAutonmation, refLoad);
|
// // UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
// //};
|
// //var btnDel = new Button () {
|
// // UnSelectedImagePath = "Item/DelInRightView.png",
|
// // Tag = tempAutonmation.AutomationId
|
// //};
|
// //if (MainPage.LoginUser.AccountString == "464027401@qq.com")
|
// //rowView.AddRightView (btnDel);
|
// //btnDel.MouseUpEventHandler += (ddff, ffdd) => {
|
// // var delAlert = new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.ConfirmDelAutomation), Language.StringByID (R.MyInternationalizationString.cancel), Language.StringByID (R.MyInternationalizationString.confirm));
|
// // delAlert.Show ();
|
// // delAlert.ResultEventHandler += (ddaa, dde) => {
|
// // if (dde) {
|
// // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
|
// // System.Threading.Tasks.Task.Run (() => {
|
// // try {
|
// // var delId = Convert.ToByte (((Button)ddff).Tag);
|
// // var delSensorAutomation = autonmationDevice.sensorAutomationList.Find ((obj) => obj.AutomationId == delId);//根据自动化ID找到需要删除的自动化
|
// // if (delSensorAutomation == null)
|
// // return;
|
// // autonmationDevice.AutomationEnableList [delId] = 0;//将自动化相应的使能改为删除
|
// // for (int delIndex = 0; delIndex < 40; delIndex++) {//循环自动化包含的每一个触发条件
|
// // //var delCondition = delSensorAutomation.sensorAutomationConditionList [delIndex];
|
// // ////读取自动化条件触发目标的使能数据
|
// // //var automationTargetLevelEnable = Control.ControlBytesSendHasReturn (Command.ReadSensorAutomationLevelTargetEnable, autonmationDevice.SubnetID, autonmationDevice.DeviceID, new byte [] { delCondition.PushId });
|
// // //automationTargetLevelEnable [3 * delCondition.ConditionLevel + 1] = 0;//将对应的自动化条件触发的目标使能改为无效
|
// // //automationTargetLevelEnable [3 * delCondition.ConditionLevel + 2] = 0;
|
// // //automationTargetLevelEnable [3 * delCondition.ConditionLevel + 3] = 0;
|
// // //var setAutomationTargetLevelEnable = Control.ControlBytesSendHasReturn (Command.SetSensorAutomationTargetLevelEnable, autonmationDevice.SubnetID, autonmationDevice.DeviceID, automationTargetLevelEnable);
|
// // if (autonmationDevice.ConditionIdList [delIndex] == delId)//将自动化条件绑定的自动化删除
|
// // {
|
// // autonmationDevice.ConditionIdList [delIndex] = 255;
|
// // }
|
// // }
|
// // var conditianStatusListRevice = Control.ControlBytesSendHasReturn (Command.SetSensorAutomationEnableList, autonmationDevice.SubnetID, autonmationDevice.DeviceID, autonmationDevice.AutomationEnableList);
|
// // var conditionIdListRevice = Control.ControlBytesSendHasReturn (Command.SetSensorAutomationListID, autonmationDevice.SubnetID, autonmationDevice.DeviceID, autonmationDevice.ConditionIdList);
|
// // } catch (Exception ex) {
|
// // Console.WriteLine (ex.Message);
|
// // } finally {
|
// // Application.RunOnMainThread (() => {
|
// // MainPage.Loading.Hide ();
|
// // InitAutomation ();
|
// // });
|
// // }
|
// // });
|
// // }
|
// // };
|
// //};
|
|
|
// });
|
// }
|
// } catch (Exception ex) {
|
// Console.WriteLine (ex.Message);
|
// } finally {
|
// Application.RunOnMainThread (() => {
|
// MainPage.Loading.Hide ();
|
// });
|
// }
|
// });
|
// }
|
|
// public void ShowSceneListView (Sensor sensorDevice, byte targetLoop, VerticalScrolViewLayout sceneListView)
|
// {
|
// #region sceneList
|
// ////全部类型的场景列表
|
// //var allSceneFilePaths = new List<string> ();
|
// ////全局场景中所有的场景
|
// //var sceneFileList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath)));
|
// //allSceneFilePaths.AddRange (sceneFileList);
|
// ////房间的所有场景
|
// //foreach (var room in Room.Lists) {
|
// // if (string.IsNullOrEmpty (room.Name)) {
|
// // continue;
|
// // }
|
// // allSceneFilePaths.AddRange (room.SceneFilePathList);
|
// //}
|
|
// //int i = 0;
|
// //foreach (var sceneFilePath in allSceneFilePaths) {
|
// // var scene = Scene.GetSceneByFilePath (sceneFilePath);
|
// // if (scene == null) {
|
// // continue;
|
// // }
|
|
// // var frameLayout = new RowLayout () {
|
// // Height = Application.GetRealHeight (115),
|
// // };
|
// // sceneListView.AddChidren (frameLayout);
|
|
// // var btnRemarkName = new Button () {
|
// // Width = Application.GetRealWidth (420),
|
// // Height = LayoutParams.MatchParent,
|
// // Text = scene.Name,
|
// // TextAlignment = TextAlignment.CenterLeft,
|
// // X = Application.GetRealWidth (80),
|
// // };
|
// // frameLayout.AddChidren (btnRemarkName);
|
|
// // int currentIndex = i;
|
|
// // EventHandler<MouseEventArgs> hander = (sender, e) => {
|
// // var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (sceneFilePath)));
|
|
// // for (int j = 0; j < sceneListView.ChildrenCount; j++) {
|
// // var rowView = sceneListView.GetChildren (j);
|
// // if (rowView.GetType () == typeof (RowLayout)) {
|
// // if (currentIndex == j) {
|
// // ((RowLayout)rowView).BackgroundImagePath = "DoorLockPic/door_lock_ scene_on.png";
|
// // } else {
|
// // ((RowLayout)rowView).BackgroundImagePath = "DoorLockPic/door_lock_ scene.png";
|
// // }
|
// // }
|
// // }
|
|
// // Application.RunOnMainThread (() => {
|
// // MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.TargetsConfiguring) + "...");
|
// // });
|
// // System.Threading.Tasks.Task.Run (() => {
|
// // try {
|
// // var controlSceneBLL = new ScenePhoneMethod ();
|
// // int controlDeviceIndex = 0;
|
// // foreach (var deviceFilePath in tempScene.DeviceFilePathList) {
|
// // if (!tempScene.busScene) {
|
// // if (controlDeviceIndex > 19) {
|
// // break;
|
// // }
|
|
// // var sendBytes = new byte [10];
|
// // sendBytes [0] = sensorDevice.DevicePushType;//开锁
|
// // sendBytes [1] = targetLoop;//开锁类型 密码开锁
|
// // sendBytes [2] = (byte)controlDeviceIndex;
|
|
// // if (deviceFilePath.Split ('_') [1] == DeviceType.LightDimming.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightDimming> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LightDALI.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightDALI> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LightMixDimming.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightMixDimming> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.PhysicsLoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LightMixSwitch.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightMixSwitch> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.PhysicsLoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LightSwitch.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightSwitch> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LightEnergySwitch.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightEnergySwitch> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = device.CurrentBrightness;
|
// // sendBytes [8] = device.DelayTimeHeight;
|
// // sendBytes [9] = device.DelayTimeLow;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.FanModule.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<FanModule> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x59;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = (byte)device.WindSpeed;
|
// // //if (sceneControl (device, sendBytes, btnEditedName, btnRemarkName, sender, sceneFilePath)) {
|
// // // result = true;
|
// // //}
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.CurtainModel.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainModel> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x5C;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = (byte)device.Status;
|
// // //if (sceneControl (device, sendBytes, btnEditedName, btnRemarkName, sender, sceneFilePath)) {
|
// // // result = true;
|
// // //}
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.CurtainRoller.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainRoller> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x5C;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = (byte)device.Status;
|
// // //if (sceneControl (device, sendBytes, btnEditedName, btnRemarkName, sender, sceneFilePath)) {
|
// // // result = true;
|
// // //}
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.CurtainTrietex.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainTrietex> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x5C;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.LoopID;
|
// // sendBytes [7] = (byte)device.Status;
|
// // //if (sceneControl (device, sendBytes, btnEditedName, btnRemarkName, sender, sceneFilePath)) {
|
// // // result = true;
|
// // //}
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.LogicModule.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicModule> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // sendBytes [3] = 0x55;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.AreaID;
|
// // sendBytes [7] = device.AreaSceneID;
|
// // } else if (deviceFilePath.Split ('_') [1] == DeviceType.UniversalDevice.ToString ()) {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<UniversalDevice> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // if (device == null) {
|
// // continue;
|
// // }
|
// // if (device.UniversalType == 0xE01C) {
|
// // sendBytes [3] = 0x58;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = 0 < device.SendBytes.Count ? device.SendBytes [0] : (byte)0;
|
// // sendBytes [7] = 1 < device.SendBytes.Count ? device.SendBytes [1] : (byte)0;
|
// // //if (!sceneControl (device, sendBytes, btnEditedName, btnRemarkName, sender, sceneFilePath)) {
|
// // // result = true;
|
// // //}
|
// // }
|
// // } else {
|
// // continue;
|
// // }
|
// // controlSceneBLL.ControlSceneDevice (deviceFilePath, controlDeviceIndex, 20);
|
// // } else {
|
// // var device = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
|
// // var sendBytes = new byte [10];
|
// // sendBytes [0] = sensorDevice.DevicePushType;
|
// // sendBytes [1] = targetLoop;
|
// // sendBytes [2] = (byte)controlDeviceIndex;
|
// // sendBytes [3] = device.obj1;
|
// // sendBytes [4] = device.SubnetID;
|
// // sendBytes [5] = device.DeviceID;
|
// // sendBytes [6] = device.obj2;
|
// // sendBytes [7] = device.obj3;
|
// // sendBytes [8] = device.obj4;
|
// // sendBytes [9] = device.obj5;
|
// // controlSceneBLL.ControlBusSceneDevice (device);
|
// // }
|
// // controlDeviceIndex++;
|
// // }
|
// // } catch { } finally {
|
// // Application.RunOnMainThread (() => {
|
// // MainPage.Loading.Hide ();
|
// // });
|
// // }
|
// // });
|
// // };
|
|
// // frameLayout.MouseUpEventHandler += hander;
|
// // btnRemarkName.MouseUpEventHandler += hander;
|
// // i++;
|
// //}
|
// #endregion
|
|
// }
|
|
// }
|
//}
|