using System;
|
namespace Shared.SimpleControl.Phone
|
{
|
public class UserSensorSettingPushPage : FrameLayout
|
{
|
public void ShowUserSensorSettingPushPage (System.Collections.Generic.List<Common> 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(1136 - 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<MouseEventArgs> eventHandler = (sender, e) => {
|
if (rightButton.IsSelected) {
|
btnPoint.IsSelected = rightButton.IsSelected = btnDeviceName.IsSelected = false;
|
setRowList.Height = 0;
|
} else {
|
MainPage.Loading.Start ("Please wait...");
|
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.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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua ,255,255});
|
};
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
|
};
|
|
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 (btnPM25Type3);
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
|
};
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
|
};
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
|
};
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
|
};
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
|
};
|
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);
|
|
EventHandler<MouseEventArgs> eventHandler2 = (sender2, e2) => {
|
new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 0, pushRevertBytes);
|
};
|
btnTemperatureType1.MouseUpEventHandler += eventHandler2;
|
|
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);
|
btnTemperatureType2.MouseUpEventHandler += (dd, ss) => {
|
new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 4, pushRevertBytes);
|
//new UserSensorSettingTempPushDialog ().ShowSettingTempPush (device,4);
|
};
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
|
};
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
|
};
|
|
|
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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
|
};
|
//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;
|
var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
|
};
|
break;
|
}
|
|
});
|
} catch { } finally {
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
}
|
});
|
}
|
};
|
|
|
rightButton.MouseUpEventHandler += eventHandler;
|
btnDeviceName.MouseUpEventHandler += eventHandler;
|
rowView.MouseUpEventHandler += eventHandler;
|
|
|
}
|
|
}
|
}
|
}
|