using System;
|
namespace Shared.SimpleControl.Phone
|
{
|
public class SysFresAir : FrameLayout
|
{
|
Button btnIndoorTemp;
|
Button btnOutdoorTemp;
|
Button btnSwitch;
|
Button btnContent;
|
Button btnContent0;
|
Button btnContent1;
|
Button btnContent2;
|
Button btnContent3;
|
Button btnACModeLeft;
|
Button btnACModeRight;
|
Button btnModeName;
|
Button btnModeIcon;
|
Button btnModeText;
|
Button btnACWindLeft;
|
Button btnACWindRight;
|
Button btnWindName;
|
Button btnWindIcon;
|
Button btnWindText;
|
FreshAirBLL bLL;
|
|
|
public void SysFresAirShow (FreshAir fresAir, Common faDevice)
|
{
|
bLL = new FreshAirBLL ();
|
MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
|
System.Threading.Tasks.Task.Run (() => {
|
var ss = Control.ControlBytesSendHasReturn (Command.FreshAirRead, fresAir.SubnetID, fresAir.DeviceID, new byte [] { fresAir.LoopID });
|
if (ss != null) {
|
try {
|
fresAir = Newtonsoft.Json.JsonConvert.DeserializeObject<FreshAir> (IO.FileUtils.ReadEquipmentMessage (fresAir));
|
}catch{}
|
} else {
|
|
}
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
sysFreshAirShow (fresAir, faDevice);
|
});
|
});
|
}
|
|
void sysFreshAirShow (FreshAir freshAir, Common faDevice)
|
{
|
#region top
|
RowLayout frameLayout = new RowLayout () {
|
Height = Application.GetRealHeight (100),
|
Width = LayoutParams.MatchParent,
|
BackgroundColor = SkinStyle.Current.MainColor
|
};
|
|
AddChidren (frameLayout);
|
|
Button backButton = new Button () {
|
X = Application.GetRealWidth (0),
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
backButton.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
//SystemEquipmentBase.RefreshView (faDevice);
|
};
|
frameLayout.AddChidren (backButton);
|
|
EditText textButton = new EditText () {
|
X = Application.GetRealWidth (20) + backButton.Right,
|
Height = Application.GetRealHeight (50),
|
Width = Application.GetRealWidth (400),
|
Text = freshAir.Name,
|
Gravity = Gravity.CenterVertical,
|
TextAlignment = TextAlignment.CenterLeft,
|
BackgroundColor = SkinStyle.Current.Transparent,
|
SelectedBackgroundColor = SkinStyle.Current.SysEditBox,
|
Enable = false,
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
frameLayout.AddChidren (textButton);
|
|
Button editor = new Button () {
|
X = Application.GetRealWidth (520),
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (70),
|
UnSelectedImagePath = "Item/Editor.png",
|
SelectedImagePath = "Item/EditorSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
frameLayout.AddChidren (editor);
|
editor.MouseUpEventHandler += (sender, e) => {
|
if (editor.IsSelected) {
|
editor.IsSelected = textButton.IsSelected = textButton.Enable = false;
|
MainPage.LoadingStart ();
|
if (!freshAir.EditRemark (textButton.Text.Trim ())) {
|
MainPage.DeviceNotOnline ();
|
}
|
MainPage.LoadingHide ();
|
} else {
|
textButton.Enable = textButton.IsSelected = editor.IsSelected = true;
|
}
|
};
|
#endregion
|
#region MyRegion
|
FrameLayout bodyView = new FrameLayout () {
|
Y = Application.GetRealHeight (100),
|
Height = Application.GetRealHeight (700),
|
Width = LayoutParams.MatchParent,
|
};
|
AddChidren (bodyView);
|
#region temp
|
FrameLayout controlTopView = new FrameLayout () {
|
Height = Application.GetRealHeight(110),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
bodyView.AddChidren (controlTopView);
|
Button btnIndoor = new Button () {
|
X = Application.GetRealWidth(30),
|
Width = Application.GetRealWidth(100),
|
Height = Application.GetRealHeight(65),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.BottomLeft,
|
TextID = R.MyInternationalizationString.ACInterior
|
};
|
controlTopView.AddChidren (btnIndoor);
|
btnIndoorTemp = new Button () {
|
X = btnIndoor.Right,
|
Width = Application.GetRealWidth(60),
|
Height = Application.GetRealHeight(65),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.BottomLeft,
|
Text = freshAir.InTemp.ToString() + "°"
|
};
|
controlTopView.AddChidren (btnIndoorTemp);
|
|
Button btnTempNull = new Button () {
|
X = btnIndoorTemp.Right + Application.GetRealWidth (10),
|
Y = Application.GetRealHeight (40),
|
Width = Application.GetRealWidth (2),
|
Height = Application.GetRealHeight (20),
|
BackgroundColor = SkinStyle.Current.TextColor1,
|
};
|
controlTopView.AddChidren (btnTempNull);
|
|
Button btnOutdoor = new Button () {
|
X = btnTempNull.Right + Application.GetRealWidth (20),
|
Width = Application.GetRealWidth (100),
|
Height = Application.GetRealHeight (65),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.BottomLeft,
|
TextID = R.MyInternationalizationString.OutTemp,
|
};
|
controlTopView.AddChidren (btnOutdoor);
|
btnOutdoorTemp = new Button () {
|
X = btnOutdoor.Right,
|
Width = Application.GetRealWidth (60),
|
Height = Application.GetRealHeight (65),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.BottomLeft,
|
Text = freshAir.OutTemp.ToString () + "°"
|
};
|
controlTopView.AddChidren (btnOutdoorTemp);
|
|
btnSwitch = new Button () {
|
Width = Application.GetMinRealAverage (115),
|
Height = Application.GetMinRealAverage (115),
|
X = Application.GetRealWidth (640 - 120),
|
UnSelectedImagePath = "FH/FH_Switch.png",
|
SelectedImagePath = "FH/FH_Switch_on.png",
|
};
|
controlTopView.AddChidren (btnSwitch);
|
btnSwitch.MouseUpEventHandler += (sender, e) => {
|
btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
if (btnSwitch.IsSelected) {
|
freshAir.SwitchStatus = 1;
|
} else {
|
freshAir.SwitchStatus = 0;
|
}
|
bLL.ControlFreshAir (freshAir);
|
};
|
#endregion
|
|
#region sensor
|
FrameLayout valuesView = new FrameLayout () {
|
Y = controlTopView.Bottom,
|
Height = Application.GetRealHeight(180),
|
};
|
bodyView.AddChidren (valuesView);
|
|
Button btnTitle = new Button () {
|
Width = Application.GetRealWidth(160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "PM2.5",
|
TextSize = 16,
|
};
|
valuesView.AddChidren (btnTitle);
|
btnContent = new Button () {
|
Y = btnTitle.Bottom,
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextSize = 20,
|
Text = freshAir.PM25.ToString (),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.Center,
|
};
|
valuesView.AddChidren (btnContent);
|
Button btnUnit = new Button () {
|
Y = btnContent.Bottom,
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 16,
|
Text = @"μg/m³",
|
};
|
valuesView.AddChidren (btnUnit);
|
|
Button btnTitle0 = new Button () {
|
X = Application.GetRealWidth(160),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 16,
|
Text = "TVOC",
|
};
|
valuesView.AddChidren (btnTitle0);
|
btnContent0 = new Button () {
|
Y = btnTitle0.Bottom,
|
X = Application.GetRealWidth (160),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 20,
|
Text = freshAir.TVOC.ToString (),
|
TextAlignment = TextAlignment.Center,
|
};
|
valuesView.AddChidren (btnContent0);
|
Button btnUnit0 = new Button () {
|
TextColor = SkinStyle.Current.TextColor1,
|
Y = btnContent0.Bottom,
|
X = Application.GetRealWidth (160),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextSize = 16,
|
Text = "ppm",
|
};
|
valuesView.AddChidren (btnUnit0);
|
|
Button btnTitle1 = new Button () {
|
X = Application.GetRealWidth (320),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextSize = 16,
|
Text = "CO2",
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
valuesView.AddChidren (btnTitle1);
|
btnContent1 = new Button () {
|
Y = btnTitle1.Bottom,
|
X = Application.GetRealWidth (320),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 20,
|
Text = freshAir.CO2.ToString (),
|
TextAlignment = TextAlignment.Center,
|
};
|
valuesView.AddChidren (btnContent1);
|
Button btnUnit1 = new Button () {
|
Y = btnContent1.Bottom,
|
TextColor = SkinStyle.Current.TextColor1,
|
X = Application.GetRealWidth (320),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextAlignment = TextAlignment.Center,
|
TextSize = 16,
|
Text = "ppm",
|
};
|
valuesView.AddChidren (btnUnit1);
|
|
Button btnTitle2 = new Button () {
|
X = Application.GetRealWidth (160 * 3),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.Center,
|
TextSize = 16,
|
TextID = R.MyInternationalizationString.SensorHumidity
|
};
|
valuesView.AddChidren (btnTitle2);
|
btnContent2 = new Button () {
|
X = Application.GetRealWidth (160 * 3),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
Y = btnTitle2.Bottom,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 20,
|
Text = freshAir.Humidity.ToString (),
|
TextAlignment = TextAlignment.Center,
|
};
|
valuesView.AddChidren (btnContent2);
|
Button btnUnit2 = new Button () {
|
Y = btnContent2.Bottom,
|
X = Application.GetRealWidth (160 * 3),
|
Width = Application.GetRealWidth (160),
|
Height = Application.GetRealHeight (60),
|
TextColor = SkinStyle.Current.TextColor1,
|
TextAlignment = TextAlignment.Center,
|
TextSize = 16,
|
Text = "%",
|
};
|
valuesView.AddChidren (btnUnit2);
|
#endregion
|
|
#region Pattern
|
var acModeView = new FrameLayout () {
|
Height = Application.GetRealHeight (550 / 3 + 20),
|
Width = Application.GetRealWidth (640),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
Y = valuesView.Bottom,
|
};
|
bodyView.AddChidren (acModeView);
|
|
btnACModeLeft = new Button () {
|
Width = Application.GetMinRealAverage (129),
|
Height = Application.GetMinRealAverage (129),
|
X = Application.GetRealWidth (30),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "AC/ac_left.png",
|
SelectedImagePath = "AC/ACLeftSelected.png",
|
};
|
acModeView.AddChidren (btnACModeLeft);
|
btnModeName = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (30),
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight (25),
|
TextID = R.MyInternationalizationString.Mode,
|
TextColor = SkinStyle.Current.ButtonColor,
|
};
|
acModeView.AddChidren (btnModeName);
|
btnModeIcon = new Button () {
|
Width = Application.GetMinRealAverage (110),
|
Height = Application.GetMinRealAverage (112),
|
Gravity = Gravity.Center,
|
Y = btnModeName.Bottom + Application.GetRealHeight (10),
|
UnSelectedImagePath = bLL.GetModeIcon(freshAir.SetPattern)
|
};
|
acModeView.AddChidren (btnModeIcon);
|
btnModeText = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (50),
|
TextID = bLL.GetModeTextID (freshAir.SetPattern),
|
Gravity = Gravity.CenterHorizontal,
|
Y = btnModeIcon.Bottom - Application.GetRealHeight (20),
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
acModeView.AddChidren (btnModeText);
|
btnACModeRight = new Button () {
|
Width = Application.GetMinRealAverage (129),
|
Height = Application.GetMinRealAverage (129),
|
X = Application.GetRealWidth (640 - 129 - 30),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "AC/ac_right.png",
|
SelectedImagePath = "AC/ACRightSelected.png",
|
};
|
acModeView.AddChidren (btnACModeRight);
|
|
btnACModeRight.MouseDownEventHandler += (sender, e) => {
|
btnACModeRight.IsSelected = true;
|
};
|
btnACModeRight.MouseUpEventHandler += (sender, e) => {
|
btnACModeRight.IsSelected = false;
|
freshAir.SetPattern++;
|
if (freshAir.SetPattern == 4) {
|
freshAir.SetPattern = 0;
|
}
|
bLL.ControlFreshAir (freshAir);
|
btnModeText.TextID = bLL.GetModeTextID (freshAir.SetPattern);
|
btnModeIcon.UnSelectedImagePath = bLL.GetModeIcon (freshAir.SetPattern);
|
};
|
btnACModeLeft.MouseDownEventHandler += (sender, e) => {
|
btnACModeLeft.IsSelected = true;
|
};
|
btnACModeLeft.MouseUpEventHandler += (sender, e) => {
|
btnACModeLeft.IsSelected = false;
|
if (freshAir.SetPattern == 0) {
|
freshAir.SetPattern = 4;
|
}
|
freshAir.SetPattern--;
|
bLL.ControlFreshAir (freshAir);
|
btnModeText.TextID = bLL.GetModeTextID (freshAir.SetPattern);
|
btnModeIcon.UnSelectedImagePath = bLL.GetModeIcon (freshAir.SetPattern);
|
};
|
#endregion
|
|
var btnLine1 = new Button () {
|
Height = 1,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
Y = acModeView.Bottom,
|
};
|
bodyView.AddChidren (btnLine1);
|
|
#region 风速
|
var acWindView = new FrameLayout () {
|
Height = Application.GetRealHeight (230),
|
Width = Application.GetRealWidth (640),
|
Y = btnLine1.Bottom,
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
bodyView.AddChidren (acWindView);
|
|
btnACWindLeft = new Button () {
|
Width = Application.GetMinRealAverage (129),
|
Height = Application.GetMinRealAverage (129),
|
X = Application.GetRealWidth (30),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "AC/ac_left.png",
|
SelectedImagePath = "AC/ACLeftSelected.png",
|
};
|
acWindView.AddChidren (btnACWindLeft);
|
btnWindName = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (30),
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight (21),
|
TextID = R.MyInternationalizationString.Speed,
|
TextColor = SkinStyle.Current.ButtonColor,
|
};
|
acWindView.AddChidren (btnWindName);
|
btnWindIcon = new Button () {
|
Width = Application.GetMinRealAverage (110),
|
Height = Application.GetMinRealAverage (112),
|
X = Application.GetRealWidth (262),
|
Y = Application.GetMinRealAverage (44),
|
UnSelectedImagePath = bLL.GetWindIcon(freshAir.WindSpeed),
|
};
|
acWindView.AddChidren (btnWindIcon);
|
btnWindText = new Button () {
|
Width = Application.GetRealWidth (200),
|
Height = Application.GetRealHeight (50),
|
Gravity = Gravity.CenterHorizontal,
|
TextColor = SkinStyle.Current.TextColor1,
|
Y = btnWindIcon.Bottom - Application.GetRealHeight (16),
|
TextID = bLL.GetWindTextID(freshAir.WindSpeed),
|
};
|
acWindView.AddChidren (btnWindText);
|
btnACWindRight = new Button () {
|
Width = Application.GetMinRealAverage (129),
|
Height = Application.GetMinRealAverage (129),
|
X = btnACModeRight.X,
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "AC/ac_right.png",
|
SelectedImagePath = "AC/ACRightSelected.png",
|
};
|
btnACWindLeft.MouseDownEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = true;
|
};
|
btnACWindLeft.MouseUpEventHandler += (sender, e) => {
|
btnACWindLeft.IsSelected = false;
|
freshAir.WindSpeed++;
|
if (freshAir.WindSpeed == 4) {
|
freshAir.WindSpeed = 0;
|
}
|
bLL.ControlFreshAir (freshAir);
|
btnWindText.TextID = bLL.GetWindTextID (freshAir.WindSpeed);
|
btnWindIcon.UnSelectedImagePath = bLL.GetWindIcon (freshAir.WindSpeed);
|
};
|
acWindView.AddChidren (btnACWindRight);
|
btnACWindRight.MouseDownEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = true;
|
};
|
btnACWindRight.MouseUpEventHandler += (sender, e) => {
|
btnACWindRight.IsSelected = false;
|
if (freshAir.WindSpeed == 0) {
|
freshAir.WindSpeed = 4;
|
}
|
freshAir.WindSpeed--;
|
bLL.ControlFreshAir (freshAir);
|
btnWindText.TextID = bLL.GetWindTextID (freshAir.WindSpeed);
|
btnWindIcon.UnSelectedImagePath = bLL.GetWindIcon (freshAir.WindSpeed);
|
};
|
|
#endregion
|
|
|
btnModeIcon.UnSelectedImagePath = bLL.GetModeIcon (freshAir.SetPattern);
|
btnModeText.TextID = bLL.GetModeTextID (freshAir.SetPattern);
|
btnWindIcon.UnSelectedImagePath = bLL.GetWindIcon (freshAir.WindSpeed);
|
btnWindText.TextID = bLL.GetWindTextID (freshAir.WindSpeed);
|
|
#endregion
|
//SystemMiddle.hideBottom ();
|
}
|
}
|
}
|