using System;
|
using System.Collections.Generic;
|
using Shared;
|
using Shared.SimpleControl;
|
using Shared.SimpleControl.R;
|
|
namespace SuperGateWay
|
{
|
class DeviceIfonChangedataPage
|
{
|
public async void Show (Scene scene, SuperGateWayCommon common,string name)
|
{
|
|
#region initpublicView
|
var dialog = new Dialog () {
|
//BackgroundColor = 0xFF464646,
|
Width = Application.GetRealWidth (480),
|
Height = Application.GetRealHeight (560),
|
BackgroundColor = 0xFF505050,
|
};
|
|
var titleView = new FrameLayout () {
|
Height = Application.GetRealHeight (80),
|
//BackgroundColor = 0xFF090909
|
BackgroundColor = 0xFF1f1f1f,
|
};
|
dialog.AddChidren (titleView);
|
|
var title = new Button () {
|
//X = Application.GetRealWidth (35),
|
//Y = Application.GetRealHeight (15),
|
//Width = Application.GetRealWidth (300),
|
//Height = Application.GetRealHeight (50),
|
//TextAlignment = TextAlignment.CenterLeft,
|
//TextColor = 0xFF000000,
|
Text =name,
|
};
|
titleView.AddChidren (title);
|
|
var bottomView = new FrameLayout () {
|
Y = Application.GetRealHeight (560 - 80),
|
//BackgroundColor = 0xFF090909,
|
Height = Application.GetRealHeight (80),
|
BackgroundColor = 0xFF1f1f1f,
|
};
|
dialog.AddChidren (bottomView);
|
|
var btnBack = new Button () {
|
Width = Application.GetRealWidth (239),
|
TextID = MyInternationalizationString.Cancel,
|
};
|
bottomView.AddChidren (btnBack);
|
btnBack.MouseUpEventHandler += (sender2, e2) => {
|
dialog.Close ();
|
};
|
var btnLine = new Button () {
|
BackgroundColor = 0xF0313131,
|
Width = 1,
|
X = btnBack.Right,
|
};
|
bottomView.AddChidren (btnLine);
|
var btnSave = new Button () {
|
Width = Application.GetRealWidth (239),
|
X = btnLine.Right,
|
TextID = MyInternationalizationString.SAVE,
|
//TextAlignment = TextAlignment.Center,
|
};
|
bottomView.AddChidren (btnSave);
|
dialog.Show ();
|
#endregion
|
|
|
switch (common.Type) {
|
case DeviceType.LightDimming: {
|
var lightDimmingBrightness = common.GetIntValueByKey ("Brightness", 0);
|
#region ---调关灯---
|
|
var lightfl = new FrameLayout {
|
Width = Application.GetRealWidth (480),
|
Height = Application.GetRealHeight (80),
|
Y = Application.GetRealHeight (135),
|
};
|
dialog.AddChidren (lightfl);
|
|
var btnimage = new Button {
|
Width = Application.GetRealHeight (50),
|
Height = Application.GetRealHeight (50),
|
UnSelectedImagePath = "Item/Light.png",
|
X = Application.GetRealWidth (20),
|
Gravity = Gravity.CenterVertical,
|
};
|
lightfl.AddChidren (btnimage);
|
///显示当前亮度值的控件
|
var btnlightBrightness = new Button {
|
Width = Application.GetRealHeight (300),
|
Height = Application.GetRealHeight (50),
|
X = Application.GetRealWidth (70 + 5),
|
TextAlignment = TextAlignment.CenterLeft,
|
Gravity = Gravity.CenterVertical,
|
Text = Language.StringByID (MyInternationalizationString.brightness) + lightDimmingBrightness + "%",
|
};
|
lightfl.AddChidren (btnlightBrightness);
|
|
var btnMinBrightness = new Button () {
|
Width = Application.GetRealWidth (50),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (230 + 20),
|
Text = "0%",
|
TextAlignment = TextAlignment.CenterLeft
|
};
|
dialog.AddChidren (btnMinBrightness);
|
|
var tempSeekBarFrame = new FrameLayout () {
|
Width = Application.GetRealWidth (520 - 200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (70 + 5),
|
Y = Application.GetRealHeight (230 + 20),
|
};
|
dialog.AddChidren (tempSeekBarFrame);
|
///显示当前亮度值的进度条的控件
|
var horizontalSeekBar = new HorizontalSeekBar () {
|
Tag = DateTime.MinValue,
|
};
|
tempSeekBarFrame.AddChidren (horizontalSeekBar);
|
horizontalSeekBar.Progress = lightDimmingBrightness;
|
|
var btnMaxBrightness = new Button () {
|
Width = Application.GetRealWidth (90),
|
Height = Application.GetRealHeight (80),
|
X = tempSeekBarFrame.Right + Application.GetRealWidth (10),
|
Y = Application.GetRealHeight (230 + 20),
|
Text = "100%",
|
TextAlignment = TextAlignment.CenterLeft
|
};
|
dialog.AddChidren (btnMaxBrightness);
|
///滑动条点击事件
|
horizontalSeekBar.ProgressChanged += (sender, e) => {
|
lightDimmingBrightness = (byte)horizontalSeekBar.Progress;
|
btnlightBrightness.Text = Language.StringByID (MyInternationalizationString.brightness) + horizontalSeekBar.Progress.ToString () + "%";
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Brightness", lightDimmingBrightness);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.LightSwitch: {
|
var lightSwitch = common.GetIntValueByKey ("Power", 0);
|
#region ---开关灯---
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnOn);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnOn.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
};
|
dialog.AddChidren (btnOff);
|
///进来更新状态
|
if (lightSwitch == 0) {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
} else {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
}
|
///开按钮点击事件
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
lightSwitch = 1;
|
};
|
///关按钮点击事件
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
lightSwitch = 0;
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
dialog.Close ();
|
common.Add ("Power", lightSwitch);
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.CurtainModel: {
|
var curtainSwitch = common.GetIntValueByKey ("Power", 0);
|
#region ---窗帘(开关)---
|
var btnOpenCurtain = new Button {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (125),
|
UnSelectedImagePath = "Curtain/CurtainOpen.png",
|
SelectedImagePath = "Curtain/CurtainOpenSelected.png",
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (155),
|
};
|
dialog.AddChidren (btnOpenCurtain);
|
|
var btnOpenLbl = new Button {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (30),
|
X = btnOpenCurtain.X,
|
Y = btnOpenCurtain.Bottom + Application.GetRealHeight (5),
|
TextID = MyInternationalizationString.Open,
|
TextAlignment = TextAlignment.Center,
|
TextColor = 0xFFFFFFFF,
|
};
|
dialog.AddChidren (btnOpenLbl);
|
|
var btnStopCurtain = new Button () {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (125),
|
X = Application.GetRealWidth ((480 - 124) / 2),
|
Y = btnOpenCurtain.Y,
|
UnSelectedImagePath = "Curtain/CurtainTimeOut.png",
|
SelectedImagePath = "Curtain/CurtainTimeOutSelected.png",
|
};
|
dialog.AddChidren (btnStopCurtain);
|
var btnStopLbl = new Button {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (30),
|
X = btnStopCurtain.X,
|
Y = btnOpenLbl.Y,
|
TextID = MyInternationalizationString.Stop,
|
TextAlignment = TextAlignment.Center,
|
TextColor = 0xFFFFFFFF,
|
};
|
dialog.AddChidren (btnStopLbl);
|
var btnCloseCurtain = new Button () {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (125),
|
X = Application.GetRealWidth (480 - 124 - 35),
|
Y = btnOpenCurtain.Y,
|
UnSelectedImagePath = "Curtain/CurtainClose.png",
|
SelectedImagePath = "Curtain/CurtainCloseSelected.png",
|
};
|
dialog.AddChidren (btnCloseCurtain);
|
var btnCloseLbl = new Button {
|
Width = Application.GetRealWidth (124),
|
Height = Application.GetRealHeight (30),
|
X = btnCloseCurtain.X,
|
Y = btnOpenLbl.Y,
|
TextID = MyInternationalizationString.Close,
|
TextColor = 0xFFFFFFFF,
|
TextAlignment = TextAlignment.Center,
|
};
|
dialog.AddChidren (btnCloseLbl);
|
|
btnCloseCurtain.MouseUpEventHandler += (sender3, e3) => {
|
btnCloseCurtain.IsSelected = true;
|
btnOpenCurtain.IsSelected = false;
|
btnStopCurtain.IsSelected = false;
|
curtainSwitch = 0;
|
};
|
btnOpenCurtain.MouseUpEventHandler += (sender3, e3) => {
|
btnCloseCurtain.IsSelected = false;
|
btnOpenCurtain.IsSelected = true;
|
btnStopCurtain.IsSelected = false;
|
curtainSwitch = 1;
|
};
|
btnStopCurtain.MouseUpEventHandler += (sender3, e3) => {
|
btnCloseCurtain.IsSelected = false;
|
btnOpenCurtain.IsSelected = false;
|
btnStopCurtain.IsSelected = true;
|
curtainSwitch = 2;
|
};
|
|
if (curtainSwitch == 2) {
|
btnStopCurtain.IsSelected = true;
|
} else if (curtainSwitch == 1) {
|
btnOpenCurtain.IsSelected = true;
|
} else if (curtainSwitch == 0) {
|
btnCloseCurtain.IsSelected = true;
|
}
|
#endregion
|
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", curtainSwitch);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.CurtainRoller: {
|
var curtainRollerBrightness = common.GetIntValueByKey ("Brightness", 0);
|
#region ---卷帘---
|
var curtainfl = new FrameLayout {
|
Width = Application.GetRealWidth (480),
|
Height = Application.GetRealHeight (80),
|
Y = Application.GetRealHeight (135),
|
};
|
dialog.AddChidren (curtainfl);
|
|
var btnimage = new Button {
|
Width = Application.GetRealHeight (50),
|
Height = Application.GetRealHeight (50),
|
UnSelectedImagePath = "Curtain/Curtain.png",
|
X = Application.GetRealWidth (20),
|
Gravity = Gravity.CenterVertical,
|
};
|
curtainfl.AddChidren (btnimage);
|
///显示当前亮度值的控件
|
var btncurtainBrightness = new Button {
|
Width = Application.GetRealHeight (300),
|
Height = Application.GetRealHeight (50),
|
X = Application.GetRealWidth (70 + 5),
|
TextAlignment = TextAlignment.CenterLeft,
|
Gravity = Gravity.CenterVertical,
|
Text =Language.StringByID(MyInternationalizationString.state)+ ":" + curtainRollerBrightness + "%",
|
};
|
curtainfl.AddChidren (btncurtainBrightness);
|
|
var btnMinBrightness = new Button () {
|
Width = Application.GetRealWidth (50),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (230 + 20),
|
Text = "0%",
|
TextAlignment = TextAlignment.CenterLeft
|
};
|
dialog.AddChidren (btnMinBrightness);
|
|
var tempSeekBarFrame = new FrameLayout () {
|
Width = Application.GetRealWidth (520 - 200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (70 + 5),
|
Y = Application.GetRealHeight (230 + 20),
|
};
|
dialog.AddChidren (tempSeekBarFrame);
|
///显示当前窗帘状态的进度条的控件
|
var horizontalSeekBar = new HorizontalSeekBar () {
|
Tag = DateTime.MinValue,
|
};
|
tempSeekBarFrame.AddChidren (horizontalSeekBar);
|
horizontalSeekBar.Progress = curtainRollerBrightness;
|
|
var btnMaxBrightness = new Button () {
|
Width = Application.GetRealWidth (90),
|
Height = Application.GetRealHeight (80),
|
X = tempSeekBarFrame.Right + Application.GetRealWidth (10),
|
Y = Application.GetRealHeight (230 + 20),
|
Text = "100%",
|
TextAlignment = TextAlignment.CenterLeft
|
};
|
dialog.AddChidren (btnMaxBrightness);
|
///滑动条点击事件
|
horizontalSeekBar.ProgressChanged += (sender, e) => {
|
curtainRollerBrightness = (byte)horizontalSeekBar.Progress;
|
btncurtainBrightness.Text =Language.StringByID (MyInternationalizationString.state)+":" + horizontalSeekBar.Progress.ToString () + "%";
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Brightness", curtainRollerBrightness);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.HVAC: {
|
dialog.Height = Application.GetRealHeight (740);
|
dialog.Y = Application.GetRealHeight (210);
|
bottomView.Y = Application.GetRealHeight (740 - 80);
|
//温度
|
var acTemperature = common.GetIntValueByKey ("Temperature", 25);
|
//开关
|
var acPower = common.GetIntValueByKey ("Power", 0);
|
//模式
|
var acMode = common.GetIntValueByKey ("Mode", 0);
|
//风速
|
var acSpeed = common.GetIntValueByKey ("Speed", 0);
|
//扫风
|
var acScavenging = common.GetIntValueByKey ("Scavenging", 0);
|
//环境温度
|
var acambienTtemperature = common.GetIntValueByKey ("ambienTtemperature", 25);
|
#region ---空调---
|
|
#region 开关
|
|
var powerView = new FrameLayout () {
|
Y = titleView.Bottom,
|
BackgroundColor = 0xFF090909,
|
Height = Application.GetRealHeight (80),
|
};
|
dialog.AddChidren (powerView);
|
///开关
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (239),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOn);
|
var btnLinepower = new Button () {
|
BackgroundColor = 0xF0313131,
|
Width = 1,
|
X = btnOn.Right,
|
};
|
powerView.AddChidren (btnLinepower);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (240),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
X = btnLinepower.Right,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOff);
|
|
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
if(!Isdevicd (common, 0)){
|
return;
|
}
|
//Isdevicd (common,0);
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
acPower = 1;
|
};
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
acPower = 0;
|
};
|
if (acPower == 1) {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
} else {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
}
|
#endregion
|
|
#region 扫风,环境温度
|
var ScavengingView = new RowLayout () {
|
Y = powerView.Bottom,
|
Height = Application.GetRealHeight (100),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (ScavengingView);
|
|
var btnacambienTtemperature = new Button () {
|
Width = Application.GetRealWidth (400),
|
TextAlignment = TextAlignment.CenterLeft,
|
Text =Language.StringByID(MyInternationalizationString.ambienttemperature) + acambienTtemperature + "°",
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (30),
|
};
|
ScavengingView.AddChidren (btnacambienTtemperature);
|
var Scavengingimageepower = new Button () {
|
Width = Application.GetRealWidth (75),
|
Height = Application.GetRealHeight (78),
|
X = Application.GetRealWidth (480 - 20 - 94+15),
|
UnSelectedImagePath = "AC/Scavenging.png",
|
SelectedImagePath = "AC/Scavengingselected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
ScavengingView.AddChidren (Scavengingimageepower);
|
Scavengingimageepower.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 4)) {
|
return;
|
}
|
if (Scavengingimageepower.IsSelected) {
|
Scavengingimageepower.IsSelected = false;
|
acScavenging = 0;
|
} else {
|
Scavengingimageepower.IsSelected = true;
|
acScavenging = 1;
|
}
|
|
//Scavengingimageepower.IsSelected = !Scavengingimageepower.IsSelected;
|
//if (Scavengingimageepower.IsSelected) {
|
// if (acScavenging == 0) {
|
// acScavenging = 1;
|
// } else {
|
// acScavenging = 0;
|
// }
|
//}
|
};
|
|
if (acScavenging == 0) {
|
Scavengingimageepower.IsSelected = false;
|
} else {
|
Scavengingimageepower.IsSelected = true;
|
}
|
#endregion
|
|
#region 温度
|
|
var TemperatureView = new RowLayout () {
|
Y = ScavengingView.Bottom,
|
Height = Application.GetRealHeight (120),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (TemperatureView);
|
|
var btnSetTemperature = new Button () {
|
X = Application.GetRealWidth (140),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (50),
|
Text = acTemperature + "°",
|
TextAlignment = TextAlignment.Center,
|
TextSize = 18,
|
Enable = false,
|
};
|
TemperatureView.AddChidren (btnSetTemperature);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
TemperatureView.AddChidren (btnReduceTemperature);
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
TemperatureView.AddChidren (btnAddTemperature);
|
btnReduceTemperature.MouseDownEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
btnReduceTemperature.MouseUpEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = false;
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
|
if (acTemperature > 16) {
|
acTemperature--;
|
}
|
btnSetTemperature.Text = acTemperature + "°";
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
btnAddTemperature.MouseUpEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = false;
|
btnReduceTemperature.IsSelected = false;
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
|
if (acTemperature < 30) {
|
acTemperature++;
|
}
|
btnSetTemperature.Text = acTemperature + "°";
|
|
};
|
#endregion
|
|
#region 模式
|
var acModeView = new RowLayout () {
|
Y = TemperatureView.Bottom,
|
Height = Application.GetRealHeight (120 + 20),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (acModeView);
|
|
var btnmode = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
Text = "MODE",
|
X = Application.GetRealWidth (140),
|
//Y = Application.GetRealHeight (15),
|
TextSize = 10,
|
Enable = false,
|
TextColor=0x80ffffff,
|
TextAlignment=TextAlignment.TopCenter,
|
};
|
acModeView.AddChidren (btnmode);
|
|
var btnmodetext = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
Text =Language.StringByID(MyInternationalizationString.Cool),
|
X = Application.GetRealWidth (140),
|
Y = Application.GetRealHeight (140-15),
|
TextSize = 10,
|
Enable = false,
|
TextAlignment = TextAlignment.BottomCenter,
|
};
|
//acModeView.AddChidren (btnmodetext);
|
|
var btnACModeLeft = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (28)
|
};
|
acModeView.AddChidren (btnACModeLeft);
|
|
var btnModeIcon = new Button () {
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
Gravity = Gravity.Center,
|
Enable = false,
|
|
};
|
acModeView.AddChidren (btnModeIcon);
|
|
|
var btnACModeRight = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (28),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
acModeView.AddChidren (btnACModeRight);
|
btnACModeRight.MouseDownEventHandler += (sender, e) => {
|
btnACModeRight.IsSelected = true;
|
};
|
btnACModeRight.MouseUpEventHandler += (sender, e) => {
|
btnACModeRight.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
///mode:(0:制冷,1:制热,2:通风,3:自动,4:抽湿)
|
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, btnModeIcon);
|
};
|
btnACModeLeft.MouseDownEventHandler += (sender, e) => {
|
btnACModeLeft.IsSelected = true;
|
};
|
btnACModeLeft.MouseUpEventHandler += (sender, e) => {
|
btnACModeLeft.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
///mode:(0:制冷,1:制热,2:通风,3:自动,4:抽湿)
|
switch (acMode) {
|
case 0:
|
acMode = 4;
|
break;
|
case 1:
|
acMode = 0;
|
break;
|
case 2:
|
acMode = 1;
|
break;
|
case 3:
|
acMode = 2;
|
break;
|
case 4:
|
acMode = 3;
|
break;
|
default:
|
acMode = 0;
|
break;
|
}
|
ACupdateModeImage (acMode, btnModeIcon);
|
};
|
///
|
ACupdateModeImage (acMode, btnModeIcon);
|
#endregion
|
|
#region 风速
|
|
var acWindView = new RowLayout () {
|
Y = acModeView.Bottom,
|
Height = Application.GetRealHeight (120 + 20),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (acWindView);
|
|
var btnSpeed = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
//TextAlignment=TextAlignment.Center,
|
Text = "SPEED",
|
X = Application.GetRealWidth (140),
|
//Y = Application.GetRealHeight (15),
|
TextSize = 10,
|
Enable = false,
|
TextColor = 0x80ffffff,
|
TextAlignment = TextAlignment.TopCenter,
|
};
|
acWindView.AddChidren (btnSpeed);
|
|
var btnACWindLeft = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (28)
|
};
|
acWindView.AddChidren (btnACWindLeft);
|
|
var btnWindIcon = new Button () {
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
Gravity = Gravity.Center,
|
Enable = false,
|
};
|
acWindView.AddChidren (btnWindIcon);
|
|
var btnACWindRight = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (28),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
acWindView.AddChidren (btnACWindRight);
|
|
btnACWindLeft.MouseDownEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = true;
|
};
|
btnACWindLeft.MouseUpEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = false;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
///风速:(0:自动;1:低风;2:中风;3:高风;)
|
switch (acSpeed) {
|
case 0:
|
acSpeed = 1;
|
break;
|
case 1:
|
acSpeed = 2;
|
break;
|
case 2:
|
acSpeed = 3;
|
break;
|
case 3:
|
acSpeed = 0;
|
break;
|
default:
|
acSpeed = 0;
|
break;
|
}
|
updateWindSpeed (acSpeed, btnWindIcon);
|
};
|
|
btnACWindRight.MouseDownEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = true;
|
};
|
btnACWindRight.MouseUpEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = false;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
///风速:(0:自动;1:低风;2:中风;3:高风;)
|
switch (acSpeed) {
|
case 3:
|
acSpeed = 2;
|
break;
|
case 2:
|
acSpeed = 1;
|
break;
|
case 1:
|
acSpeed = 0;
|
break;
|
case 0:
|
acSpeed = 3;
|
break;
|
default:
|
acSpeed = 0;
|
break;
|
}
|
updateWindSpeed (acSpeed, btnWindIcon);
|
};
|
///
|
updateWindSpeed (acSpeed, btnWindIcon);
|
|
#endregion
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Temperature", acTemperature);
|
common.Add ("Power", acPower);
|
common.Add ("Mode", acMode);
|
common.Add ("Speed", acSpeed);
|
common.Add ("acScavenging", acScavenging);
|
//common.Add ("acambienTtemperature", acSpeed);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.FoolHeat: {
|
//温度
|
var foolHeatTemperature = common.GetIntValueByKey ("Temperature", 25);
|
//开关
|
var foolHeatPower = common.GetIntValueByKey ("Power", 0);
|
|
#region ---地热---
|
|
#region 开关
|
var powerView = new FrameLayout () {
|
Y = titleView.Bottom,
|
BackgroundColor = 0xFF090909,
|
Height = Application.GetRealHeight (80),
|
};
|
dialog.AddChidren (powerView);
|
///开关
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (239),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOn);
|
var btnLinepower = new Button () {
|
BackgroundColor = 0xF0313131,
|
Width = 1,
|
X = btnOn.Right,
|
};
|
powerView.AddChidren (btnLinepower);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (240),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
X = btnLinepower.Right,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOff);
|
|
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
foolHeatPower = 1;
|
};
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
foolHeatPower = 0;
|
};
|
if (foolHeatPower == 1) {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
} else {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
}
|
#endregion
|
|
#region 温度
|
|
var TemperatureView = new FrameLayout () {
|
Y = powerView.Bottom + Application.GetRealHeight (80),
|
Height = Application.GetRealHeight (160),
|
};
|
dialog.AddChidren (TemperatureView);
|
|
var btnSetTemperature = new Button () {
|
X = Application.GetRealWidth (140),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (80),
|
Text = foolHeatTemperature + "°",
|
TextSize = 18,
|
Enable = false,
|
};
|
TemperatureView.AddChidren (btnSetTemperature);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (28)
|
};
|
TemperatureView.AddChidren (btnReduceTemperature);
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (28),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
TemperatureView.AddChidren (btnAddTemperature);
|
btnReduceTemperature.MouseDownEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
btnReduceTemperature.MouseUpEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = false;
|
//if (foolHeatTemperature > 16) {
|
// foolHeatTemperature--;
|
//}
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
foolHeatTemperature--;
|
btnSetTemperature.Text = foolHeatTemperature + "°";
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
btnAddTemperature.MouseUpEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = false;
|
btnReduceTemperature.IsSelected = false;
|
//if (foolHeatTemperature < 30) {
|
// foolHeatTemperature++;
|
//}
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
foolHeatTemperature++;
|
btnSetTemperature.Text = foolHeatTemperature + "°";
|
|
};
|
#endregion
|
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Temperature", foolHeatTemperature);
|
common.Add ("Power", foolHeatPower);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.FreshAir: {
|
//开关
|
var freshAirReadPower = common.GetIntValueByKey ("Power", 0);
|
//模式
|
var freshAirReadMode = common.GetIntValueByKey ("Mode", 0);
|
//风速
|
var freshAirReadSpeed = common.GetIntValueByKey ("Speed", 0);
|
#region ---新风---
|
|
#region 开关
|
|
var powerView = new FrameLayout () {
|
Y = titleView.Bottom,
|
BackgroundColor = 0xFF090909,
|
Height = Application.GetRealHeight (80),
|
};
|
dialog.AddChidren (powerView);
|
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (239),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOn);
|
var btnLinepower = new Button () {
|
BackgroundColor = 0xF0313131,
|
Width = 1,
|
X = btnOn.Right,
|
};
|
powerView.AddChidren (btnLinepower);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (240),
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
X = btnLinepower.Right,
|
BackgroundColor = 0xff0f0f0f,
|
};
|
powerView.AddChidren (btnOff);
|
|
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
freshAirReadPower = 1;
|
};
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
freshAirReadPower = 0;
|
};
|
|
if (freshAirReadPower == 1) {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
} else {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
}
|
#endregion
|
|
#region 模式
|
var freshAirReadModeView = new RowLayout () {
|
Height = Application.GetRealHeight (160),
|
Width = LayoutParams.MatchParent,
|
Y = powerView.Bottom,
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (freshAirReadModeView);
|
|
var btnmode = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
Text = "MODE",
|
X = Application.GetRealWidth (140),
|
Y = Application.GetRealHeight (15),
|
TextSize = 10,
|
Enable = false,
|
TextColor = 0x80ffffff,
|
//TextAlignment = TextAlignment.TopCenter,
|
};
|
freshAirReadModeView.AddChidren (btnmode);
|
|
var btnACModeLeft = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (28)
|
};
|
freshAirReadModeView.AddChidren (btnACModeLeft);
|
|
var btnModeIcon = new Button () {
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
Gravity = Gravity.Center,
|
Enable = false,
|
};
|
freshAirReadModeView.AddChidren (btnModeIcon);
|
|
var btnACModeRight = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (28),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
freshAirReadModeView.AddChidren (btnACModeRight);
|
btnACModeRight.MouseDownEventHandler += (sender, e) => {
|
btnACModeRight.IsSelected = true;
|
};
|
btnACModeRight.MouseUpEventHandler += (sender, e) => {
|
///mode:(0:智能,1:新风,2:内循环,3:恒温)
|
btnACModeRight.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
switch (freshAirReadMode) {
|
case 0:
|
freshAirReadMode = 1;
|
break;
|
case 1:
|
freshAirReadMode = 2;
|
break;
|
case 2:
|
freshAirReadMode = 3;
|
break;
|
case 3:
|
freshAirReadMode = 0;
|
break;
|
default:
|
freshAirReadMode = 0;
|
break;
|
}
|
FreshAirReadupdateModeImage (freshAirReadMode, btnModeIcon);
|
};
|
btnACModeLeft.MouseDownEventHandler += (sender, e) => {
|
btnACModeLeft.IsSelected = true;
|
};
|
btnACModeLeft.MouseUpEventHandler += (sender, e) => {
|
///mode:(0:智能,1:新风,2:内循环,3:恒温)
|
btnACModeLeft.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
switch (freshAirReadMode) {
|
case 0:
|
freshAirReadMode = 3;
|
break;
|
case 1:
|
freshAirReadMode = 0;
|
break;
|
case 2:
|
freshAirReadMode = 1;
|
break;
|
case 3:
|
freshAirReadMode = 2;
|
break;
|
default:
|
freshAirReadMode = 0;
|
break;
|
}
|
FreshAirReadupdateModeImage (freshAirReadMode, btnModeIcon);
|
};
|
|
///读取新风模式状态
|
FreshAirReadupdateModeImage (freshAirReadMode, btnModeIcon);
|
#endregion
|
|
#region 风速
|
var freshAirReadWindView = new RowLayout () {
|
Height = Application.GetRealHeight (160),
|
Width = LayoutParams.MatchParent,
|
Y = freshAirReadModeView.Bottom,
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (freshAirReadWindView);
|
|
var btnSpeed = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
//TextAlignment=TextAlignment.Center,
|
Text = "SPEED",
|
X = Application.GetRealWidth (140),
|
Y = Application.GetRealHeight (15),
|
TextSize = 10,
|
Enable = false,
|
TextColor = 0x80ffffff,
|
//TextAlignment = TextAlignment.TopCenter,
|
|
};
|
freshAirReadWindView.AddChidren (btnSpeed);
|
|
var btnACWindLeft = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (28)
|
};
|
freshAirReadWindView.AddChidren (btnACWindLeft);
|
|
var btnWindIcon = new Button () {
|
Width = Application.GetRealWidth (105),
|
Height = Application.GetRealHeight (105),
|
Gravity = Gravity.Center,
|
Enable = false,
|
};
|
freshAirReadWindView.AddChidren (btnWindIcon);
|
|
var btnACWindRight = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (28),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
btnACWindLeft.MouseDownEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = true;
|
};
|
btnACWindLeft.MouseUpEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = false;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
///风速:(0:自动;1:低风;2:中风;3:高风;)
|
switch (freshAirReadSpeed) {
|
case 0:
|
freshAirReadSpeed = 1;
|
break;
|
case 1:
|
freshAirReadSpeed = 2;
|
break;
|
case 2:
|
freshAirReadSpeed = 3;
|
break;
|
case 3:
|
freshAirReadSpeed = 0;
|
break;
|
default:
|
freshAirReadSpeed = 0;
|
break;
|
}
|
updateWindSpeed (freshAirReadSpeed, btnWindIcon);
|
};
|
freshAirReadWindView.AddChidren (btnACWindRight);
|
btnACWindRight.MouseDownEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = true;
|
};
|
btnACWindRight.MouseUpEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = false;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
///风速:(0:自动;1:低风;2:中风;3:高风;)
|
switch (freshAirReadSpeed) {
|
case 3:
|
freshAirReadSpeed = 2;
|
break;
|
case 2:
|
freshAirReadSpeed = 1;
|
break;
|
case 1:
|
freshAirReadSpeed = 0;
|
break;
|
case 0:
|
freshAirReadSpeed = 3;
|
break;
|
default:
|
freshAirReadSpeed = 0;
|
break;
|
}
|
updateWindSpeed (freshAirReadSpeed, btnWindIcon);
|
};
|
///读取新风风速状态
|
updateWindSpeed (freshAirReadSpeed, btnWindIcon);
|
#endregion
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", freshAirReadPower);
|
common.Add ("Mode", freshAirReadMode);
|
common.Add ("Speed", freshAirReadSpeed);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.MechanicalSwitch: {
|
var mechanicalSwitch = common.GetIntValueByKey ("Power", 0);
|
#region --- (按键)机械开关---
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnOn);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnOn.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
};
|
dialog.AddChidren (btnOff);
|
///进来更新状态
|
if (mechanicalSwitch == 0) {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
} else {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
}
|
///开按钮点击事件
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
mechanicalSwitch = 1;
|
};
|
///关按钮点击事件
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
mechanicalSwitch = 0;
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", mechanicalSwitch);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.AutomaticSwitch: {
|
var automaticSwitch = common.GetIntValueByKey ("Power", 1);
|
#region --- (按键)自动复位开关---
|
|
var btnclick = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.singleclick,
|
//Text = "单击",
|
};
|
dialog.AddChidren (btnclick);
|
var btnLongpress = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnclick.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.longpress,
|
//Text = "长按",
|
};
|
dialog.AddChidren (btnLongpress);
|
|
var btnLongpressrelease = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135 + 100),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.longpressrelease,
|
//Text = "长按释放",
|
};
|
dialog.AddChidren (btnLongpressrelease);
|
|
var btndoubleclick = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnLongpressrelease.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135 + 100),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.doubleclick,
|
//Text = "双击",
|
};
|
dialog.AddChidren (btndoubleclick);
|
///进来更新状态
|
if (automaticSwitch == 1) {
|
btnclick.IsSelected = true;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = false;
|
|
} else if (automaticSwitch == 2) {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = true;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = false;
|
} else if (automaticSwitch == 3) {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = true;
|
btndoubleclick.IsSelected = false;
|
} else if (automaticSwitch == 4) {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = true;
|
}
|
///单击点击事件
|
btnclick.MouseUpEventHandler += (sender, e) => {
|
btnclick.IsSelected = true;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = false;
|
automaticSwitch = 1;
|
};
|
///长按点击事件
|
btnLongpress.MouseUpEventHandler += (sender, e) => {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = true;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = false;
|
automaticSwitch = 2;
|
};
|
///长按释放点击事件
|
btnLongpressrelease.MouseUpEventHandler += (sender, e) => {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = true;
|
btndoubleclick.IsSelected = false;
|
automaticSwitch = 3;
|
};
|
///双击点击事件
|
btndoubleclick.MouseUpEventHandler += (sender, e) => {
|
btnclick.IsSelected = false;
|
btnLongpress.IsSelected = false;
|
btnLongpressrelease.IsSelected = false;
|
btndoubleclick.IsSelected = true;
|
automaticSwitch = 4;
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", automaticSwitch);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.Sensor: {
|
dialog.Height = Application.GetRealHeight (560 - 80);
|
bottomView.Y = Application.GetRealHeight (560 - 80 - 80);
|
//温度
|
var SensorTemperature = common.GetIntValueByKey ("Temperature", 25);
|
//湿度
|
var SensorHumidity = common.GetIntValueByKey ("Brightness", 30);
|
|
#region ---传感器---
|
|
#region 温度
|
|
var TemperatureView = new RowLayout () {
|
Y = titleView.Bottom,
|
Height = Application.GetRealHeight (160),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (TemperatureView);
|
|
var btnTemperature = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
TextAlignment = TextAlignment.CenterLeft,
|
Text =Language.StringByID(MyInternationalizationString.SensorTemperature),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (160 - 94 - 20 - 10 - 20),
|
TextSize = 10,
|
Enable = false,
|
|
};
|
TemperatureView.AddChidren (btnTemperature);
|
|
var btnSetTemperature = new Button () {
|
X = Application.GetRealWidth (140),
|
// Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (94),
|
Text = SensorTemperature + "°",
|
TextSize = 18,
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
Enable = false,
|
};
|
TemperatureView.AddChidren (btnSetTemperature);
|
|
var btnReduceTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
};
|
TemperatureView.AddChidren (btnReduceTemperature);
|
|
var btnAddTemperature = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
};
|
TemperatureView.AddChidren (btnAddTemperature);
|
|
btnReduceTemperature.MouseDownEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = true;
|
};
|
btnReduceTemperature.MouseUpEventHandler += (sender, e) => {
|
btnReduceTemperature.IsSelected = false;
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
//if (foolHeatTemperature > 16) {
|
// foolHeatTemperature--;
|
//}
|
SensorTemperature--;
|
btnSetTemperature.Text = SensorTemperature + "°";
|
};
|
btnAddTemperature.MouseDownEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = true;
|
};
|
btnAddTemperature.MouseUpEventHandler += (sender, e) => {
|
btnAddTemperature.IsSelected = false;
|
btnReduceTemperature.IsSelected = false;
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
//if (foolHeatTemperature < 30) {
|
// foolHeatTemperature++;
|
//}
|
SensorTemperature++;
|
btnSetTemperature.Text = SensorTemperature + "°";
|
};
|
#endregion
|
|
#region 湿度
|
var tempHumidityfl = new RowLayout () {
|
Y = TemperatureView.Bottom,
|
Height = Application.GetRealHeight (160),
|
LineColor = SkinStyle.Current.MusicRowLayoutLineColor,
|
};
|
dialog.AddChidren (tempHumidityfl);
|
|
|
var btnHumidity = new Button () {
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (10),
|
TextAlignment = TextAlignment.CenterLeft,
|
Text =Language.StringByID(MyInternationalizationString.SensorHumidity),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (160 - 94 - 20 - 10 - 20),
|
TextSize = 10,
|
Enable = false,
|
};
|
tempHumidityfl.AddChidren (btnHumidity);
|
|
var btnSetHumidity = new Button () {
|
X = Application.GetRealWidth (140),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealHeight (200),
|
Height = Application.GetRealHeight (94),
|
Text = SensorHumidity + "%",
|
TextSize = 18,
|
Enable = false,
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
};
|
tempHumidityfl.AddChidren (btnSetHumidity);
|
|
var btnReduceHumidity = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (20),
|
UnSelectedImagePath = "AC/AC-.png",
|
SelectedImagePath = "AC/AC-Selected.png",
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
};
|
tempHumidityfl.AddChidren (btnReduceHumidity);
|
|
var btnAddHumidity = new Button () {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (94),
|
X = Application.GetRealWidth (480 - 20 - 94),
|
|
UnSelectedImagePath = "AC/AC+.png",
|
SelectedImagePath = "AC/AC+Selected.png",
|
Y = Application.GetRealHeight (160 - 94 - 20),
|
};
|
tempHumidityfl.AddChidren (btnAddHumidity);
|
|
btnReduceHumidity.MouseDownEventHandler += (sender, e) => {
|
btnReduceHumidity.IsSelected = true;
|
};
|
btnReduceHumidity.MouseUpEventHandler += (sender, e) => {
|
btnReduceHumidity.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
SensorHumidity--;
|
if (SensorHumidity < 0) {
|
SensorHumidity = 0;
|
}
|
btnSetHumidity.Text = SensorHumidity + "%";
|
};
|
btnAddHumidity.MouseDownEventHandler += (sender, e) => {
|
btnAddHumidity.IsSelected = true;
|
};
|
btnAddHumidity.MouseUpEventHandler += (sender, e) => {
|
btnAddHumidity.IsSelected = false;
|
btnReduceHumidity.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
//if (foolHeatTemperature < 30) {
|
// foolHeatTemperature++;
|
//}
|
SensorHumidity++;
|
btnSetHumidity.Text = SensorHumidity + "%";
|
};
|
#endregion
|
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Temperature", SensorTemperature);
|
common.Add ("Brightness", SensorHumidity);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.DoorLock: {
|
var doorLockSwitch = common.GetIntValueByKey ("Power", 0);
|
#region --- 门锁---
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnOn);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnOn.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
};
|
dialog.AddChidren (btnOff);
|
///进来更新状态
|
if (doorLockSwitch == 0) {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
} else {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
}
|
///开按钮点击事件
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
doorLockSwitch = 1;
|
};
|
///关按钮点击事件
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
doorLockSwitch = 0;
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", doorLockSwitch);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.DryContact: {
|
var dryContactSwitch = common.GetIntValueByKey ("Power", 0);
|
#region ---干接点---
|
var btnOn = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnOn);
|
var btnOff = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (80),
|
X = btnOn.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (135),
|
BackgroundColor = 0xFF787878,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.OFF,
|
};
|
dialog.AddChidren (btnOff);
|
///进来更新状态
|
if (dryContactSwitch == 0) {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
} else {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
}
|
///开按钮点击事件
|
btnOn.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = true;
|
btnOff.IsSelected = false;
|
dryContactSwitch = 1;
|
};
|
///关按钮点击事件
|
btnOff.MouseUpEventHandler += (sender, e) => {
|
btnOn.IsSelected = false;
|
btnOff.IsSelected = true;
|
dryContactSwitch = 0;
|
};
|
#endregion
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Power", dryContactSwitch);
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
}
|
break;
|
case DeviceType.MusicModel: {
|
|
var musicsource = common.GetIntValueByKey ("Source", 1);
|
var playstatus = common.GetIntValueByKey ("Status", 0);
|
var volume = common.GetIntValueByKey ("Volume", 0);
|
var musicmode = common.GetIntValueByKey ("Mode", 0);
|
int upper = 5;
|
int index = 1000;
|
|
dialog.Height = Application.GetRealHeight (670+30);
|
dialog.Width = Application.GetRealHeight (620);
|
dialog.X = Application.GetRealHeight (10);
|
dialog.Y = Application.GetRealHeight (190);
|
titleView.Width = Application.GetRealHeight (620);
|
bottomView.Width = Application.GetRealHeight (620);
|
bottomView.Y = Application.GetRealHeight (670+30 - 80);
|
btnBack.Width = Application.GetRealWidth (309);
|
btnSave.Width = Application.GetRealWidth (310);
|
btnSave.X = Application.GetRealWidth (310);
|
title.Gravity = Gravity.Center;
|
btnLine.X = btnBack.Right;
|
|
#region ---音乐源---
|
var btnSD = new Button {
|
Width = Application.GetRealWidth (130),
|
Height = Application.GetRealHeight (60),
|
X = Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (110),
|
BackgroundColor = 0xFF2f2f2f,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
Text = "SD",
|
//TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnSD);
|
|
var btnEL = new Button {
|
Width = Application.GetRealWidth (130),
|
Height = Application.GetRealHeight (60),
|
X = btnSD.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (110),
|
BackgroundColor = 0xFF2f2f2f,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
TextID = MyInternationalizationString.ON,//"On",
|
Text = "Exteranl lnput",
|
};
|
dialog.AddChidren (btnEL);
|
var btnftp = new Button {
|
Width = Application.GetRealWidth (130),
|
Height = Application.GetRealHeight (60),
|
X = btnEL.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (110),
|
BackgroundColor = 0xFF2f2f2f,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
Text = "FTP",
|
//TextID = MyInternationalizationString.ON,//"On",
|
};
|
dialog.AddChidren (btnftp);
|
var btnRadio = new Button {
|
Width = Application.GetRealWidth (130),
|
Height = Application.GetRealHeight (60),
|
X = btnftp.Right + Application.GetRealWidth (20),
|
Y = Application.GetRealHeight (110),
|
BackgroundColor = 0xFF2f2f2f,
|
SelectedBackgroundColor = 0xFFEB642C,
|
TextAlignment = TextAlignment.Center,
|
//TextID = MyInternationalizationString.ON,//"On",
|
Text = "Radio",
|
};
|
dialog.AddChidren (btnRadio);
|
|
btnSD.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
musicsource = 1;
|
btnSD.IsSelected = true;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = false;
|
|
};
|
btnEL.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
musicsource = 2;
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = true;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = false;
|
};
|
|
btnftp.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
musicsource = 3;
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = true;
|
btnRadio.IsSelected = false;
|
};
|
|
btnRadio.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 3)) {
|
return;
|
}
|
musicsource = 4;
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = true;
|
};
|
|
if (musicsource == 1) {
|
btnSD.IsSelected = true;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = false;
|
} else if (musicsource == 2) {
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = true;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = false;
|
} else if (musicsource == 3) {
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = true;
|
btnRadio.IsSelected = false;
|
} else if (musicsource == 4) {
|
btnSD.IsSelected = false;
|
btnEL.IsSelected = false;
|
btnftp.IsSelected = false;
|
btnRadio.IsSelected = true;
|
}
|
|
|
#endregion
|
|
#region 上,下,暂停/播放
|
var tempFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (130),
|
Y = Application.GetRealHeight (220),
|
};
|
dialog.AddChidren (tempFrameLayout);
|
|
var prev = new Button {
|
Width = Application.GetMinRealAverage (126),
|
Height = Application.GetMinRealAverage (126),
|
X = Application.GetRealWidth (70),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayPrve.png",
|
SelectedImagePath = "MusicIcon/PlayPrveSelected.png",
|
};
|
tempFrameLayout.AddChidren (prev);
|
prev.MouseDownEventHandler += (sender, e) => {
|
prev.IsSelected = true;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
upper = 0;
|
//common.Add ("Upper", 0);
|
};
|
prev.MouseUpEventHandler += (sender, e) => {
|
prev.IsSelected = false;
|
};
|
|
var btnPlay = new Button {
|
Width = Application.GetMinRealAverage (159),
|
Height = Application.GetMinRealAverage (127),
|
X = Application.GetRealWidth (126 + 34 + 70),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/Playplay.png",
|
SelectedImagePath = "MusicIcon/playmusicplaySelected.png",
|
};
|
tempFrameLayout.AddChidren (btnPlay);
|
btnPlay.MouseDownEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 0)) {
|
return;
|
}
|
if (btnPlay.IsSelected) {
|
btnPlay.IsSelected = false;
|
//common.Add ("Status", 2);
|
playstatus = 2;
|
} else {
|
btnPlay.IsSelected = true;
|
playstatus = 1;
|
//common.Add ("Status", 1);
|
}
|
};
|
if (playstatus == 1) {
|
btnPlay.IsSelected = true;
|
} else {
|
btnPlay.IsSelected = false;
|
}
|
var next = new Button {
|
Width = Application.GetMinRealAverage (126),
|
Height = Application.GetMinRealAverage (126),
|
X = Application.GetRealWidth (620 - 70 - 126),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/PlayNext.png",
|
SelectedImagePath = "MusicIcon/PlayNextSelected.png",
|
};
|
tempFrameLayout.AddChidren (next);
|
next.MouseDownEventHandler += (sender, e) => {
|
next.IsSelected = true;
|
if (!Isdevicd (common, 2)) {
|
return;
|
}
|
//common.Add ("Upper", 1);
|
upper = 1;
|
};
|
next.MouseUpEventHandler += (sender, e) => {
|
next.IsSelected = false;
|
};
|
#endregion
|
|
#region 音量+,-
|
var volumeFrameLayout = new FrameLayout {
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight (100),
|
Y = Application.GetRealHeight (380),
|
};
|
dialog.AddChidren (volumeFrameLayout);
|
|
var redbtnMusicvol = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (1),//20
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/redvol.png",
|
SelectedImagePath = "MusicIcon/Selectedredvol.png",
|
};
|
volumeFrameLayout.AddChidren (redbtnMusicvol);
|
|
|
var addbtnMusicvo = new Button {
|
Width = Application.GetRealWidth (107),
|
Height = Application.GetRealHeight (127),
|
X = Application.GetRealWidth (620 - 107 - 1),//620-107 - 20
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/addvol.png",
|
SelectedImagePath = "MusicIcon/Selectedaddvol.png",
|
};
|
volumeFrameLayout.AddChidren (addbtnMusicvo);
|
|
var frameLayout = new FrameLayout {
|
Width = Application.GetRealWidth (438),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterVertical,
|
X = Application.GetRealWidth (90),//107+20+10
|
};
|
volumeFrameLayout.AddChidren (frameLayout);
|
//当前播放的音量
|
var horizontalSeekBarVol = new HorizontalSeekBar {
|
Width = Application.GetRealWidth (438 - 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 = volume,
|
//IsCanClick=false
|
};
|
frameLayout.AddChidren (horizontalSeekBarVol);
|
horizontalSeekBarVol.ProgressChanged += (sender, e) => {
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
//common.Add ("Volume", horizontalSeekBarVol.Progress);
|
volume = horizontalSeekBarVol.Progress;
|
};
|
|
//加音量
|
addbtnMusicvo.MouseUpEventHandler += (sen, e) => {
|
addbtnMusicvo.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
var voladd = horizontalSeekBarVol.Progress + 1;
|
if (voladd > 100) {
|
voladd = 100;
|
}
|
horizontalSeekBarVol.Progress = voladd;
|
volume = voladd;
|
};
|
addbtnMusicvo.MouseDownEventHandler += (sen, e) => {
|
addbtnMusicvo.IsSelected = true;
|
};
|
|
//减音量
|
redbtnMusicvol.MouseUpEventHandler += (sen, e) => {
|
redbtnMusicvol.IsSelected = false;
|
if (!Isdevicd (common, 1)) {
|
return;
|
}
|
var volred = horizontalSeekBarVol.Progress - 1;
|
if (volred < 0) {
|
volred = 0;
|
}
|
horizontalSeekBarVol.Progress = volred;
|
volume = volred;
|
|
};
|
redbtnMusicvol.MouseDownEventHandler += (sen, e) => {
|
redbtnMusicvol.IsSelected = true;
|
};
|
|
|
#endregion
|
|
#region 选曲 播放模式
|
var modeFrameLayout = new FrameLayout {
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight (80),
|
Y = Application.GetRealHeight (510),
|
};
|
dialog.AddChidren (modeFrameLayout);
|
|
var text = new Button {
|
Width = Application.GetRealWidth (150),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (20),
|
Gravity = Gravity.CenterVertical,
|
Text =Language.StringByID(MyInternationalizationString.selectionmusic),
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
modeFrameLayout.AddChidren (text);
|
|
var select = new EditText {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (50),
|
X = Application.GetRealWidth (170),
|
TextAlignment = TextAlignment.Center,
|
//Radius = (uint)Application.GetRealHeight(6),
|
//BackgroundColor = SkinStyle.Current.MusicEditTextBackgroundColor,
|
//PlaceholderText = Language.StringByID (MyInternationalizationString.Youremail),
|
PlaceholderTextColor = SkinStyle.Current.MusicEditTextPlaceholderTextColor,
|
TextColor = SkinStyle.Current.MusicTextColor,
|
BorderWidth = 1,
|
BorderColor = 0xffffffff,//SkinStyle.Current.MusicEditBorderColor,
|
Radius = 1,
|
Y = Application.GetRealHeight (15),
|
};
|
modeFrameLayout.AddChidren (select);
|
select.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 6)) {
|
return;
|
}
|
index = int.Parse (select.Text);
|
};
|
|
var modeicon = new Button {
|
Width = Application.GetRealWidth (94),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (620 - 20 - 94),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png",
|
};
|
modeFrameLayout.AddChidren (modeicon);
|
modeicon.MouseUpEventHandler += (sender, e) => {
|
if (!Isdevicd (common, 5)) {
|
return;
|
}
|
switch (musicmode) {
|
//1单曲,2单曲循环,3顺序,4全部;
|
case 1:
|
musicmode = 2;
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeDDdanquplay.png";
|
break;
|
case 2:
|
musicmode = 3;
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeshunxuplay.png";
|
break;
|
case 3:
|
musicmode = 4;
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
break;
|
case 4:
|
musicmode = 1;
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeDanquplay.png";
|
break;
|
default:
|
musicmode = 3;
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeshunxuplay.png";
|
break;
|
}
|
};
|
switch (musicmode) {
|
//1单曲,2单曲循环,3顺序,4全部;
|
case 1:
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeDDdanquplay.png";
|
break;
|
case 2:
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeshunxuplay.png";
|
break;
|
case 3:
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeliebiaoplay.png";
|
break;
|
case 4:
|
modeicon.UnSelectedImagePath = "MusicIcon/playModeDanquplay.png";
|
break;
|
}
|
#endregion
|
|
btnSave.MouseUpEventHandler += (sender2, e2) => {
|
common.Add ("Source", musicsource);
|
common.Add ("Status", playstatus);
|
common.Add ("Volume", volume);
|
common.Add ("Mode", musicmode);
|
if (upper != 5) {
|
common.Add ("Upper", upper);
|
}
|
if (index != 1000) {
|
common.Add ("Index", index);
|
}
|
dialog.Close ();
|
Control.ModifyScene (scene, (obj) => { });
|
};
|
|
}
|
break;
|
case DeviceType.A31MusicModel: {
|
|
#region ---音乐---
|
// var music1 = common as Music;
|
|
// var controlfl = new FrameLayout {
|
// Height = Application.GetRealHeight (60),
|
// Y = titleView.Height,
|
// };
|
// dialog.AddChidren (controlfl);
|
// ///播放控制
|
// var controlbtn = new Button {
|
// Text = Language.StringByID (MyInternationalizationString.PlayControl) + ":",
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (35),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// controlfl.AddChidren (controlbtn);
|
|
// var controlSpinner = new Spinner () {
|
// Height = Application.GetRealHeight (40),
|
// Width = Application.GetRealWidth (150),
|
// X = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// Text = music1.control,
|
// };
|
// //Language.StringByID (MyInternationalizationString.);
|
// ///播放控制点击事件
|
// controlSpinner.AdapterStr = new string [] {
|
// Language.StringByID(MyInternationalizationString.start),
|
// Language.StringByID(MyInternationalizationString.stop),
|
// Language.StringByID(MyInternationalizationString.pause),
|
// Language.StringByID(MyInternationalizationString.Notconfigured)};
|
// controlSpinner.SelectedItemChanged += (sender, e) => {
|
// switch (controlSpinner.AdapterStr [e].ToString ()) {
|
// case "开始":
|
// case "start":
|
// music1.control = "start";
|
// break;
|
// case "停止":
|
// case "stop":
|
// music1.control = "stop";
|
// break;
|
// case "暂停":
|
// case "pause":
|
// music1.control = "pause";
|
// break;
|
// case "未设置":
|
// case "Not Configured":
|
// music1.control = "none";
|
// break;
|
// }
|
// };
|
// controlfl.AddChidren (controlSpinner);
|
|
// var modefl = new FrameLayout {
|
// Height = Application.GetRealHeight (60),
|
// Y = controlfl.Y + controlfl.Height + Application.GetRealHeight (10),
|
// };
|
// dialog.AddChidren (modefl);
|
// ///播放模式
|
// var modebtn = new Button {
|
// Text = Language.StringByID (MyInternationalizationString.PlayMode) + ":",
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (35),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// modefl.AddChidren (modebtn);
|
|
// var modeSpinner = new Spinner () {
|
// Height = Application.GetRealHeight (40),
|
// Width = Application.GetRealWidth (150),
|
// X = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// Text = music1.mode,
|
// };
|
// ///播放模式点击事件
|
// modeSpinner.AdapterStr = new string [] {
|
// Language.StringByID(MyInternationalizationString.RandomPlay),
|
// Language.StringByID(MyInternationalizationString.LoopPlay),
|
// Language.StringByID(MyInternationalizationString.SingleTuneCirculation),
|
// Language.StringByID(MyInternationalizationString.Notconfigured)
|
// };
|
|
// modeSpinner.SelectedItemChanged += (sender, e) => {
|
// switch (modeSpinner.AdapterStr [e].ToString ()) {
|
// case "随机播放":
|
// case "Random Play":
|
// music1.mode = "random";
|
// break;
|
// case "循环播放":
|
// case "Loop Play":
|
// music1.mode = "loop";
|
// break;
|
// case "单曲循环":
|
// case "Single Tune Circulation":
|
// music1.mode = "single_loop";
|
// break;
|
// case "未设置":
|
// case "Not Configured":
|
// music1.mode = "none";
|
// break;
|
// }
|
|
|
// };
|
// modefl.AddChidren (modeSpinner);
|
|
|
// var effectfl = new FrameLayout {
|
// Height = Application.GetRealHeight (60),
|
// Y = modefl.Y + modefl.Height + Application.GetRealHeight (10),
|
// };
|
// dialog.AddChidren (effectfl);
|
|
// var effectbtn = new Button {
|
// Text = Language.StringByID (MyInternationalizationString.SoundEffect) + ":",
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (35),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// effectfl.AddChidren (effectbtn);
|
|
// var effectSpinner = new Spinner () {
|
// Height = Application.GetRealHeight (40),
|
// Width = Application.GetRealWidth (150),
|
// X = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// Text = music1.effect,
|
// };
|
// ///音效点击事件
|
// effectSpinner.AdapterStr = new string [] {
|
// Language.StringByID(MyInternationalizationString.Classical),
|
// Language.StringByID(MyInternationalizationString.Modern),
|
// Language.StringByID(MyInternationalizationString.Rock),
|
// Language.StringByID(MyInternationalizationString.PopMusic),
|
// Language.StringByID(MyInternationalizationString.DanceMusic),
|
// Language.StringByID(MyInternationalizationString.Native),
|
// Language.StringByID(MyInternationalizationString.Notconfigured)
|
// };
|
|
// effectSpinner.SelectedItemChanged += (sender, e) => {
|
// switch (effectSpinner.AdapterStr [e].ToString ()) {
|
// case "古典":
|
// case "classical":
|
// music1.effect = "classical";
|
// break;
|
|
// case "现代":
|
// case "Modern":
|
// music1.effect = "modern";
|
// break;
|
|
// case "摇滚":
|
// case "Rock":
|
// music1.effect = "rock";
|
// break;
|
|
// case "流行":
|
// case "Pop Music":
|
// music1.effect = "popular";
|
// break;
|
|
// case "舞曲":
|
// case "Dance Music":
|
// music1.effect = "dance";
|
// break;
|
|
// case "原生":
|
// case "Native":
|
// music1.effect = "native";
|
// break;
|
|
// case "未设置":
|
// case "Not Configured":
|
// music1.effect = "none";
|
// break;
|
// }
|
|
// };
|
// effectfl.AddChidren (effectSpinner);
|
|
// var songnamefl = new FrameLayout {
|
// Height = Application.GetRealHeight (60),
|
// Y = effectfl.Y + effectfl.Height + Application.GetRealHeight (10),
|
// };
|
// dialog.AddChidren (songnamefl);
|
|
// var btn = new Button {
|
// Text = Language.StringByID (MyInternationalizationString.songname) + ":",
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (35),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// songnamefl.AddChidren (btn);
|
|
// var song_namebtn = new Button {
|
// Text = "",//music1.values.song_information.song_name == "" ? "UnKown" : music1.values.song_information.singer_name,
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (170),
|
// };
|
// songnamefl.AddChidren (song_namebtn);
|
|
// var songerfl = new FrameLayout {
|
// Height = Application.GetRealHeight (60),
|
// Y = songnamefl.Y + songnamefl.Height + Application.GetRealHeight (10),
|
// };
|
// dialog.AddChidren (songerfl);
|
|
// var songerbtn = new Button {
|
// Text = Language.StringByID (MyInternationalizationString.songer) + ":",
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (35),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// songerfl.AddChidren (songerbtn);
|
|
// var singer_namebtn = new Button {
|
// Text ="",// music1.values.song_information.singer_name == "" ? "UnKown" : music1.values.song_information.singer_name,
|
// Width = Application.GetRealWidth (200),
|
// Gravity = Gravity.CenterVertical,
|
// X = Application.GetRealWidth (170),
|
// };
|
// songerfl.AddChidren (singer_namebtn);
|
// break;
|
|
#endregion
|
}
|
break;
|
}
|
|
}
|
|
void FreshAirReadupdateModeImage (int mode, Button btn)
|
{
|
///新风:mode:(0:智能,1:新风,2:内循环,3:恒温)
|
switch (mode) {
|
case 0:
|
btn.UnSelectedImagePath = "FreshAir/FASmart.png";
|
break;
|
case 1:
|
btn.UnSelectedImagePath = "FreshAir/FAManual.png";
|
break;
|
case 2:
|
btn.UnSelectedImagePath = "FreshAir/FAInternalCirculation.png";
|
break;
|
case 3:
|
btn.UnSelectedImagePath = "FreshAir/FAConstantTemp.png";
|
break;
|
default:
|
btn.UnSelectedImagePath = "FreshAir/FASmart.png";
|
break;
|
}
|
}
|
|
void ACupdateModeImage (int mode, Button btn)
|
{
|
///空调:mode:(0:制冷,1:制热,2:通风,3:自动,4:抽湿)
|
switch (mode) {
|
case 0:
|
btn.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
break;
|
case 1:
|
btn.UnSelectedImagePath = "AC/ACHeating.png";
|
break;
|
case 2:
|
btn.UnSelectedImagePath = "AC/ACModeAuto.png";
|
break;
|
case 3:
|
btn.UnSelectedImagePath = "AC/ACAuto.png";
|
break;
|
case 4:
|
btn.UnSelectedImagePath = "AC/ACDehumidification.png";
|
break;
|
default:
|
btn.UnSelectedImagePath = "AC/ACRefrigeration.png";
|
break;
|
}
|
}
|
|
void updateWindSpeed (int windSpeed, Button btn)
|
{
|
///风速:(0:自动;1:低风;2:中风;3:高风;)
|
switch (windSpeed) {
|
case 0:
|
btn.UnSelectedImagePath = "AC/ACAuto.png";
|
break;
|
case 1:
|
btn.UnSelectedImagePath = "AC/ACLowWind.png";
|
break;
|
case 2:
|
btn.UnSelectedImagePath = "AC/ACStroke.png";
|
break;
|
case 3:
|
btn.UnSelectedImagePath = "AC/ACHighWind.png";
|
break;
|
default:
|
btn.UnSelectedImagePath = "AC/ACAuto.png";
|
break;
|
}
|
}
|
/// <summary>
|
/// 是否支持的功能
|
/// </summary>
|
/// <returns>The isdevicd.</returns>
|
/// <param name="common">当前设备</param>
|
/// <param name="val">属性值</param>
|
public static bool Isdevicd (SuperGateWayCommon common, int val)
|
{
|
var sidlist= new List<string> ();
|
var l = new List<int> ();
|
|
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);
|
l.Add (property);
|
}
|
|
foreach (var i in l) {
|
if (i == val) {
|
return true;
|
}
|
}
|
MainPage.AddTip (Language.StringByID(MyInternationalizationString.unsuccessful), 1000);
|
return false;
|
|
//var d = l.Find ((o) => o == val);
|
//if (d == 0) {
|
// ///提示:Shared.Tip Language.StringByID (MyInternationalizationString.addsuccess
|
// MainPage.AddTip ("暂不支持该编辑,编辑不成功", 1000);
|
// return false;
|
//}
|
|
} catch {
|
return false;
|
}
|
}
|
}
|
}
|