//using System; //namespace Shared.SimpleControl.Phone //{ // public class UserSensorSettingPushPage : FrameLayout // { // public void ShowUserSensorSettingPushPage (System.Collections.Generic.List sensorList) // { // BackgroundColor = SkinStyle.Current.ViewColor; // #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, // //Text = room.Name, // TextID = R.MyInternationalizationString.SetPush, // 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); // 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 // var bodyScrolView = new VerticalScrolViewLayout () { // Y = topView.Bottom, // Height = Application.GetRealHeight (Application.DesignHeight - 126) // }; // AddChidren (bodyScrolView); // foreach (var common in sensorList) { // var device = common as Sensor; // RowLayout rowView = new RowLayout () { // Height = Application.GetRealHeight (100), // }; // 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, // //UnSelectedImagePath = "Item/Point.png", // //SelectedImagePath = "Item/PointSelected.png", // }; // rowView.AddChidren (btnPoint); // Button btnDeviceName = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // Text = device.Name, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.CenterLeft, // }; // rowView.AddChidren (btnDeviceName); // Button rightButton = new Button () { // Width = Application.GetRealWidth (46), // Height = Application.GetRealHeight (47), // Gravity = Gravity.CenterVertical, // X = Application.GetRealWidth (580), // UnSelectedImagePath = "Item/Down.png", // SelectedImagePath = "Item/DownSelected.png", // }; // rowView.AddChidren (rightButton); // VerticalScrolViewLayout setRowList = new VerticalScrolViewLayout () { // Height = 0, // ScrollEnabled = false // }; // bodyScrolView.AddChidren (setRowList); // EventHandler eventHandler = (sender, e) => { // if (rightButton.IsSelected) { // btnPoint.IsSelected = rightButton.IsSelected = btnDeviceName.IsSelected = false; // setRowList.Height = 0; // } else { // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var pushRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 255 }); // Application.RunOnMainThread (() => { // if (pushRevertBytes == null) { // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show (); // pushRevertBytes = new byte [27]; // } // btnPoint.IsSelected = rightButton.IsSelected = btnDeviceName.IsSelected = true; // switch (device.Type) { // case DeviceType.SensorPM25: // setRowList.Height = Application.GetRealHeight (400); // RowLayout rowPM25 = new RowLayout () { // Height = Application.GetRealHeight (100), // BackgroundColor = SkinStyle.Current.SubtitleView, // }; // setRowList.AddChidren (rowPM25); // var btnPM25Type1 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level1, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowPM25.AddChidren (btnPM25Type1); // var btnPM25Push1 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [3] == 1 ? true : false, // Tag = "Switch" // }; // rowPM25.AddChidren (btnPM25Push1); // btnPM25Push1.MouseUpEventHandler += (btnPM25Push1a, btnPM25Push1e) => { // btnPM25Push1.IsSelected = !btnPM25Push1.IsSelected; // byte setPushValua = btnPM25Push1.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowPM252 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowPM252); // var btnPM25Type2 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level2, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowPM252.AddChidren (btnPM25Type2); // var btnPM25Push2 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // Tag = "Switch", // IsSelected = pushRevertBytes [6] == 1 ? true : false, // }; // rowPM252.AddChidren (btnPM25Push2); // btnPM25Push2.MouseUpEventHandler += (btnPM25Push2a, btnPM25Push2e) => { // btnPM25Push2.IsSelected = !btnPM25Push2.IsSelected; // byte setPushValua = btnPM25Push2.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowPM253 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowPM253); // var btnPM25Type3 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level3, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowPM253.AddChidren (btnPM25Type3); // var btnPM25Push3 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowPM253.AddChidren (btnPM25Push3); // btnPM25Push3.MouseUpEventHandler += (btnPM25Push3a, btnPM25Push3e) => { // btnPM25Push3.IsSelected = !btnPM25Push3.IsSelected; // byte setPushValua = btnPM25Push3.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowPM254 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowPM254); // var btnPM25Type4 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level4, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowPM254.AddChidren (btnPM25Type4); // var btnPM25Push4 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowPM254.AddChidren (btnPM25Push4); // btnPM25Push4.MouseUpEventHandler += (btnPM25Push3a, btnPM25Push3e) => { // btnPM25Push4.IsSelected = !btnPM25Push4.IsSelected; // byte setPushValua = btnPM25Push4.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // break; // case DeviceType.SensorCO2: // setRowList.Height = Application.GetRealHeight (400); // RowLayout rowCO2 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowCO2); // var btnCO2Type1 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level1, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowCO2.AddChidren (btnCO2Type1); // var btnCO2Push1 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [3] == 1 ? true : false, // Tag = "Switch" // }; // rowCO2.AddChidren (btnCO2Push1); // btnCO2Push1.MouseUpEventHandler += (btnCO2Push1a, btnCO2Push1e) => { // btnCO2Push1.IsSelected = !btnCO2Push1.IsSelected; // byte setPushValua = btnCO2Push1.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowCO22 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowCO22); // var btnCO2Type2 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level2, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowCO22.AddChidren (btnCO2Type2); // var btnCO2Push2 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [6] == 1 ? true : false, // Tag = "Switch" // }; // rowCO22.AddChidren (btnCO2Push2); // btnCO2Push2.MouseUpEventHandler += (btnCO2Push2a, btnCO2Push2e) => { // btnCO2Push2.IsSelected = !btnCO2Push2.IsSelected; // byte setPushValua = btnCO2Push2.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowCO23 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowCO23); // var btnCO2Type3 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level3, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowCO23.AddChidren (btnCO2Type3); // var btnCO2Push3 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowCO23.AddChidren (btnCO2Push3); // btnCO2Push3.MouseUpEventHandler += (btnCO2Push3a, btnCO2Push3e) => { // btnCO2Push3.IsSelected = !btnCO2Push3.IsSelected; // byte setPushValua = btnCO2Push3.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowCO24 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowCO24); // var btnCO2Type4 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level4, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowCO24.AddChidren (btnCO2Type4); // var btnCO2Push4 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [12] == 1 ? true : false, // Tag = "Switch" // }; // rowCO24.AddChidren (btnCO2Push4); // btnCO2Push4.MouseUpEventHandler += (btnCO2Push4a, btnCO2Push4e) => { // btnCO2Push4.IsSelected = !btnCO2Push4.IsSelected; // byte setPushValua = btnCO2Push4.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // break; // case DeviceType.SensorTVOC: // setRowList.Height = Application.GetRealHeight (400); // RowLayout rowTVOC = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTVOC); // var btnTVOCType1 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel1, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTVOC.AddChidren (btnTVOCType1); // var btnTVOCPush1 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [3] == 1 ? true : false, // Tag = "Switch" // }; // rowTVOC.AddChidren (btnTVOCPush1); // btnTVOCPush1.MouseUpEventHandler += (btnTVOCPush1a, btnTVOCPush1e) => { // btnTVOCPush1.IsSelected = !btnTVOCPush1.IsSelected; // byte setPushValua = btnTVOCPush1.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowTVOC2 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTVOC2); // var btnTVOCType2 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel2, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTVOC2.AddChidren (btnTVOCType2); // var btnTVOCPush2 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [6] == 1 ? true : false, // Tag = "Switch" // }; // rowTVOC2.AddChidren (btnTVOCPush2); // btnTVOCPush2.MouseUpEventHandler += (btnTVOCPush2a, btnTVOCPush2e) => { // btnTVOCPush2.IsSelected = !btnTVOCPush2.IsSelected; // byte setPushValua = btnTVOCPush2.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowTVOC3 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTVOC3); // var btnTVOCType3 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel3, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTVOC3.AddChidren (btnTVOCType3); // var btnTVOCPush3 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowTVOC3.AddChidren (btnTVOCPush3); // btnTVOCPush3.MouseUpEventHandler += (btnTVOCPush3a, btnTVOCPush3e) => { // btnTVOCPush3.IsSelected = !btnTVOCPush3.IsSelected; // byte setPushValua = btnTVOCPush3.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowTVOC4 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTVOC4); // var btnTVOCType4 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel4, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTVOC4.AddChidren (btnTVOCType4); // var btnTVOCPush4 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [12] == 1 ? true : false, // Tag = "Switch" // }; // rowTVOC4.AddChidren (btnTVOCPush4); // btnTVOCPush4.MouseUpEventHandler += (btnTVOCPush4a, btnTVOCPush4e) => { // btnTVOCPush4.IsSelected = !btnTVOCPush4.IsSelected; // byte setPushValua = btnTVOCPush4.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // break; // case DeviceType.SensorTemperature: // setRowList.Height = Application.GetRealHeight (200); // RowLayout rowTemperature = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTemperature); // var btnTemperatureType1 = new Button () { // Width = Application.GetRealWidth (560), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.Overheat, // //TextID = R.MyInternationalizationString.Hot, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTemperature.AddChidren (btnTemperatureType1); // var btnTempPush1 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [3] == 1 ? true : false, // Tag = "Switch" // }; // rowTemperature.AddChidren (btnTempPush1); // btnTempPush1.MouseUpEventHandler += (ddd, sss) => { // MainPage.Loading.Start ("Saving..."); // byte setPushValua = btnTempPush1.IsSelected == true ? (byte)0 : (byte)1; // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // Application.RunOnMainThread (() => { // if (setPushRevertBytes == null) { // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TargetsSetFail), Language.StringByID (R.MyInternationalizationString.Close)).Show (); // } else { // if (btnTempPush1.IsSelected) { // btnTempPush1.IsSelected = false; // } else { // btnTempPush1.IsSelected = true; // } // } // }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // btnTemperatureType1.MouseUpEventHandler += (sender2, e2) => { // new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 0, pushRevertBytes, btnTemperatureType1); // }; // RowLayout rowTemperature2 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowTemperature2); // var btnTemperatureType2 = new Button () { // Width = Application.GetRealWidth (560), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.Overcooling, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowTemperature2.AddChidren (btnTemperatureType2); // var btnTempPush2 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [6] == 1 ? true : false, // Tag = "Switch" // }; // rowTemperature2.AddChidren (btnTempPush2); // btnTempPush2.MouseUpEventHandler += (ddd, sss) => { // MainPage.Loading.Start ("Saving..."); // byte setPushValua = btnTempPush2.IsSelected == true ? (byte)0 : (byte)1; // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // Application.RunOnMainThread (() => { // if (setPushRevertBytes == null) { // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TargetsSetFail), Language.StringByID (R.MyInternationalizationString.Close)).Show (); // } else { // if (btnTempPush2.IsSelected) { // btnTempPush2.IsSelected = false; // } else { // btnTempPush2.IsSelected = true; // } // } // }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // btnTemperatureType2.MouseUpEventHandler += (dd, ss) => { // new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 1, pushRevertBytes, btnTemperatureType2); // }; // System.Threading.Tasks.Task.Factory.StartNew (() => { // try { // for (int i = 0; i < 2; i++) { // int pushTemp = 0; // var pushValuesRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushValues, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, (byte)i }); // if (pushValuesRevertBytes == null) { // pushValuesRevertBytes = new byte [] { device.DevicePushType, (byte)i, 0, 0, 0, 255 }; // } // if (i == 0) { // pushTemp = pushValuesRevertBytes [4] * 256 + pushValuesRevertBytes [5]; // } else { // pushTemp = pushValuesRevertBytes [2] * 256 + pushValuesRevertBytes [3]; // } // string setTemp = (pushTemp > 32768 ? ((32768 - pushTemp) / 10).ToString () : ((pushTemp / 10).ToString ())) + "°"; // Application.RunOnMainThread (() => { // if (i == 0) { // btnTemperatureType1.Text = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":> " + setTemp ; // } else { // btnTemperatureType2.Text = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":< " + setTemp ; // } // }); // } // } catch { } finally { // } // }); // break; // case DeviceType.SensorHumidity: // setRowList.Height = Application.GetRealHeight (300); // RowLayout rowHumidity = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowHumidity); // var btnHumidityType1 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel3, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowHumidity.AddChidren (btnHumidityType1); // var btnHumidityPush1 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [3] == 1 ? true : false, // Tag = "Switch" // }; // rowHumidity.AddChidren (btnHumidityPush1); // btnHumidityPush1.MouseUpEventHandler += (btnHumidityPush1a, btnHumidityPush1e) => { // btnHumidityPush1.IsSelected = !btnHumidityPush1.IsSelected; // byte setPushValua = btnHumidityPush1.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowHumidity2 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowHumidity2); // var btnHumidityType2 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceTempTipLevel1, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowHumidity2.AddChidren (btnHumidityType2); // var btnHumidityPush2 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [6] == 1 ? true : false, // Tag = "Switch" // }; // rowHumidity2.AddChidren (btnHumidityPush2); // btnHumidityPush2.MouseUpEventHandler += (btnHumidityPush2a, btnHumidityPush2e) => { // btnHumidityPush2.IsSelected = !btnHumidityPush2.IsSelected; // byte setPushValua = btnHumidityPush2.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // RowLayout rowHumidity3 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowHumidity3); // var btnHumidityType3 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel1, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowHumidity3.AddChidren (btnHumidityType3); // var btnHumidityPush3 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowHumidity3.AddChidren (btnHumidityPush3); // btnHumidityPush3.MouseUpEventHandler += (btnHumidityPush3a, btnHumidityPush3e) => { // btnHumidityPush3.IsSelected = !btnHumidityPush3.IsSelected; // byte setPushValua = btnHumidityPush3.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // //break; // RowLayout rowHumidity4 = new RowLayout () { // BackgroundColor = SkinStyle.Current.SubtitleView, // Height = Application.GetRealHeight (100), // }; // setRowList.AddChidren (rowHumidity4); // var btnHumidityType4 = new Button () { // Width = Application.GetRealWidth (300), // X = Application.GetRealWidth (80), // TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel2, // TextColor = SkinStyle.Current.TextColor1, // TextAlignment = TextAlignment.CenterLeft, // }; // rowHumidity4.AddChidren (btnHumidityType4); // var btnHumidityPush4 = new Button () { // Width = Application.GetMinRealAverage (90), // Height = Application.GetMinRealAverage (53), // X = Application.GetRealWidth (640 - 90 - 20), // Y = Application.GetRealHeight (22), // UnSelectedImagePath = "Item/SwitchClose.png", // SelectedImagePath = "Item/SwitchOpen.png", // IsSelected = pushRevertBytes [9] == 1 ? true : false, // Tag = "Switch" // }; // rowHumidity4.AddChidren (btnHumidityPush4); // btnHumidityPush4.MouseUpEventHandler += (btnHumidityPush4a, btnHumidityPush4e) => { // btnHumidityPush4.IsSelected = !btnHumidityPush4.IsSelected; // byte setPushValua = btnHumidityPush4.IsSelected == true ? (byte)1 : (byte)0; // MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load)); // System.Threading.Tasks.Task.Run (() => { // try { // var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 }); // } catch (Exception ex) { // Console.WriteLine (ex.Message); // } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // }; // break; // } // }); // } catch { } finally { // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // } // }); // } // }; // rightButton.MouseUpEventHandler += eventHandler; // btnDeviceName.MouseUpEventHandler += eventHandler; // rowView.MouseUpEventHandler += eventHandler; // } // } // } //}