using System;
|
using Shared;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
|
namespace HDL_ON.UI
|
{
|
public partial class ACPage : FrameLayout
|
{
|
|
#region 控件集合
|
static ACPage bodyView;
|
/// <summary>
|
/// 功能名称按钮
|
/// </summary>
|
Button btnFunctionName;
|
/// <summary>
|
/// 房间楼层信息按钮
|
/// </summary>
|
Button btnFromFoorAndRoom;
|
/// <summary>
|
/// 收藏按钮
|
/// </summary>
|
Button btnCollection;
|
/// <summary>
|
/// 空调温度控制控件
|
/// </summary>
|
ArcSeekBar arcBar;
|
/// <summary>
|
/// 减号按钮
|
/// </summary>
|
Button btnMinus;
|
/// <summary>
|
/// 加号按钮
|
/// </summary>
|
Button btnPlus;
|
/// <summary>
|
/// 温度按钮
|
/// </summary>
|
Button btnTemp;
|
Button btnTempUint;
|
/// <summary>
|
/// 室内温度按钮
|
/// </summary>
|
Button btnIndoorTemp;
|
/// <summary>
|
/// 模式按钮
|
/// </summary>
|
Button btnMode;
|
/// <summary>
|
/// 风俗按钮
|
/// </summary>
|
Button btnWindSpeed;
|
/// <summary>
|
/// 电源按钮
|
/// </summary>
|
Button btnSwitch;
|
/// <summary>
|
/// 修改模式信息区域
|
/// </summary>
|
//FrameLayout modeChangeView;
|
/// <summary>
|
/// 修改风速信息区域
|
/// </summary>
|
//FrameLayout fanChangeView;
|
#endregion
|
|
#region 区域变量
|
AC aC;
|
Button btnCollection_Out;
|
Button btnFunctionName_Out;
|
Button btnFromFloor_Out;
|
/// <summary>
|
/// 刷新显示信息
|
/// </summary>
|
Action actionRefresh;
|
#endregion
|
public ACPage(AC func)
|
{
|
bodyView = this;
|
aC = func;
|
}
|
|
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
btnCollection_Out = btnCollectionIcon;
|
btnFunctionName_Out = btnFunctionNameOut;
|
btnFromFloor_Out = btnFromFloorOut;
|
|
FrameLayout controlView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(88),
|
Width = Application.GetRealWidth(327),
|
Height = Application.GetRealHeight(526),
|
BackgroundImagePath = "Public/Fragmentbg.png",
|
};
|
bodyView.AddChidren(controlView);
|
|
btnFunctionName = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(37),
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
|
Text = aC.name,
|
};
|
controlView.AddChidren(btnFunctionName);
|
|
btnFromFoorAndRoom = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = btnFunctionName.Bottom,
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(21),
|
TextColor = CSS_Color.PromptingColor1,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = aC.GetRoomListName()
|
};
|
controlView.AddChidren(btnFromFoorAndRoom);
|
|
btnCollection = new Button()
|
{
|
X = Application.GetRealWidth(273),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetMinRealAverage(40),
|
Height = Application.GetMinRealAverage(40),
|
SelectedImagePath = "Collection/CollectionIcon.png",
|
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
|
IsSelected = aC.collection
|
};
|
controlView.AddChidren(btnCollection);
|
|
arcBar = new ArcSeekBar()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(120),
|
Width = Application.GetRealWidth(280),
|
Height = Application.GetRealWidth(280),
|
OpenAngle = 160,
|
ThumbColor = CSS_Color.AuxiliaryColor1,
|
ThumbModeFill = true,
|
ProgressBarColor = aC.on_off == "on"? CSS_Color.MainColor :CSS_Color.PromptingColor2,
|
ThumbRadius = Application.GetRealWidth(12),
|
ArcWidthWithDefaultStyle = Application.GetRealWidth(12),
|
MinValue = 16,
|
MaxValue = 38,
|
Progress = aC.curTemp,
|
ProgressBarUnitSring = "°C",
|
IsClickable = true,
|
ProgressTextColor = 0x00000000,
|
ArcColor = CSS_Color.BackgroundColor,
|
};
|
controlView.AddChidren(arcBar);
|
|
btnTemp = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(206),
|
Width = Application.GetRealWidth(71),
|
Height = Application.GetRealWidth(60),
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = 56,
|
IsBold = true,
|
Text = aC.curTemp.ToString(),
|
TextAlignment = TextAlignment.Center,
|
};
|
controlView.AddChidren(btnTemp);
|
|
btnTempUint = new Button()
|
{
|
X = btnTemp.Right,
|
Y = btnTemp.Y,
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealWidth(20),
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
|
IsBold = true,
|
TextAlignment = TextAlignment.CenterLeft,
|
Text = "°C",
|
};
|
controlView.AddChidren(btnTempUint);
|
|
btnIndoorTemp = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = btnTemp.Bottom,
|
Width = Application.GetRealWidth(100),
|
Height = Application.GetRealHeight(20),
|
Text = Language.StringByID(StringId.IndoorTemp) + "20°C",
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
controlView.AddChidren(btnIndoorTemp);
|
|
btnMinus = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Y = Application.GetRealHeight(263),
|
Width = Application.GetRealWidth(32),
|
Height = Application.GetRealWidth(32),
|
UnSelectedImagePath = "Public/MinusSignIcon.png",
|
};
|
controlView.AddChidren(btnMinus);
|
|
btnPlus = new Button()
|
{
|
X = Application.GetRealWidth(275),
|
Y = Application.GetRealHeight(263),
|
Width = Application.GetRealWidth(32),
|
Height = Application.GetRealWidth(32),
|
UnSelectedImagePath = "Public/PlusSignIcon.png",
|
};
|
controlView.AddChidren(btnPlus);
|
|
btnMode = new Button()
|
{
|
X = Application.GetRealWidth(60),
|
Y = Application.GetRealHeight(334),
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealWidth(30),
|
UnSelectedImagePath = aC.curModeImage,
|
};
|
controlView.AddChidren(btnMode);
|
|
btnWindSpeed = new Button()
|
{
|
X = Application.GetRealWidth(235),
|
Y = Application.GetRealHeight(337),
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealWidth(30),
|
UnSelectedImagePath = aC.curFanImage,
|
};
|
controlView.AddChidren(btnWindSpeed);
|
|
btnSwitch = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(462),
|
Width = Application.GetRealWidth(40),
|
Height = Application.GetRealWidth(40),
|
UnSelectedImagePath = "Public/PowerClose.png",
|
SelectedImagePath = "Public/PowerOpen.png",
|
IsSelected = aC.on_off == "on"
|
};
|
controlView.AddChidren(btnSwitch);
|
|
LoadEventList();
|
new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(aC, actionRefresh);
|
}
|
/// <summary>
|
/// 加载修改模式区域
|
/// </summary>
|
void LoadDiv_ChangeModeView()
|
{
|
Dialog dialog = new Dialog();
|
|
FrameLayout dialogView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(dialogView);
|
|
FrameLayout modeChangeView;
|
modeChangeView = new FrameLayout()
|
{
|
X = Application.GetRealWidth(30),
|
Y = Application.GetRealHeight(128),
|
Width = Application.GetRealWidth(160),
|
Height = Application.GetRealHeight(287),
|
BackgroundImagePath = "FunctionIcon/AC/DivBg1.png",
|
Animate = Animate.DownToUp,
|
};
|
dialogView.AddChidren(modeChangeView);
|
|
Button btnTitle;
|
btnTitle = new Button()
|
{
|
X = Application.GetRealWidth(8+16),
|
Y = Application.GetRealHeight(8),
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(44),
|
TextID = StringId.ChooseMode,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
|
};
|
modeChangeView.AddChidren(btnTitle);
|
|
Button btnLine = new Button()
|
{
|
X = btnTitle.X,
|
Y = btnTitle.Bottom,
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.BackgroundColor,
|
};
|
modeChangeView.AddChidren(btnLine);
|
|
foreach(var m in aC.modeList)
|
{
|
Button btnModeIcon = new Button()
|
{
|
X = btnTitle.X,
|
Y = Application.GetRealHeight(44 * (aC.modeList.IndexOf(m) + 1) + 10 + 8),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
IsSelected = aC.trait_mode.curValues == m,
|
};
|
modeChangeView.AddChidren(btnModeIcon);
|
|
Button btnModeText = new Button()
|
{
|
X = Application.GetRealWidth(12) + btnModeIcon.Right,
|
Y = Application.GetRealHeight(44 * (aC.modeList.IndexOf(m) + 1) + 8),
|
Height = Application.GetRealHeight(44),
|
Width = Application.GetRealWidth(70),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
IsSelected = aC.trait_mode.curValues == m,
|
};
|
modeChangeView.AddChidren(btnModeText);
|
|
switch (m)
|
{
|
case "auto":
|
btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/AutoIconGray.png";
|
btnModeIcon.SelectedImagePath = "FunctionIcon/AC/AutoIcon.png";
|
btnModeText.TextID = StringId.Auto;
|
break;
|
case "cool":
|
btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/CoolIconGray.png";
|
btnModeIcon.SelectedImagePath = "FunctionIcon/AC/CoolIcon.png";
|
btnModeText.TextID = StringId.Cool;
|
break;
|
case "heat":
|
btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/HeatingIconGray.png";
|
btnModeIcon.SelectedImagePath = "FunctionIcon/AC/HeatingIcon.png";
|
btnModeText.TextID = StringId.Heat;
|
break;
|
case "dry":
|
btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/DehumidificationIconGray.png";
|
btnModeIcon.SelectedImagePath = "FunctionIcon/AC/DehumidificationIcon.png";
|
btnModeText.TextID = StringId.Dry;
|
break;
|
case "fan":
|
btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/AirSupplyIconGray.png";
|
btnModeIcon.SelectedImagePath = "FunctionIcon/AC/AirSupplyIcon.png";
|
btnModeText.TextID = StringId.AirSupply;
|
break;
|
}
|
|
if(aC.modeList.IndexOf(m) < aC.modeList.Count-1)
|
{
|
modeChangeView.AddChidren(new Button()
|
{
|
X = btnTitle.X,
|
Y = btnModeText.Bottom ,
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.BackgroundColor,
|
});
|
}
|
LoadEvent_ChangeMode(dialog, dialogView, btnModeIcon, btnModeText,m);
|
}
|
|
dialogView.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
dialog.Show();
|
}
|
/// <summary>
|
/// 加载修改模式区域
|
/// </summary>
|
void LoadDiv_ChangeFanView()
|
{
|
Dialog dialog = new Dialog();
|
|
FrameLayout dialogView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(dialogView);
|
|
FrameLayout modeChangeView;
|
modeChangeView = new FrameLayout()
|
{
|
X = Application.GetRealWidth(185),
|
Y = Application.GetRealHeight(172),
|
Width = Application.GetRealWidth(160),
|
Height = Application.GetRealHeight(243),
|
BackgroundImagePath = "FunctionIcon/AC/DivBg2.png",
|
Animate = Animate.DownToUp,
|
};
|
dialogView.AddChidren(modeChangeView);
|
|
Button btnTitle;
|
btnTitle = new Button()
|
{
|
X = Application.GetRealWidth(8 + 16),
|
Y = Application.GetRealHeight(8),
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(44),
|
TextID = StringId.ChooseFan,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
|
};
|
modeChangeView.AddChidren(btnTitle);
|
|
Button btnLine = new Button()
|
{
|
X = btnTitle.X,
|
Y = btnTitle.Bottom,
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.BackgroundColor,
|
};
|
modeChangeView.AddChidren(btnLine);
|
|
foreach (var m in aC.fan_List)
|
{
|
Button btnFanIcon = new Button()
|
{
|
X = btnTitle.X,
|
Y = Application.GetRealHeight(44 * (aC.fan_List.IndexOf(m) + 1) + 10 + 8),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
IsSelected = aC.trait_fan.curValues.ToString() == m,
|
};
|
modeChangeView.AddChidren(btnFanIcon);
|
|
Button btnFanText = new Button()
|
{
|
X = Application.GetRealWidth(12) + btnFanIcon.Right,
|
Y = Application.GetRealHeight(44 * (aC.fan_List.IndexOf(m) + 1) + 8),
|
Height = Application.GetRealHeight(44),
|
Width = Application.GetRealWidth(70),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
IsSelected = aC.trait_fan.curValues.ToString() == m,
|
};
|
modeChangeView.AddChidren(btnFanText);
|
|
switch (m)
|
{
|
case "high":
|
btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindHighIconGray.png";
|
btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindHighIcon.png";
|
btnFanText.TextID = StringId.HighWindSpeed;
|
break;
|
case "medium":
|
btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindMediumIconGray.png";
|
btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindMediumIcon.png";
|
btnFanText.TextID = StringId.MiddleWindSpeed;
|
break;
|
case "low":
|
btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindLowIconGray.png";
|
btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindLowIcon.png";
|
btnFanText.TextID = StringId.LowWindSpeed;
|
break;
|
case "auto":
|
btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/AutoIconGray.png";
|
btnFanIcon.SelectedImagePath = "FunctionIcon/AC/AutoIcon.png";
|
btnFanText.TextID = StringId.Auto;
|
break;
|
}
|
|
if (aC.modeList.IndexOf(m) < aC.modeList.Count - 1)
|
{
|
modeChangeView.AddChidren(new Button()
|
{
|
X = btnTitle.X,
|
Y = btnFanText.Bottom,
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.BackgroundColor,
|
});
|
}
|
LoadEvent_ChangeFan(dialog, dialogView, btnFanIcon, btnFanText,m);
|
}
|
|
dialog.Show();
|
}
|
|
|
}
|
}
|