From 7ef9d95ad31883e85bf5d5eab85c30f70d601077 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 02 三月 2021 17:31:57 +0800
Subject: [PATCH] Merge branch 'temp-wxr' into NewFilePath

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerSetTimePage.cs |  262 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 262 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerSetTimePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerSetTimePage.cs
new file mode 100644
index 0000000..3d4e0fb
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerSetTimePage.cs
@@ -0,0 +1,262 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DriverLayer;
+using HDL_ON.Entity;
+using HDL_ON.Stan;
+using HDL_ON.UI.CSS;
+using Shared;
+
+namespace HDL_ON.UI
+{
+    public partial class ClothesHangerSetTimePage : FrameLayout
+    {
+        FrameLayout bodyView;
+
+        Function device;
+
+        public ClothesHangerSetTimePage(Function function)
+        {
+            device = function;
+            bodyView = this;
+        }
+
+
+        /// <summary>
+        /// 鍔犺浇鐣岄潰
+        /// </summary>
+        public void LoadPage()
+        {
+            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
+            new TopViewDiv(bodyView, Language.StringByID(StringId.Time)).LoadTopView();
+
+            VerticalScrolViewLayout functionListView = new VerticalScrolViewLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(530),
+                BackgroundColor = CSS_Color.BackgroundColor,
+                ScrollEnabled = false,
+            };
+            bodyView.AddChidren(functionListView);
+
+
+            /// <summary>
+            /// 灏忔椂鍙栧�艰寖鍥�
+            /// </summary>
+            List<int> hRange = new List<int> { 0, 1, 2, 3, 4 };
+            /// <summary>
+            /// 鍒嗛挓鍙栧�艰寖鍥�
+            /// </summary>
+            List<int> mRange = new List<int> { 0, 30 };
+
+            var menu = new List<string>() {
+                FunctionAttributeKey.HotDryTime,
+                FunctionAttributeKey.WindDryTime,
+                FunctionAttributeKey.DisinfectTime,
+                FunctionAttributeKey.AnionTime
+            };
+            List<string> attrs = device.GetAttributes();
+
+            #region 鐑樺共鏃堕棿
+            ListCellView hotDryTimeCell;
+            hotDryTimeCell = new ListCellView()
+            {
+                Height = Application.GetRealHeight(50),
+            };
+            hotDryTimeCell.BtnTilte.TextID = StringId.HotDryTime;
+
+            if (attrs.Contains(menu[0]))
+            {
+
+                var hotDryTime = 0;
+                int.TryParse(device.GetAttrState(FunctionAttributeKey.HotDryTime), out hotDryTime);
+                hotDryTimeCell.BtnSubtitle.Text = hotDryTime / 60 + Language.StringByID(StringId.HourUint) + hotDryTime % 60 + Language.StringByID(StringId.MinuteUint);
+
+                functionListView.AddChidren(hotDryTimeCell);
+                hotDryTimeCell.GoAction = () =>
+                {
+                    BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3, Language.StringByID(StringId.HotDryTime));
+                    timeControl.RowHeight = Application.GetRealHeight(50);
+                    timeControl.InitControl(0, 1, 162);
+                    timeControl.ChangePickerEvent();
+                    timeControl.FinishEvent = (type, hours, min) =>
+                    {
+                        if (type == 1)//0:鍙栨秷锛�1:纭畾
+                        {
+                            HdlThreadLogic.Current.RunThread(() =>
+                            {
+                                var time = hours * 60 + min;
+                                var dic = new Dictionary<string, string>();
+                                dic.Add(FunctionAttributeKey.HotDryTime, time.ToString());
+                                Control.Ins.SendWriteCommand(this.device, dic);
+                                HdlThreadLogic.Current.RunMain(() =>
+                                {
+                                    hotDryTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint);
+                                });
+                            });
+                        }
+                    };
+                };
+            }
+
+
+            #endregion
+
+            #region 椋庡共鏃堕棿
+            ListCellView windDryCell;
+            windDryCell = new ListCellView()
+            {
+                Height = Application.GetRealHeight(50),
+            };
+            windDryCell.BtnTilte.TextID = StringId.WindDryTime;
+
+            windDryCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.WindDryTime);
+
+            if (attrs.Contains(menu[1]))
+            {
+                var windDryTime = 0;
+                int.TryParse(device.GetAttrState(FunctionAttributeKey.WindDryTime), out windDryTime);
+                windDryCell.BtnSubtitle.Text = windDryTime / 60 + Language.StringByID(StringId.HourUint) + windDryTime % 60 + Language.StringByID(StringId.MinuteUint);
+
+                functionListView.AddChidren(windDryCell);
+                windDryCell.GoAction = () =>
+                {
+                    BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3,Language.StringByID(StringId.WindDryTime));
+                    timeControl.RowHeight = Application.GetRealHeight(50);
+                    timeControl.InitControl(0, 1, 162);
+                    timeControl.ChangePickerEvent();
+                    timeControl.FinishEvent = (type, hours, min) =>
+                    {
+                        if (type == 1)//0:鍙栨秷锛�1:纭畾
+                        {
+                            HdlThreadLogic.Current.RunThread(() =>
+                            {
+                                var time = hours * 60 + min;
+                                var dic = new Dictionary<string, string>();
+                                dic.Add(FunctionAttributeKey.WindDryTime, time.ToString());
+                                Control.Ins.SendWriteCommand(this.device, dic);
+                                HdlThreadLogic.Current.RunMain(() =>
+                                {
+                                    windDryCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint);
+                                });
+                            });
+                        }
+                    };
+                };
+            }
+            else
+            {
+                hotDryTimeCell.LineView.RemoveFromParent();
+            }
+            #endregion
+
+            #region 娑堟瘨鏃堕棿
+            ListCellView disinfectTimeCell;
+            disinfectTimeCell = new ListCellView()
+            {
+                Height = Application.GetRealHeight(50),
+            };
+            disinfectTimeCell.BtnTilte.TextID = StringId.DisinfectTime;
+
+            disinfectTimeCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.DisinfectTime);
+
+            if (attrs.Contains(menu[2]))
+            {
+                var disinfectTime = 0;
+                int.TryParse(device.GetAttrState(FunctionAttributeKey.DisinfectTime), out disinfectTime);
+                disinfectTimeCell.BtnSubtitle.Text = disinfectTime / 60 + Language.StringByID(StringId.HourUint) + disinfectTime % 60 + Language.StringByID(StringId.MinuteUint);
+
+                functionListView.AddChidren(disinfectTimeCell);
+                disinfectTimeCell.GoAction = () => {
+                    BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3, Language.StringByID(StringId.DisinfectTime));
+                    timeControl.RowHeight = Application.GetRealHeight(50);
+                    timeControl.InitControl(0, 1, 162);
+                    timeControl.ChangePickerEvent();
+                    timeControl.FinishEvent = (type, hours, min) => {
+                        if (type == 1)//0:鍙栨秷锛�1:纭畾
+                        {
+                            HdlThreadLogic.Current.RunThread(() =>
+                            {
+                                var time = hours * 60 + min;
+                                var dic = new Dictionary<string, string>();
+                                dic.Add(FunctionAttributeKey.DisinfectTime, time.ToString());
+                                Control.Ins.SendWriteCommand(this.device, dic);
+                                HdlThreadLogic.Current.RunMain(() =>
+                                {
+                                    disinfectTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint);
+                                });
+                            });
+                        }
+                    };
+                };
+            }
+            else
+            {
+                windDryCell.LineView.RemoveFromParent();
+            }
+            #endregion
+
+            #region 璐熺瀛愭椂闂�
+            ListCellView anionTimeCell;
+            anionTimeCell = new ListCellView()
+            {
+                Height = Application.GetRealHeight(50),
+            };
+            anionTimeCell.BtnTilte.TextID = StringId.AnionTime;
+
+            anionTimeCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.AnionTime);
+
+            if (attrs.Contains(menu[3]))
+            {
+                var anionTime = 0;
+                int.TryParse(device.GetAttrState(FunctionAttributeKey.HotDryTime), out anionTime);
+                anionTimeCell.BtnSubtitle.Text = anionTime / 60 + Language.StringByID(StringId.HourUint) + anionTime % 60 + Language.StringByID(StringId.MinuteUint);
+
+                functionListView.AddChidren(anionTimeCell);
+                anionTimeCell.LineView.RemoveFromParent();
+
+                anionTimeCell.GoAction = () => {
+                    BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3,Language.StringByID(StringId.AnionTime));
+
+
+                    timeControl.RowHeight = Application.GetRealHeight(50);
+                    timeControl.InitControl(0, 1, 162);
+
+                    timeControl.ChangePickerEvent();
+
+                    timeControl.FinishEvent = (type, hours, min) => {
+                        if (type == 1)//0:鍙栨秷锛�1:纭畾
+                        {
+                            HdlThreadLogic.Current.RunThread(() =>
+                            {
+                                var time = hours * 60 + min;
+                                var dic = new Dictionary<string, string>();
+                                dic.Add(FunctionAttributeKey.AnionTime, time.ToString());
+                                Control.Ins.SendWriteCommand(this.device, dic);
+                                HdlThreadLogic.Current.RunMain(() =>
+                                {
+                                    anionTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint);
+                                });
+                            });
+                        }
+                    };
+                };
+            }
+            else
+            {
+                disinfectTimeCell.LineView.RemoveFromParent();
+            }
+            #endregion
+
+        }
+    }
+
+    //---------------------------------------
+    public partial class ClothesHangerSetTimePage
+    {
+
+    }
+
+    //========================================
+
+
+}
\ No newline at end of file

--
Gitblit v1.8.0