From 58074f23f4eca81f96565946a5faf8c53e6202d1 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 26 二月 2021 14:12:41 +0800
Subject: [PATCH] 上传测试
---
HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs | 325 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 320 insertions(+), 5 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
index 96b2b0f..945a64c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
@@ -1,21 +1,336 @@
-锘縰sing System;
-using Shared;
+锘縰sing Shared;
+using HDL_ON.Stan;
using HDL_ON.UI.CSS;
+using HDL_ON.Entity;
+using System.Collections.Generic;
namespace HDL_ON.UI
{
/// <summary>
/// 鏅捐。鏋剁晫闈�
/// </summary>
- public class ClothesHangerPage : FrameLayout
+ public class ClothesHangerPage : DeviceFunctionCardCommonForm
{
- public ClothesHangerPage()
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 鍥炬爣
+ /// </summary>
+ private Button btnIcon = null;
+ /// <summary>
+ /// 涓婂崌
+ /// </summary>
+ Button btnUp;
+ /// <summary>
+ /// 鍋滄
+ /// </summary>
+ Button btnStop;
+ /// <summary>
+ /// 涓嬮檷
+ /// </summary>
+ Button btnDown;
+ /// <summary>
+ /// 鏂囨湰鎺т欢
+ /// </summary>
+ private NormalViewControl btnSuctionView = null;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鍒濆鍖栫櫧鑹插尯鍩熺殑鍐呭
+ /// </summary>
+ public override void InitFrameWhiteContent()
{
+ base.ShowColltionButton = false;
+ base.SetTitleText(Language.StringByID(StringId.Electric));
+
+ //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
+ this.InitFrameWhiteContent1();
+
+ //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
+ this.RefreshNowDeviceStatuMemory(this.device);
+ //鍒锋柊鐣岄潰鐘舵��
+ this.RefreshFormStatu();
+ //璇诲彇鐘舵��
+ new System.Threading.Thread(() =>
+ {
+ DriverLayer.Control.Ins.SendReadCommand(device);
+ })
+ { IsBackground = true }.Start();
}
- public void LoadPage()
+ /// <summary>
+ /// 鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
+ /// </summary>
+ private void InitFrameWhiteContent1()
{
+ btnIcon = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Y = Application.GetRealHeight(85),
+ Width = Application.GetRealWidth(195),
+ Height = Application.GetRealHeight(121),
+ UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerBgIcon.png",
+ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerBgIconOn.png",
+ };
+ FrameWhiteCentet1.AddChidren(btnIcon);
+ #region 涓婂崌 鍋滄 涓嬮檷
+ btnUp = new Button()
+ {
+ X = Application.GetRealWidth(42),
+ Y = Application.GetRealHeight(236),
+ Width = Application.GetRealWidth(28),
+ Height = Application.GetRealWidth(28),
+ UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerUpIcon.png",
+ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerUpIconOn.png",
+ };
+ FrameWhiteCentet1.AddChidren(btnUp);
+
+ btnStop = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Y = Application.GetRealHeight(236),
+ Width = Application.GetRealWidth(28),
+ Height = Application.GetRealWidth(28),
+ UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerStopIcon.png",
+ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerStopIconOn.png",
+ };
+ FrameWhiteCentet1.AddChidren(btnStop);
+
+ btnDown = new Button()
+ {
+ X = Application.GetRealWidth(257),
+ Y = Application.GetRealHeight(236),
+ Width = Application.GetRealWidth(28),
+ Height = Application.GetRealWidth(28),
+ UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon.png",
+ SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIconOn.png",
+ };
+ FrameWhiteCentet1.AddChidren(btnDown);
+
+ #endregion
+
+ #region 鑿滃崟
+ var menu = new List<string>() {
+ FunctionAttributeKey.HotDry,
+ FunctionAttributeKey.WindDry,
+ FunctionAttributeKey.Disinfect,
+ FunctionAttributeKey.OnOff
+ };
+
+ int index = 0;
+ List<string> attrs = device.GetAttributes();
+ ClothesHangerControl hotDryView = new ClothesHangerControl(
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerHotDryIcon.png",
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerHotDryIconOn.png",
+ Language.StringByID(StringId.HotDry),
+ device.GetAttrState(FunctionAttributeKey.HotDryTimeLeft));
+ hotDryView.X = 0;
+ hotDryView.Y = Application.GetRealHeight(288);
+ hotDryView.Width = Application.GetRealWidth(96);
+ hotDryView.Height = Application.GetRealHeight(74);//28 29 14 3
+ if (attrs.Contains(menu[0]) || true)
+ {
+ FrameWhiteCentet1.AddChidren(hotDryView);
+ index++;
+ }
+
+ ClothesHangerControl windDryView = new ClothesHangerControl(
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerWindDryIcon.png",
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerWindDryIconOn.png",
+ Language.StringByID(StringId.WindDry),
+ device.GetAttrState(FunctionAttributeKey.WindDryTimeLeft));
+ windDryView.Y = Application.GetRealHeight(288);
+ windDryView.Width = Application.GetRealWidth(96);
+ windDryView.Height = Application.GetRealHeight(74);
+ if (attrs.Contains(menu[1]) || true)
+ {
+ if(index == 1)
+ {
+ windDryView.Gravity = Gravity.CenterHorizontal;
+ }
+ FrameWhiteCentet1.AddChidren(windDryView);
+ index++;
+ }
+
+
+
+ ClothesHangerControl disinfectDryView = new ClothesHangerControl(
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDisinfectIcon.png",
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDisinfectIconOn.png",
+ Language.StringByID(StringId.Disinfect),
+ device.GetAttrState(FunctionAttributeKey.DisinfectTimeLeft));
+ disinfectDryView.Y = Application.GetRealHeight(288);
+ disinfectDryView.Width = Application.GetRealWidth(96);
+ disinfectDryView.Height = Application.GetRealHeight(74);
+ if (attrs.Contains(menu[2]) || true)
+ {
+ if(index == 1)
+ {
+ disinfectDryView.Gravity = Gravity.CenterHorizontal;
+ }
+ else if (index == 2)
+ {
+ disinfectDryView.X = Application.GetRealWidth(266 - 33);
+ }
+ FrameWhiteCentet1.AddChidren(disinfectDryView);
+ index++;
+ }
+
+ ClothesHangerControl lightingView = new ClothesHangerControl(
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerLightIcon.png",
+ "FunctionIcon/Electrical/ClothesHanger/ClothesHangerLightIconOn.png",
+ Language.StringByID(StringId.Lighting),
+ "");
+ lightingView.Width = Application.GetRealWidth(96);
+ lightingView.Height = Application.GetRealHeight(74);
+ if (attrs.Contains(menu[3]) || true)
+ {
+ if(index >2)
+ {
+ lightingView.Y = Application.GetRealHeight(375);
+ }else
+ {
+ if (index == 1)
+ {
+ lightingView.Gravity = Gravity.CenterHorizontal;
+ }
+ else if (index == 2)
+ {
+ lightingView.X = Application.GetRealWidth(266 - 33);
+ }
+ }
+ FrameWhiteCentet1.AddChidren(lightingView);
+ index++;
+ }
+
+ #endregion
+ }
+ #endregion
+
+ #region 鈻� 璁惧鐘舵�佸弽棣坃______________________
+
+ /// <summary>
+ /// 璁惧鐘舵�佸弽棣�
+ /// </summary>
+ /// <param name="i_LocalDevice"></param>
+ public override void DeviceStatuPush(Function i_LocalDevice)
+ {
+ //涓嶆槸鍚屼竴涓笢瑗�
+ if (this.device.sid != i_LocalDevice.sid) { return; }
+
+ //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
+ this.RefreshNowDeviceStatuMemory(i_LocalDevice);
+ //鍒锋柊鐣岄潰鐘舵��
+ this.RefreshFormStatu();
+ }
+
+ #endregion
+
+ #region 鈻� 鍙戦�佸悇绉嶅懡浠______________________
+
+ #endregion
+
+ #region 鈻� 鍒锋柊鐣岄潰鐘舵�乢______________________
+
+ /// <summary>
+ /// 鍒锋柊鐣岄潰鐘舵��
+ /// </summary>
+ private void RefreshFormStatu()
+ {
+ Application.RunOnMainThread(() => {
+ var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status);
+ if (temp != null)
+ {
+ if (temp.value == "true")
+ {
+ }
+ else
+ {
+ }
+ }
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
+ /// </summary>
+ private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
+ {
+ foreach (var data in i_LocalDevice.status)
+ {
+ //寮�鍏�
+ //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; }
+ }
+ }
+
+ #endregion
+ }
+
+ public class ClothesHangerControl : FrameLayout
+ {
+ private Button btnIcon;
+ private Button btnTitle;
+ private Button btnTime;
+
+ public ClothesHangerControl(string iconPath1, string iconPath2,string title,string time)
+ {
+
+
+ btnIcon = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(28),
+ Height = Application.GetRealWidth(28),
+ UnSelectedImagePath = iconPath1,
+ SelectedImagePath = iconPath2,
+ };
+ this.AddChidren(btnIcon);
+
+ btnTitle = new Button()
+ {
+ Gravity = Gravity.Center,
+ Text = title,
+ TextColor = CSS_Color.TextualColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ };
+ this.AddChidren(btnTitle);
+
+ btnTime = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Text = time,
+ TextColor = CSS_Color.TextualColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+ };
+ this.AddChidren(btnTime);
+ }
+ /// <summary>
+ /// 淇敼鏄剧ず鏃堕棿
+ /// </summary>
+ /// <param name="newTime"></param>
+ public void ChangeTime (string newTime)
+ {
+ btnTime.Text = newTime;
+ }
+
+ public void ChangeViewStatus(bool state)
+ {
+ btnIcon.IsSelected = btnTitle.IsSelected = btnTime.IsSelected = state;
+ }
+
+ public bool GetViewState()
+ {
+ return btnIcon.IsSelected;
}
}
}
--
Gitblit v1.8.0