From d4973876384be55df64de45db8a511d1e0330872 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 六月 2021 17:06:20 +0800
Subject: [PATCH] 房间小图列表

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs |  237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 233 insertions(+), 4 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs
index ab85ff9..535912c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs
@@ -1,10 +1,239 @@
 锘縰sing System;
-namespace HDL_ON.UI.UI2.FuntionControlView.Electrical
+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 class IrFanPage
+    public class IrFanPage : DeviceFunctionCardCommonForm
     {
-        public IrFanPage()
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鍥炬爣
+        /// </summary>
+        private Button btnIcon = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍒濆鍖栫櫧鑹插尯鍩熺殑鍐呭
+        /// </summary>
+        public override void InitFrameWhiteContent()
+        {
+            base.ShowColltionButton = false;
+            base.SetTitleText(Language.StringByID(StringId.Electric));
+
+            //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
+            this.InitFrameWhiteContent1();
+            ;
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
+        /// </summary>
+        private void InitFrameWhiteContent1()
+        {
+            btnIcon = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(88),
+                Width = Application.GetRealWidth(134),
+                Height = Application.GetRealHeight(134),
+                UnSelectedImagePath = "FunctionIcon/IrFan/FanIcon.png",
+            };
+            FrameWhiteCentet1.AddChidren(btnIcon);
+
+            var patternView = new IrFanControl("FunctionIcon/IrFan/PatternIcon.png",
+                                            "FunctionIcon/IrFan/PatternIconOn.png",
+                                            Language.StringByID(StringId.Mode),
+                                            "");
+            patternView.Y = Application.GetRealHeight(263);
+            patternView.X = Application.GetRealWidth(57);
+            patternView.Width = Application.GetRealWidth(96);
+            patternView.Height = Application.GetRealHeight(74);
+            FrameWhiteCentet1.AddChidren(patternView);
+            EventHandler<MouseEventArgs> mode_EventHandler = (sender, e) =>
+            {
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add("mode", "");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            patternView.SetThouchEvent(mode_EventHandler);
+
+            var swingView = new IrFanControl("FunctionIcon/IrFan/HeadSwingingIcon.png",
+                                            "FunctionIcon/IrFan/HeadSwingingIconOn.png",
+                                            Language.StringByID(StringId.HeadSwinging),
+                                            "");
+            swingView.Y = Application.GetRealHeight(263);
+            swingView.X = Application.GetRealWidth(216);
+            swingView.Width = Application.GetRealWidth(96);
+            swingView.Height = Application.GetRealHeight(74);
+            FrameWhiteCentet1.AddChidren(swingView);
+            EventHandler<MouseEventArgs> swing_EventHandler = (sender, e) =>
+            {
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add("swing", "");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            swingView.SetThouchEvent(swing_EventHandler);
+
+
+            var timingView = new IrFanControl("FunctionIcon/IrFan/TimingIcon.png",
+                                            "FunctionIcon/IrFan/TimingIconOn.png",
+                                            Language.StringByID(StringId.Timing),
+                                            "");
+            timingView.Y = Application.GetRealHeight(366);
+            timingView.X = Application.GetRealWidth(57);
+            timingView.Width = Application.GetRealWidth(96);
+            timingView.Height = Application.GetRealHeight(74);
+            FrameWhiteCentet1.AddChidren(timingView);
+            EventHandler<MouseEventArgs> timing_EventHandler = (sender, e) =>
+            {
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add("timer", "");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            timingView.SetThouchEvent(timing_EventHandler);
+
+
+            var airVolumeView = new IrFanControl("FunctionIcon/IrFan/SpeedIcon.png",
+                                            "FunctionIcon/IrFan/SpeedIconOn.png",
+                                            Language.StringByID(StringId.AirVolume),
+                                            "");
+            airVolumeView.Y = Application.GetRealHeight(263);
+            airVolumeView.X = Application.GetRealWidth(216);
+            airVolumeView.Width = Application.GetRealWidth(96);
+            airVolumeView.Height = Application.GetRealHeight(74);
+            FrameWhiteCentet1.AddChidren(airVolumeView);
+            EventHandler<MouseEventArgs> speed_EventHandler = (sender, e) =>
+            {
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add("speed", "");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            airVolumeView.SetThouchEvent(speed_EventHandler);
+
+            Button btnPower = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(468),
+                Width = Application.GetRealWidth(32),
+                Height = Application.GetRealWidth(32),
+                UnSelectedImagePath = "FunctionIcon/IrFan/PowerIcon.png",
+                SelectedImagePath = "FunctionIcon/IrFan/PowerIconOn.png"
+            };
+            FrameWhiteCentet1.AddChidren(btnPower);
+            btnPower.MouseDownEventHandler = (sender, e) =>
+            {
+                btnPower.IsSelected = true;
+            };
+            btnPower.MouseUpEventHandler = (sender, e) => {
+                new System.Threading.Thread(() => {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add(FunctionAttributeKey.OnOff, "");
+                    Control.Ins.SendWriteCommand(device, d);
+                    System.Threading.Thread.Sleep(500);
+                    Application.RunOnMainThread(() => {
+                        btnPower.IsSelected = false;
+                    });
+                }) { IsBackground = true }.Start();
+            };
+
+
+        }
+        #endregion
+
+        #region 鈻� 璁惧鐘舵�佸弽棣坃______________________
+
+        /// <summary>
+        /// 璁惧鐘舵�佸弽棣�
+        /// </summary>
+        /// <param name="i_LocalDevice"></param>
+        public override void DeviceStatuPush(Function i_LocalDevice)
         {
         }
+
+        #endregion
     }
-}
+
+    public class IrFanControl : FrameLayout
+    {
+        private Button btnIcon;
+        private Button btnTitle;
+
+        public bool Lighting = false;
+
+
+        public IrFanControl(string unSelectedIconPath, string selectedIconPath, string title, string time)
+        {
+            btnIcon = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealWidth(28),
+                UnSelectedImagePath = unSelectedIconPath,
+                SelectedImagePath = selectedIconPath,
+            };
+            this.AddChidren(btnIcon);
+
+            btnTitle = new Button()
+            {
+                Gravity = Gravity.Center,
+                Text = title,
+                Height = Application.GetRealHeight(42),
+                TextColor = CSS_Color.TextualColor,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            };
+            this.AddChidren(btnTitle);
+
+        }
+
+        public void SetViewStatus(bool state)
+        {
+            btnIcon.IsSelected = btnTitle.IsSelected = Lighting = state;
+        }
+
+        /// <summary>
+        /// 璁剧疆鐐瑰嚮浜嬩欢
+        /// </summary>
+        public void SetThouchEvent(EventHandler<MouseEventArgs> eventHandler)
+        {
+            btnIcon.MouseUpEventHandler = eventHandler;
+            btnTitle.MouseUpEventHandler = eventHandler;
+            btnIcon.MouseDownEventHandler = (sender, e) => {
+                btnIcon.IsSelected = true;
+            };
+            btnTitle.MouseDownEventHandler = (sender, e) => {
+                btnIcon.IsSelected = true;
+            };
+            btnIcon.MouseUpEventHandler += (sender, e) => {
+                new System.Threading.Thread(() => {
+                    System.Threading.Thread.Sleep(500);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnIcon.IsSelected = true;
+                    });
+                })
+                { IsBackground = true }.Start();
+            };
+            btnTitle.MouseUpEventHandler += (sender, e) => {
+                new System.Threading.Thread(() => {
+                    System.Threading.Thread.Sleep(500);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnIcon.IsSelected = true;
+                    });
+                })
+                { IsBackground = true }.Start();
+            };
+
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0