using System;
|
using SmartHome;
|
using Shared;
|
using Shared.SimpleControl.R;
|
using Shared.SimpleControl;
|
using System.Collections.Generic;
|
|
namespace SuperGateWay
|
{
|
public class SelectedDeviceState : FrameLayout
|
{
|
public SelectedDeviceState ()
|
{
|
|
Tag = "Logic";
|
}
|
public bool IsDeviceEditor;
|
|
|
public void Show (SuperGateWayCommon common, GateWay superGateWay)
|
{
|
this.BackgroundColor = 0xFF1F1F1F;
|
this.AddChidren (new Button {
|
Height = Application.GetRealHeight (30),
|
});
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (30),
|
};
|
AddChidren (topFrameLayout);
|
|
var titleName = new Button {
|
TextID = MyInternationalizationString.devicestate,
|
TextSize = 17,
|
};
|
topFrameLayout.AddChidren (titleName);
|
|
var back = new Button {
|
Width = Application.GetRealWidth (82),
|
Height = Application.GetRealHeight (89),
|
X = Application.GetRealWidth (10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/HomepageBack.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
IsDeviceEditor = false;
|
//if (IsConditionEditor) {
|
// var v = Logic.CurrentLogic.conditions.Find ((obj) => obj.Tag == "");
|
// if (v != null) {
|
// v.values = DeviceStatus;
|
// }
|
// var logicCommunalPage = new LogicCommunalPage ();
|
// MainPage.MainFrameLayout.AddChidren (logicCommunalPage);
|
// logicCommunalPage.Show (superGateWay);
|
//}
|
};
|
|
var tetleframeLayout = new FrameLayout {
|
Y = topFrameLayout.Bottom,
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xff0f0f0f,
|
};
|
AddChidren (tetleframeLayout);
|
|
var tetlebtn = new Button {
|
//TextID = MyInternationalizationString.selecttype,
|
Text = Language.StringByID (MyInternationalizationString.setup) + common.Name + Language.StringByID (MyInternationalizationString.state),
|
TextSize = 16,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
};
|
tetleframeLayout.AddChidren (tetlebtn);
|
|
var middle = new VerticalScrolViewLayout ();
|
middle.Y = tetleframeLayout.Bottom;
|
middle.Height = Application.GetRealHeight (Application.DesignHeight - 130 - 100 - 80);
|
middle.BackgroundColor = 0xff323232;
|
AddChidren (middle);
|
string SelectedDeviceStatuscondition = "no";
|
|
Input inputifon = new Input ();
|
//inputifon.sid=common.functions.
|
|
byte property = 8;
|
string statevalue = "25";
|
|
if (IsDeviceEditor) {
|
foreach (var deviceinput in Logic.CurrentLogic.input) {
|
if (deviceinput.sid == null) {
|
continue;
|
}
|
var tempSid = deviceinput.sid;
|
//判断SID是否有效的,如果不是有效的当前这个场景数据就不处理
|
Convert.ToUInt64 (tempSid, 16);
|
var sidUlong = Convert.ToUInt64 (tempSid, 16);
|
///1:设备;
|
var type = (byte)((sidUlong >> 60) & 0xF);
|
if (type == 1) {
|
var subnetId = (byte)((sidUlong >> 40) & 0xFF);
|
var deviceId = (byte)((sidUlong >> 32) & 0xFF);
|
var targetType = (byte)((sidUlong >> 24) & 0xFF);
|
property = (byte)((sidUlong >> 16) & 0xFF);
|
var targetNumber = (uint)((sidUlong >> 0) & 0xFFFF);
|
///用来判断为条件,查找当前设备;
|
var commonLoopID = subnetId + "_" + deviceId + "_" + targetNumber;
|
var Type = Logic.devicetype (targetType, property);
|
if (Type == common.Type.ToString () && common.CommonLoopID == commonLoopID) {
|
//设备当前状态值
|
statevalue = deviceinput.value.ToString ();
|
break;
|
}
|
}
|
|
}
|
}
|
|
switch (common.Type) {
|
///灯光
|
case DeviceType.LightSwitch: {
|
#region 灯光View
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
|
#endregion
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
inputifon.value = 1;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
inputifon.value = 0;
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
if (IsDeviceEditor) {
|
if (statevalue == "0") {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
} else {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
}
|
}
|
|
|
}
|
break;
|
case DeviceType.LightDimming: {
|
|
// var lightDimmingBrightness = common.GetIntValueByKey ("Brightness", 0);
|
|
var lightDimmingfl = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xFF4d4d4d,
|
};
|
middle.AddChidren (lightDimmingfl);
|
|
var LighthorizontalSeekBar = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (640 - 150),
|
Height = Application.GetRealHeight (100),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (30),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
};
|
lightDimmingfl.AddChidren (LighthorizontalSeekBar);
|
|
|
var tempvalue = new Button {
|
Width = Application.GetRealWidth (120),
|
Height = Application.GetRealHeight (100),
|
Text ="0%",
|
TextColor = 0xFF121212,
|
X = Application.GetRealWidth (640 - 100),
|
};
|
lightDimmingfl.AddChidren (tempvalue);
|
|
///滑动条点击事件
|
LighthorizontalSeekBar.ProgressChanged += (sender1, e1) => {
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
SelectedDeviceStatuscondition = "yes";
|
tempvalue.Text = LighthorizontalSeekBar.Progress.ToString () + "%";
|
inputifon.value = LighthorizontalSeekBar.Progress;
|
};
|
|
if (IsDeviceEditor) {
|
LighthorizontalSeekBar.Progress = int.Parse (statevalue);
|
tempvalue.Text = LighthorizontalSeekBar.Progress.ToString () + "%";
|
}
|
}
|
break;
|
///窗帘
|
case DeviceType.CurtainModel: {
|
// var curtainSwitch = common.GetIntValueByKey ("Power", 0);
|
#region ---窗帘(开关)---
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
//SelectedBackgroundColor=0xfffe5e00,
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
inputifon.value = 1;
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
inputifon.value = 0;
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
if (IsDeviceEditor) {
|
if (statevalue == "0") {
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
} else {
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
|
};
|
}
|
|
#endregion
|
|
}
|
break;
|
case DeviceType.CurtainRoller: {
|
#region 窗帘View
|
//var curtainBrightness = common.GetIntValueByKey ("Brightness", 0);
|
var curtainBrightnessfl = new FrameLayout {
|
Height = Application.GetRealHeight (100),
|
BackgroundColor = 0xFF4d4d4d,
|
};
|
middle.AddChidren (curtainBrightnessfl);
|
|
var curtainhorizontalSeekBar = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (640 - 150),
|
Height = Application.GetRealHeight (100),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (30),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
};
|
curtainBrightnessfl.AddChidren (curtainhorizontalSeekBar);
|
|
var tempvalue = new Button {
|
Width = Application.GetRealWidth (120),
|
Height = Application.GetRealHeight (100),
|
Text ="0%",
|
TextColor = 0xFF121212,
|
X = Application.GetRealWidth (640 - 100),
|
};
|
curtainBrightnessfl.AddChidren (tempvalue);
|
|
///滑动条点击事件
|
curtainhorizontalSeekBar.ProgressChanged += (sender1, e1) => {
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
tempvalue.Text = curtainhorizontalSeekBar.Progress.ToString () + "%";
|
inputifon.value = curtainhorizontalSeekBar.Progress;
|
};
|
|
|
if (IsDeviceEditor) {
|
curtainhorizontalSeekBar.Progress = int.Parse (statevalue);
|
tempvalue.Text = curtainhorizontalSeekBar.Progress.ToString () + "%";
|
}
|
|
|
#endregion
|
|
|
}
|
break;
|
///空调
|
case DeviceType.HVAC: {
|
|
#region 空调开关View
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
//SelectedBackgroundColor=0xfffe5e00,
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
var currenttemperaturerow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
//middle.AddChidren (currenttemperaturerow);
|
|
var btncurrenttemperature = new Button {
|
//Text = "当前室内温度",
|
TextID = MyInternationalizationString.currenttemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
currenttemperaturerow.AddChidren (btncurrenttemperature);
|
|
var temperaturerow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (temperaturerow);
|
|
var btntemperature = new Button {
|
//Text = "空调温度",
|
TextID = MyInternationalizationString.actemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
temperaturerow.AddChidren (btntemperature);
|
|
var btnSelectedtemperature = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
};
|
temperaturerow.AddChidren (btnSelectedtemperature);
|
#endregion
|
|
#region 模式
|
|
var moderow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (moderow);
|
|
var tempmode = new Button {
|
TextID = MyInternationalizationString.Mode,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
// Text="模式",
|
};
|
moderow.AddChidren (tempmode);
|
|
var btnModeIcon = new Button {
|
X = Application.GetRealWidth (520),
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
//UnSelectedImagePath = "AC/ACRefrigeration.png",
|
};
|
moderow.AddChidren (btnModeIcon);
|
|
#endregion
|
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
///当前室内温度
|
EventHandler<MouseEventArgs> currenttemperatureclick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
currenttemperaturerow.BackgroundColor = 0xfffe5e00;
|
temperaturerow.BackgroundColor = 0x00000000;
|
#region 当前室内温度View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
//Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (170),
|
//Text = "请选择温度的范围",//
|
TextID = MyInternationalizationString.Selectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnname);
|
#endregion
|
};
|
currenttemperaturerow.MouseUpEventHandler += currenttemperatureclick;
|
btncurrenttemperature.MouseUpEventHandler += currenttemperatureclick;
|
|
///空调温度
|
int temperature =25;
|
EventHandler<MouseEventArgs> temperatureclick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
|
#region 空调温度View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
flMain.RemoveFromParent ();
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 3);
|
}
|
if (inputifon.sid != Sid (common, 3)) {
|
inputifon.sid = Sid (common, 3);
|
}
|
inputifon.value = temperature;
|
btnSelectedtemperature.Text = temperature.ToString () + "°";
|
};
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//Text = "请选择设备温度",
|
TextID = MyInternationalizationString.acSelectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnname);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (106),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
};
|
View.AddChidren (btnReduceTemperature);
|
|
var btnActemperature = new Button () {
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (260),
|
Y = Application.GetRealHeight (120),
|
Text = temperature.ToString() + "°",
|
TextColor = 0xff121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnActemperature);
|
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (640 - 190),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
View.AddChidren (btnAddTemperature);
|
#endregion
|
|
btnReduceTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = false;
|
if (temperature > 16) {
|
temperature--;
|
}
|
btnActemperature.Text = temperature.ToString () + "°";
|
//btnSelectedtemperature.Text = temperature.ToString () + "°";
|
|
};
|
btnReduceTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
|
btnAddTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = false;
|
|
if (temperature < 30) {
|
temperature++;
|
}
|
|
btnActemperature.Text = temperature.ToString () + "°";
|
//btnSelectedtemperature.Text = temperature.ToString () + "°";
|
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
|
};
|
btntemperature.MouseUpEventHandler += temperatureclick;
|
temperaturerow.MouseUpEventHandler += temperatureclick;
|
|
///空调模式
|
int acMode = 0;
|
EventHandler<MouseEventArgs> tempmodelick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor =0x00000000;
|
moderow.BackgroundColor = 0xfffe5e00;
|
|
|
#region 空调模式View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var view = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xff2f2f2f,//0xFFffffff,
|
};
|
flMain.AddChidren (view);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
TextAlignment = TextAlignment.CenterRight,
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//Text = "请选择模式",
|
TextID = MyInternationalizationString.selectedmode,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
view.AddChidren (btnname);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (106),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
};
|
view.AddChidren (btnReduceTemperature);
|
|
var btnmodeic = new Button {
|
Y = Application.GetRealHeight (107),
|
X = Application.GetRealWidth (260),
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
//UnSelectedImagePath = "AC/ACRefrigeration.png",
|
|
};
|
view.AddChidren (btnmodeic);
|
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (640 - 190),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
view.AddChidren (btnAddTemperature);
|
|
|
ACupdateModeImage (acMode, btnModeIcon, btnmodeic);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
flMain.RemoveFromParent ();
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
ACupdateModeImage (acMode, btnModeIcon, btnmodeic);
|
inputifon.value = acMode;
|
|
};
|
#endregion
|
|
btnReduceTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = false;
|
|
switch (acMode) {
|
case 0:
|
acMode = 1;
|
break;
|
case 1:
|
acMode = 2;
|
break;
|
case 2:
|
acMode = 3;
|
break;
|
case 3:
|
acMode = 4;
|
break;
|
case 4:
|
acMode = 0;
|
break;
|
default:
|
acMode = 0;
|
break;
|
}
|
ACupdateModeImage (acMode, new Button { },btnmodeic);
|
};
|
btnReduceTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
|
btnAddTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = false;
|
switch (acMode) {
|
case 0:
|
acMode = 1;
|
break;
|
case 1:
|
acMode = 2;
|
break;
|
case 2:
|
acMode = 3;
|
break;
|
case 3:
|
acMode = 4;
|
break;
|
case 4:
|
acMode = 0;
|
break;
|
default:
|
acMode = 0;
|
break;
|
}
|
ACupdateModeImage (acMode, new Button { },btnmodeic);
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
|
};
|
moderow.MouseUpEventHandler += tempmodelick;
|
tempmode.MouseUpEventHandler += tempmodelick;
|
|
if (IsDeviceEditor) {
|
if (property == 0) {
|
if (statevalue == "1") {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
currenttemperaturerow.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
|
} else {
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
currenttemperaturerow.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
|
}
|
} else if (property == 3) {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
currenttemperaturerow.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
moderow.BackgroundColor = 0x00000000;
|
temperature= int.Parse(statevalue);
|
btnSelectedtemperature.Text = statevalue + "°";
|
} else if (property == 1) {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
currenttemperaturerow.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0xfffe5e00;
|
ACupdateModeImage (int.Parse (statevalue), btnModeIcon,new Button{});
|
acMode = int.Parse (statevalue);
|
|
}
|
|
}
|
}
|
break;
|
///地热
|
case DeviceType.FoolHeat: {
|
|
#region 开关
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
//SelectedBackgroundColor=0xfffe5e00,
|
};
|
closerowlayout.AddChidren (btnclose);
|
#endregion
|
|
#region 当前室内温度界面
|
var currenttemperaturerow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
//middle.AddChidren (currenttemperaturerow);
|
|
var btncurrenttemperature = new Button {
|
//Text = "当前室内温度",
|
TextID = MyInternationalizationString.currenttemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
currenttemperaturerow.AddChidren (btncurrenttemperature);
|
|
var currenttemperaturevalue = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
//Text = actemperature.ToString () + "°",
|
};
|
currenttemperaturerow.AddChidren (currenttemperaturevalue);
|
|
#endregion
|
|
#region 温度
|
|
var temperaturerow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (temperaturerow);
|
|
var btntemperature = new Button {
|
//Text = "地热温度",
|
TextID = MyInternationalizationString.foolheattemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
temperaturerow.AddChidren (btntemperature);
|
|
var btnSelectedtemperature = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
//Text = actemperature.ToString () + "°",
|
};
|
temperaturerow.AddChidren (btnSelectedtemperature);
|
#endregion
|
|
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
///地热温度
|
int intvalue = 25;
|
EventHandler<MouseEventArgs> temperatureclick = (sender, e) => {
|
|
// SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
|
#region 地热温度View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
// TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
btnSelectedtemperature.Text = intvalue.ToString() + "°";
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = intvalue;
|
|
};
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//Text = "请选择设备温度",
|
TextID = MyInternationalizationString.acSelectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnname);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (106),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
};
|
View.AddChidren (btnReduceTemperature);
|
|
var btnActemperature = new Button () {
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (260),
|
Y = Application.GetRealHeight (120),
|
Text = intvalue + "°",
|
TextColor = 0xff121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnActemperature);
|
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (640 - 190),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
View.AddChidren (btnAddTemperature);
|
#endregion
|
|
btnReduceTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = false;
|
if (intvalue > 0) {
|
intvalue--;
|
}
|
btnActemperature.Text = intvalue.ToString () + "°";
|
};
|
btnReduceTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
|
btnAddTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = false;
|
if (intvalue < 100) {
|
intvalue++;
|
}
|
btnActemperature.Text = intvalue.ToString () + "°";
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
|
};
|
btntemperature.MouseUpEventHandler += temperatureclick;
|
temperaturerow.MouseUpEventHandler += temperatureclick;
|
|
|
if (IsDeviceEditor) {
|
if (property == 0) {
|
if (statevalue == "1") {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
temperaturerow.BackgroundColor = 0x00000000;
|
|
} else {
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0x00000000;
|
}
|
} else if (property == 1) {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
intvalue =int.Parse(statevalue);
|
btnSelectedtemperature.Text = statevalue + "°";
|
}
|
|
}
|
}
|
break;
|
///新风
|
case DeviceType.FreshAir: {
|
|
#region 开关
|
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
//SelectedBackgroundColor=0xfffe5e00,
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
#endregion
|
|
#region 模式界面
|
var moderow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (moderow);
|
|
var tempmode = new Button {
|
TextID = MyInternationalizationString.freshairmode,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
//Text = "新风模式",
|
};
|
moderow.AddChidren (tempmode);
|
|
var btnModeIcon = new Button {
|
X = Application.GetRealWidth (520),
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
//UnSelectedImagePath = "FreshAir/FASmart.png",
|
};
|
moderow.AddChidren (btnModeIcon);
|
#endregion
|
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value =1;
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
///新风模式
|
int acMode = 0;
|
EventHandler<MouseEventArgs> tempmodelick = (sender, e) => {
|
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0xfffe5e00;
|
|
#region 新风模式View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var view = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
//BackgroundColor = 0xFFffffff,
|
BackgroundColor = 0xff2f2f2f,
|
};
|
flMain.AddChidren (view);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//Text = "请选择模式",
|
TextID = MyInternationalizationString.selectedmode,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
view.AddChidren (btnname);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (106),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
};
|
view.AddChidren (btnReduceTemperature);
|
|
var btnmodeic = new Button {
|
Y = Application.GetRealHeight (107),
|
X = Application.GetRealWidth (260),
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
|
};
|
view.AddChidren (btnmodeic);
|
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (640 - 190),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
view.AddChidren (btnAddTemperature);
|
#endregion
|
|
FreshAirReadupdateModeImage (acMode, btnModeIcon, btnmodeic);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
//显示模式图标
|
|
FreshAirReadupdateModeImage (acMode, btnModeIcon, btnmodeic);
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = acMode;
|
};
|
|
|
btnReduceTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = false;
|
switch (acMode) {
|
case 0:
|
acMode = 1;
|
break;
|
case 1:
|
acMode = 2;
|
break;
|
case 2:
|
acMode = 3;
|
break;
|
case 3:
|
acMode = 0;
|
break;
|
default:
|
acMode = 0;
|
break;
|
}
|
FreshAirReadupdateModeImage (acMode, new Button { }, btnmodeic);
|
};
|
btnReduceTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
|
btnAddTemperature.MouseUpEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = false;
|
switch (acMode) {
|
case 0:
|
acMode = 1;
|
break;
|
case 1:
|
acMode = 2;
|
break;
|
case 2:
|
acMode = 3;
|
break;
|
case 3:
|
acMode = 0;
|
break;
|
default:
|
acMode = 0;
|
break;
|
}
|
FreshAirReadupdateModeImage (acMode, new Button { }, btnmodeic);
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
|
};
|
moderow.MouseUpEventHandler += tempmodelick;
|
tempmode.MouseUpEventHandler += tempmodelick;
|
|
if (IsDeviceEditor) {
|
if (property == 0) {
|
if (statevalue == "1") {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
moderow.BackgroundColor = 0x00000000;
|
} else {
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0x00000000;
|
}
|
} else if (property == 1) {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
moderow.BackgroundColor = 0xfffe5e00;
|
FreshAirReadupdateModeImage (int.Parse (statevalue), btnModeIcon, new Button { });
|
acMode = int.Parse (statevalue);
|
}
|
}
|
}
|
break;
|
|
///(按键)机械开关
|
case DeviceType.MechanicalSwitch: {
|
#region --- (按键)机械开关---
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
|
#endregion
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
if (IsDeviceEditor) {
|
if (statevalue == "0") {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
} else {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
}
|
}
|
|
}
|
break;
|
///(按键)自动复位开关
|
case DeviceType.AutomaticSwitch: {
|
#region --- (按键)自动复位开关---
|
var clickrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (clickrowlayout);
|
|
var btnclick = new Button {
|
//Text = "单击",
|
TextID = MyInternationalizationString.singleclick,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
clickrowlayout.AddChidren (btnclick);
|
|
var Longpressrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (Longpressrowlayout);
|
|
var btnLongpress = new Button {
|
//Text = "长按",
|
TextID = MyInternationalizationString.longpress,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
Longpressrowlayout.AddChidren (btnLongpress);
|
|
|
var Longpressreleaserowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (Longpressreleaserowlayout);
|
|
var btnLongpressrelease = new Button {
|
//Text = "长按释放",
|
TextID = MyInternationalizationString.longpressrelease,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
Longpressreleaserowlayout.AddChidren (btnLongpressrelease);
|
|
var doubleclickrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (doubleclickrowlayout);
|
|
var btndoubleclick = new Button {
|
//Text = "双击",
|
TextID = MyInternationalizationString.doubleclick,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
doubleclickrowlayout.AddChidren (btndoubleclick);
|
|
///单击点击事件
|
EventHandler<MouseEventArgs> click1 = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
clickrowlayout.BackgroundColor = 0xfffe5e00;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 1;
|
|
};
|
btnclick.MouseUpEventHandler += click1;
|
clickrowlayout.MouseUpEventHandler += click1;
|
|
///长按点击事件
|
EventHandler<MouseEventArgs> click2 = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0xfffe5e00;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 2;
|
};
|
btnLongpress.MouseUpEventHandler += click2;
|
Longpressrowlayout.MouseUpEventHandler += click2;
|
|
///长按释放点击事件
|
EventHandler<MouseEventArgs> click3 = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0xfffe5e00;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 3;
|
};
|
Longpressreleaserowlayout.MouseUpEventHandler += click3;
|
btnLongpressrelease.MouseUpEventHandler += click3;
|
|
///双击点击事件
|
EventHandler<MouseEventArgs> click4 = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0xfffe5e00;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 4;
|
};
|
doubleclickrowlayout.MouseUpEventHandler += click4;
|
btndoubleclick.MouseUpEventHandler += click4;
|
|
|
if (IsDeviceEditor) {
|
///进来更新状态
|
if (statevalue == "1") {
|
clickrowlayout.BackgroundColor = 0xfffe5e00;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
} else if (statevalue == "2") {
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0xfffe5e00;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
} else if (statevalue == "3") {
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0xfffe5e00;
|
doubleclickrowlayout.BackgroundColor = 0x00000000;
|
} else if (statevalue == "4") {
|
clickrowlayout.BackgroundColor = 0x00000000;
|
Longpressrowlayout.BackgroundColor = 0x00000000;
|
Longpressreleaserowlayout.BackgroundColor = 0x00000000;
|
doubleclickrowlayout.BackgroundColor = 0xfffe5e00;
|
}
|
}
|
|
#endregion
|
|
}
|
break;
|
///干接点
|
case DeviceType.DryContact: {
|
#region ---干接点---
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
#endregion
|
///点击确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
///点击取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
if (IsDeviceEditor) {
|
if (statevalue == "0") {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
} else {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
}
|
}
|
|
|
|
}
|
break;
|
|
///音乐
|
case DeviceType.MusicModel: {
|
#region ---音乐---
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "播放",
|
TextID = MyInternationalizationString.play,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "暂停",
|
TextID = MyInternationalizationString.pause,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
|
var stoprowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (stoprowlayout);
|
|
var btnstop = new Button {
|
//Text = "停止",
|
TextID = MyInternationalizationString.stop,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
stoprowlayout.AddChidren (btnstop);
|
|
|
var volrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (volrowlayout);
|
|
var voltext = new Button {
|
//Text = "音量",
|
TextID = MyInternationalizationString.Volume,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
volrowlayout.AddChidren (voltext);
|
|
var btnvol = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
};
|
volrowlayout.AddChidren (btnvol);
|
|
///点击播放事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) => {
|
SelectedDeviceStatuscondition = "yes";
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor= 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
|
///点击暂停事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor = 0x00000000;
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 2;
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
|
///点击停止事件
|
EventHandler<MouseEventArgs> stopclick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor = 0xfffe5e00;
|
SelectedDeviceStatuscondition = "yes";
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
stoprowlayout.MouseUpEventHandler += stopclick;
|
btnstop.MouseUpEventHandler += stopclick;
|
|
///音量点击事件
|
int volvalue = 0;
|
EventHandler<MouseEventArgs> volclick = (sender, e) => {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0xfffe5e00;
|
stoprowlayout.BackgroundColor = 0x00000000;
|
|
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var view = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 100),
|
Height = Application.GetRealHeight (100),
|
//BackgroundColor = 0xFFffffff,
|
BackgroundColor = 0xff2f2f2f,
|
};
|
flMain.AddChidren (view);
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 100),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
|
var volumeFrameLayout = new FrameLayout {
|
Width = Application.GetRealWidth (458),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (30),
|
};
|
view.AddChidren (volumeFrameLayout);
|
//当前播放的音量
|
var horizontalSeekBarVol = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (458 - 26),//490
|
Height = Application.GetRealHeight (50),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (13),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
Max = 100,
|
SleepTime = 1000,
|
ThumbRadius = 9,
|
Progress = volvalue,
|
};
|
volumeFrameLayout.AddChidren (horizontalSeekBarVol);
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//TextID = MyInternationalizationString.acSelectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
//view.AddChidren (btnname);
|
|
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
//显示模式图标
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = volvalue;
|
|
btnvol.Text = volvalue.ToString () + "%";
|
};
|
|
horizontalSeekBarVol.ProgressChanged += (sender11, e11) => {
|
volvalue = horizontalSeekBarVol.Progress;
|
btnvol.Text = volvalue.ToString () + "%";
|
};
|
|
|
};
|
volrowlayout.MouseUpEventHandler += volclick;
|
voltext.MouseUpEventHandler += volclick;
|
|
if (IsDeviceEditor) {
|
if (property == 0) {
|
if (statevalue == "1") {
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor = 0x00000000;
|
} else if(statevalue == "2"){
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor = 0x00000000;
|
}else{
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0x00000000;
|
stoprowlayout.BackgroundColor = 0xfffe5e00;
|
}
|
} else if (property == 1) {
|
closerowlayout.BackgroundColor = 0x00000000;
|
openrowlayout.BackgroundColor = 0x00000000;
|
volrowlayout.BackgroundColor = 0xfffe5e00;
|
stoprowlayout.BackgroundColor = 0x00000000;
|
volvalue = int.Parse (statevalue);
|
|
}
|
|
}
|
#endregion
|
}
|
break;
|
///门锁
|
case DeviceType.DoorLock: {
|
#region ---门锁---
|
var openrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (openrowlayout);
|
|
var btnopen = new Button {
|
//Text = "开",
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
openrowlayout.AddChidren (btnopen);
|
|
var closerowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (closerowlayout);
|
|
var btnclose = new Button {
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
closerowlayout.AddChidren (btnclose);
|
|
|
var normalrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (normalrowlayout);
|
|
var btnnormal = new Button {
|
//Text = "电量正常",
|
TextID = MyInternationalizationString.normal,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
normalrowlayout.AddChidren (btnnormal);
|
|
var lowrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (lowrowlayout);
|
|
var btnlow = new Button {
|
//Text = "电量低",
|
TextID = MyInternationalizationString.low,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
lowrowlayout.AddChidren (btnlow);
|
|
|
var nontriggerrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (nontriggerrowlayout);
|
|
var btnnontrigger = new Button {
|
//Text = "不触发",
|
TextID = MyInternationalizationString.nontrigger,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
nontriggerrowlayout.AddChidren (btnnontrigger);
|
|
var triggerrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (triggerrowlayout);
|
|
var btntrigger = new Button {
|
//Text = "触发",
|
TextID = MyInternationalizationString.trigger,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
triggerrowlayout.AddChidren (btntrigger);
|
|
///开点击事件
|
EventHandler<MouseEventArgs> opneclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
btnnormal.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
|
};
|
btnopen.MouseUpEventHandler += opneclick;
|
openrowlayout.MouseUpEventHandler += opneclick;
|
|
///关点击事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
};
|
btnclose.MouseUpEventHandler += closeclick;
|
closerowlayout.MouseUpEventHandler += closeclick;
|
|
///电量正常点击事件
|
EventHandler<MouseEventArgs> normalclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0xfffe5e00;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 0;
|
|
};
|
btnnormal.MouseUpEventHandler += normalclick;
|
normalrowlayout.MouseUpEventHandler += normalclick;
|
|
///电量低点击事件
|
EventHandler<MouseEventArgs> lowclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0xfffe5e00;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = 1;
|
|
};
|
btnlow.MouseUpEventHandler += lowclick;
|
lowrowlayout.MouseUpEventHandler += lowclick;
|
|
///不触发点击事件
|
EventHandler<MouseEventArgs> nontriggerclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0xfffe5e00;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 2);
|
}
|
if (inputifon.sid != Sid (common, 2)) {
|
inputifon.sid = Sid (common, 2);
|
}
|
inputifon.value = 0;
|
|
|
};
|
btnnontrigger.MouseUpEventHandler += nontriggerclick;
|
nontriggerrowlayout.MouseUpEventHandler += nontriggerclick;
|
|
///触发点击事件
|
EventHandler<MouseEventArgs> triggerclick = (sender, e) => {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0xfffe5e00;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 2);
|
}
|
if (inputifon.sid != Sid (common, 2)) {
|
inputifon.sid = Sid (common, 2);
|
}
|
inputifon.value = 1;
|
};
|
btntrigger.MouseUpEventHandler += triggerclick;
|
triggerrowlayout.MouseUpEventHandler += triggerclick;
|
|
if (IsDeviceEditor) {
|
if (property == 0) {
|
if (statevalue == "1") {
|
openrowlayout.BackgroundColor = 0xfffe5e00;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
} else {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0xfffe5e00;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
}
|
} else if (property == 1) {
|
if (statevalue == "1") {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0xfffe5e00;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
} else {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0xfffe5e00;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
}
|
} else if (property == 2) {
|
if (statevalue == "1") {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0xfffe5e00;
|
|
} else {
|
openrowlayout.BackgroundColor = 0x00000000;
|
closerowlayout.BackgroundColor = 0x00000000;
|
normalrowlayout.BackgroundColor = 0x00000000;
|
lowrowlayout.BackgroundColor = 0x00000000;
|
nontriggerrowlayout.BackgroundColor = 0xfffe5e00;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
}
|
}
|
|
}
|
|
#endregion
|
}
|
break;
|
///门锁用户ID
|
case DeviceType.DoorLockID: {
|
var nontriggerrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (nontriggerrowlayout);
|
|
var btnnontrigger = new Button {
|
//Text = "不触发",
|
TextID = MyInternationalizationString.nontrigger,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
SelectedBackgroundColor = 0xfffe5e00,
|
};
|
nontriggerrowlayout.AddChidren (btnnontrigger);
|
|
var triggerrowlayout = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (triggerrowlayout);
|
|
var btntrigger = new Button {
|
//Text = "触发",
|
TextID = MyInternationalizationString.trigger,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
triggerrowlayout.AddChidren (btntrigger);
|
|
///不触发点击事件
|
EventHandler<MouseEventArgs> nontriggerclick = (sender, e) => {
|
nontriggerrowlayout.BackgroundColor = 0xfffe5e00;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 0;
|
|
|
};
|
btnnontrigger.MouseUpEventHandler += nontriggerclick;
|
nontriggerrowlayout.MouseUpEventHandler += nontriggerclick;
|
|
///触发点击事件
|
EventHandler<MouseEventArgs> triggerclick = (sender, e) => {
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0xfffe5e00;
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = 1;
|
};
|
btntrigger.MouseUpEventHandler += triggerclick;
|
triggerrowlayout.MouseUpEventHandler += triggerclick;
|
|
if (IsDeviceEditor) {
|
if (statevalue == "1") {
|
nontriggerrowlayout.BackgroundColor = 0x00000000;
|
triggerrowlayout.BackgroundColor = 0xfffe5e00;
|
} else {
|
nontriggerrowlayout.BackgroundColor = 0xfffe5e00;
|
triggerrowlayout.BackgroundColor = 0x00000000;
|
}
|
}
|
|
|
|
}
|
break;
|
///传感器
|
case DeviceType.Sensor: {
|
|
#region 温度界面
|
var temperaturerow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (temperaturerow);
|
|
var btntemperature = new Button {
|
//Text = "温度",
|
TextID = MyInternationalizationString.temperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
temperaturerow.AddChidren (btntemperature);
|
|
var btnSelectedtemperature = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
//btnSelectedtemperature.Text = actemperature.ToString () + "°",
|
};
|
temperaturerow.AddChidren (btnSelectedtemperature);
|
#endregion
|
|
#region 湿度界面
|
var humidityrow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (humidityrow);
|
|
var humiditytext = new Button {
|
//Text = "相对湿度",
|
TextID = MyInternationalizationString.humidity,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
humidityrow.AddChidren (humiditytext);
|
|
var humidityvalue = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (80),
|
Height = Application.GetRealHeight (100),
|
//Text = actemperature.ToString () + "°",
|
};
|
humidityrow.AddChidren (humidityvalue);
|
#endregion
|
|
#region PM2.5
|
var pmrow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (pmrow);
|
|
var pmtext = new Button {
|
Text = "PM2.5",
|
//TextID = MyInternationalizationString.actemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
pmrow.AddChidren (pmtext);
|
|
var pmvalue = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (100),
|
//Text = actemperature.ToString () + "°",
|
};
|
pmrow.AddChidren (pmvalue);
|
#endregion
|
|
#region CO
|
var corow = new RowLayout {
|
Height = Application.GetRealHeight (100),
|
};
|
middle.AddChidren (corow);
|
|
var cotext = new Button {
|
Text = "CO",
|
//TextID = MyInternationalizationString.actemperature,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (40),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (100),
|
};
|
corow.AddChidren (cotext);
|
|
var covalue = new Button {
|
X = Application.GetRealWidth (540),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (100),
|
};
|
corow.AddChidren (covalue);
|
#endregion
|
|
///温度点击事件
|
int temperature = 25;
|
EventHandler<MouseEventArgs> temperatureclick = (sender, e) => {
|
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0x00000000;
|
|
#region 空调温度View
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
btnSelectedtemperature.Text = temperature.ToString () + "°";
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 0);
|
}
|
if (inputifon.sid != Sid (common, 0)) {
|
inputifon.sid = Sid (common, 0);
|
}
|
inputifon.value = temperature;
|
|
};
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//Text = "请选择设备温度",
|
TextID = MyInternationalizationString.acSelectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnname);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (106),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
};
|
View.AddChidren (btnReduceTemperature);
|
|
var btnActemperature = new Button () {
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (260),
|
Y = Application.GetRealHeight (120),
|
Text = temperature + "°",
|
TextColor = 0xff121212,
|
TextSize = 16,
|
};
|
View.AddChidren (btnActemperature);
|
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (640 - 190),
|
Y = Application.GetRealHeight (120),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
View.AddChidren (btnAddTemperature);
|
#endregion
|
|
btnReduceTemperature.MouseUpEventHandler += (sender1, e1) => {
|
|
btnReduceTemperature.IsSelected = false;
|
if (temperature > 0) {
|
temperature--;
|
}
|
btnActemperature.Text = temperature.ToString () + "°";
|
//btnSelectedtemperature.Text = temperature.ToString () + "°";
|
};
|
btnReduceTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
|
btnAddTemperature.MouseUpEventHandler += (sender1, e1) => {
|
|
btnAddTemperature.IsSelected = false;
|
if (temperature < 40) {
|
temperature++;
|
}
|
|
btnActemperature.Text = temperature.ToString () + "°";
|
//btnSelectedtemperature.Text = temperature.ToString () + "°";
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender1, e1) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
|
};
|
btntemperature.MouseUpEventHandler += temperatureclick;
|
temperaturerow.MouseUpEventHandler += temperatureclick;
|
|
///湿度点击事件
|
int value = 0;
|
EventHandler<MouseEventArgs> humidityclick = (sender, e) => {
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0xfffe5e00;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0x00000000;
|
|
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var view = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 100),
|
Height = Application.GetRealHeight (100),
|
//BackgroundColor = 0xFFffffff,
|
BackgroundColor = 0xff2f2f2f,
|
};
|
flMain.AddChidren (view);
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 100),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
|
var volumeFrameLayout = new FrameLayout {
|
Width = Application.GetRealWidth (458),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (30),
|
};
|
view.AddChidren (volumeFrameLayout);
|
//当前播放的音量
|
var horizontalSeekBarVol = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (458 - 26),//490
|
Height = Application.GetRealHeight (50),
|
Radius = (uint)Application.GetRealHeight (25),
|
X = Application.GetRealWidth (13),
|
Gravity = Gravity.CenterVertical,
|
ProgressColor = 0xffFE5E00,
|
Max = 100,
|
SleepTime = 1000,
|
ThumbRadius = 9,
|
Progress = value,
|
};
|
volumeFrameLayout.AddChidren (horizontalSeekBarVol);
|
|
var btnname = new Button {
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (170),
|
//TextID = MyInternationalizationString.acSelectiontemperature,
|
TextColor = 0xFF121212,
|
TextSize = 16,
|
};
|
//view.AddChidren (btnname);
|
|
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
//显示模式图标
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 1);
|
}
|
if (inputifon.sid != Sid (common, 1)) {
|
inputifon.sid = Sid (common, 1);
|
}
|
inputifon.value = value;
|
|
humidityvalue.Text = value.ToString () + "%";
|
};
|
|
horizontalSeekBarVol.ProgressChanged += (sender11, e11) => {
|
value = horizontalSeekBarVol.Progress;
|
humidityvalue.Text = value.ToString () + "%";
|
};
|
|
|
};
|
humiditytext.MouseUpEventHandler += humidityclick;
|
humidityrow.MouseUpEventHandler += humidityclick;
|
|
|
///PM2.5点击事件
|
int pm = 90;
|
EventHandler<MouseEventArgs> pmclick = (sender, e) => {
|
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0xfffe5e00;
|
corow.BackgroundColor = 0x00000000;
|
|
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
//TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 5);
|
}
|
if (inputifon.sid != Sid (common, 5)) {
|
inputifon.sid = Sid (common, 5);
|
}
|
inputifon.value = pm;
|
|
if (0 <= pm && pm < 60) {
|
pmvalue.Text =Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= pm && pm < 75) {
|
pmvalue.Text =Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= pm && pm <= 100) {
|
pmvalue.Text =Language.StringByID (MyInternationalizationString.excellent);
|
}
|
};
|
|
var y = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text = Language.StringByID (MyInternationalizationString.excellent),
|
};
|
View.AddChidren (y);
|
|
var z = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20 + 20 + 186),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text = Language.StringByID (MyInternationalizationString.middle),
|
};
|
View.AddChidren (z);
|
|
var c = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20 + 20 + 20 + 186 + 186),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text =Language.StringByID (MyInternationalizationString.difference),
|
};
|
View.AddChidren (c);
|
if (0 <= pm && pm < 60) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= pm && pm < 75) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= pm && pm <= 100) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.excellent);
|
}
|
|
y.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = true;
|
z.IsSelected = false;
|
c.IsSelected = false;
|
pm = 90;
|
|
};
|
|
z.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = false;
|
z.IsSelected = true;
|
c.IsSelected = false;
|
pm = 70;
|
};
|
|
c.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = false;
|
z.IsSelected = false;
|
c.IsSelected = true;
|
pm = 50;
|
};
|
};
|
pmrow.MouseUpEventHandler += pmclick;
|
pmtext.MouseUpEventHandler += pmclick;
|
|
///CO点击事件
|
int co = 90;
|
EventHandler<MouseEventArgs> coclick = (sender, e) => {
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0xfffe5e00;
|
|
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 };
|
this.AddChidren (flMain);
|
flMain.MouseUpEventHandler += (sender1, e1) => {
|
flMain.RemoveFromParent ();
|
};
|
|
var View = new FrameLayout {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Height = Application.GetRealHeight (320),
|
BackgroundColor = 0xFFffffff,
|
};
|
flMain.AddChidren (View);
|
|
|
var btnSave = new Button {
|
Y = Application.GetRealHeight (Application.DesignHeight - 320),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (50),
|
Text = Language.StringByID (MyInternationalizationString.complete),
|
// TextColor = 0xFF121212,
|
//TextAlignment = TextAlignment.CenterRight
|
X = Application.GetRealWidth (640 - 100),
|
};
|
flMain.AddChidren (btnSave);
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
SelectedDeviceStatuscondition = "yes";
|
flMain.RemoveFromParent ();
|
|
if (inputifon.sid == "") {
|
inputifon.sid = Sid (common, 10);
|
}
|
if (inputifon.sid != Sid (common, 10)) {
|
inputifon.sid = Sid (common, 10);
|
}
|
inputifon.value = co;
|
|
|
if (0 <= co && co < 60) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= co && co < 75) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= co && co <= 100) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.excellent);
|
}
|
|
};
|
|
|
var y = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text = Language.StringByID (MyInternationalizationString.excellent),
|
};
|
View.AddChidren (y);
|
|
var z = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20 + 20 + 186),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text = Language.StringByID (MyInternationalizationString.middle),
|
};
|
View.AddChidren (z);
|
|
var c = new Button {
|
Width = Application.GetRealWidth (186),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (20 + 20 + 20 + 186 + 186),
|
Y = Application.GetRealHeight (120),
|
BackgroundColor = 0xff2f2f2f,
|
SelectedBackgroundColor = 0xfffe5e00,
|
Text = Language.StringByID (MyInternationalizationString.difference),
|
};
|
View.AddChidren (c);
|
|
if (0 <= co && co < 60) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= co && co < 75) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= co && co <= 100) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.excellent);
|
}
|
|
y.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = true;
|
z.IsSelected = false;
|
c.IsSelected = false;
|
co = 90;
|
};
|
|
|
z.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = false;
|
z.IsSelected = true;
|
c.IsSelected = false;
|
co = 70;
|
};
|
|
c.MouseUpEventHandler += (sender1, e1) => {
|
y.IsSelected = false;
|
z.IsSelected = false;
|
c.IsSelected = true;
|
co = 50;
|
};
|
|
};
|
corow.MouseUpEventHandler += coclick;
|
cotext.MouseUpEventHandler += coclick;
|
|
if (IsDeviceEditor) {
|
|
if (property == 0) {
|
temperaturerow.BackgroundColor = 0xfffe5e00;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0x00000000;
|
btnSelectedtemperature.Text = statevalue + "°";
|
temperature = int.Parse (statevalue);
|
} else if (property == 1) {
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0xfffe5e00;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0x00000000;
|
humidityvalue.Text = statevalue + "%";
|
value = int.Parse (statevalue);
|
|
} else if (property == 5) {
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0xfffe5e00;
|
corow.BackgroundColor = 0x00000000;
|
|
pm = int.Parse (statevalue);
|
if (0 <= pm && pm < 60) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= pm && pm < 75) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= pm && pm <= 100) {
|
pmvalue.Text = Language.StringByID (MyInternationalizationString.excellent);
|
}
|
} else if (property == 10) {
|
temperaturerow.BackgroundColor = 0x00000000;
|
humidityrow.BackgroundColor = 0x00000000;
|
pmrow.BackgroundColor = 0x00000000;
|
corow.BackgroundColor = 0xfffe5e00;
|
|
co = int.Parse (statevalue);
|
if (0 <= co && co < 60) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.difference);
|
} else if (60 <= co && co < 75) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.middle);
|
} else if (75 <= co && co <= 100) {
|
covalue.Text = Language.StringByID (MyInternationalizationString.excellent);
|
}
|
}
|
|
}
|
|
|
|
}
|
break;
|
|
}
|
|
var btncomplete = new Button {
|
Y = middle.Bottom,
|
Height = Application.GetRealHeight (80),
|
TextID = MyInternationalizationString.complete,
|
BackgroundColor = 0xff1f1f1f,
|
TextSize = 16,
|
};
|
AddChidren (btncomplete);
|
btncomplete.MouseUpEventHandler += (sedder, e) => {
|
if (Logic.CurrentLogic.input.Count == 8) {
|
new Alert (Language.StringByID (MyInternationalizationString.Tip), Language.StringByID (MyInternationalizationString.Morethan8), Language.StringByID (MyInternationalizationString.Close)).Show ();
|
return;
|
}
|
|
if (SelectedDeviceStatuscondition == "yes") {
|
Logic.CurrentLogic.AddInput (inputifon);
|
} else {
|
if (!IsDeviceEditor) {
|
var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt),
|
Language.StringByID (MyInternationalizationString.selectdevicestatuscondition),
|
Language.StringByID (MyInternationalizationString.OK));
|
alert.Show ();
|
return;
|
}
|
IsDeviceEditor = false;
|
}
|
this.RemoveFromParent ();
|
var logicCommunalPage = new LogicCommunalPage ();
|
MainPage.MainFrameLayout.AddChidren (logicCommunalPage);
|
logicCommunalPage.Show (superGateWay, () => { });
|
};
|
}
|
|
void ACupdateModeImage (int mode, Button btn,Button btn1)
|
{
|
///空调:mode:(0:制冷,1:制热,2:通风,3:自动,4:抽湿)
|
switch (mode) {
|
case 0:
|
btn.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
btn1.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
break;
|
case 1:
|
btn.UnSelectedImagePath = "AC/ACHeating.png";
|
btn1.UnSelectedImagePath = "AC/ACHeating.png";
|
break;
|
case 2:
|
btn.UnSelectedImagePath = "AC/ACModeAuto.png";
|
btn1.UnSelectedImagePath = "AC/ACModeAuto.png";
|
break;
|
case 3:
|
btn.UnSelectedImagePath = "AC/ACAuto.png";
|
btn1.UnSelectedImagePath = "AC/ACAuto.png";
|
break;
|
case 4:
|
btn.UnSelectedImagePath = "AC/ACDehumidification.png";
|
btn1.UnSelectedImagePath = "AC/ACDehumidification.png";
|
break;
|
default:
|
btn.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
btn1.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
break;
|
}
|
}
|
|
void FreshAirReadupdateModeImage (int mode, Button btn, Button btn1)
|
{
|
///新风:mode:(0:智能,1:新风,2:内循环,3:恒温)
|
switch (mode) {
|
case 0:
|
btn.UnSelectedImagePath = "FreshAir/FASmart.png";
|
btn1.UnSelectedImagePath = "FreshAir/FASmart.png";
|
break;
|
case 1:
|
btn.UnSelectedImagePath = "FreshAir/FAManual.png";
|
btn1.UnSelectedImagePath = "FreshAir/FAManual.png";
|
break;
|
case 2:
|
btn.UnSelectedImagePath = "FreshAir/FAInternalCirculation.png";
|
btn1.UnSelectedImagePath = "FreshAir/FAInternalCirculation.png";
|
break;
|
case 3:
|
btn.UnSelectedImagePath = "FreshAir/FAConstantTemp.png";
|
btn1.UnSelectedImagePath = "FreshAir/FAConstantTemp.png";
|
break;
|
default:
|
btn.UnSelectedImagePath = "FreshAir/FASmart.png";
|
btn1.UnSelectedImagePath = "FreshAir/FASmart.png";
|
break;
|
}
|
}
|
|
string Sid (SuperGateWayCommon common, int val)
|
{
|
var sidlist = new List<string> ();
|
var l = new List<int> ();
|
var str = "";
|
try {
|
foreach (var v in common.functions) {
|
if (v.sid != null) {
|
sidlist.Add (v.sid);
|
}
|
}
|
foreach (var sid in sidlist) {
|
var sidUlong = Convert.ToUInt64 (sid, 16);
|
var property = (byte)((sidUlong >> 16) & 0xFF);
|
if (property == val) {
|
str = sid;
|
}
|
}
|
} catch {
|
return "";
|
}
|
return str;
|
}
|
|
|
}
|
}
|