From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期三, 22 六月 2022 11:22:18 +0800
Subject: [PATCH] 修改引用路径

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs |  396 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 226 insertions(+), 170 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs
old mode 100755
new mode 100644
index eba5ae8..b17e67e
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs
@@ -1,170 +1,226 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)
-    /// </summary>
-    public class SceneFunctionSwitchControl : FrameLayout
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 閫夋嫨浜嬩欢 1:鍦烘櫙  2:鍔熻兘
-        /// </summary>
-        public Action<int> SelectTabEvent = null;
-
-        private int m_nowSelectIndex = 1;
-        /// <summary>
-        /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅�  2锛氬姛鑳�
-        /// </summary>
-        public int nowSelectIndex
-        {
-            get { return m_nowSelectIndex; }
-        }
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖朹____________________________
-
-        /// <summary>
-        /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)
-        /// </summary>
-        public SceneFunctionSwitchControl()
-        {
-            this.Height = Application.GetRealHeight(90);
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠)
-        /// </summary>
-        public void InitControl()
-        {
-            var btnTemp = new NormalViewControl(10, 10, false);
-            btnTemp.TextID = R.MyInternationalizationString.uScence;
-
-            //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�)
-            var frameScene = new FrameLayoutControl();
-            frameScene.UseClickStatu = false;
-            frameScene.Height = Application.GetRealHeight(90);
-            frameScene.Width = btnTemp.GetRealWidthByText(16);
-            frameScene.X = ControlCommonResourse.XXLeft;
-            this.AddChidren(frameScene);
-            //鍦烘櫙
-            var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false);
-            btnScene.Text = btnTemp.Text;
-            btnScene.TextSize = 16;
-            btnScene.TextColor = UserCenterColor.Current.TextColor2;
-            frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly);
-            //搴曠嚎
-            var btnSceneLine = new NormalViewControl(40, 10, true);
-            btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14);
-            btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2;
-            btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2;
-            btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
-            frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly);
-
-            btnTemp.TextID = R.MyInternationalizationString.uFunction;
-            //鍔熻兘妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�)
-            var frameFunc = new FrameLayoutControl();
-            frameFunc.UseClickStatu = false;
-            frameFunc.Height = Application.GetRealHeight(90);
-            frameFunc.Width = btnTemp.GetRealWidthByText(16);
-            frameFunc.X = frameScene.Right + Application.GetRealWidth(58);
-            this.AddChidren(frameFunc);
-            //鍔熻兘
-            var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false);
-            btnFunc.Text = btnTemp.Text;
-            btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3;
-            frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly);
-            //搴曠嚎
-            var btnFuncLine = new NormalViewControl(40, 10, true);
-            btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14);
-            btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2;
-            btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2;
-            btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
-            frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly);
-            btnFuncLine.Visible = false;
-
-            frameScene.ButtonClickEvent += (sender, e) =>
-            {
-                //鍦烘櫙鍒嗘敮閫夋嫨
-                if (this.m_nowSelectIndex == 1)
-                {
-                    return;
-                }
-                this.m_nowSelectIndex = 1;
-
-                btnScene.TextSize = 16;
-                btnScene.TextColor = UserCenterColor.Current.TextColor2;
-                btnFunc.TextSize = 14;
-                btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3;
-                btnSceneLine.Visible = true;
-                btnFuncLine.Visible = false;
-
-                this.SelectTabEvent?.Invoke(1);
-            };
-
-            frameFunc.ButtonClickEvent += (sender, e) =>
-            {
-                //鍔熻兘鍒嗘敮閫夋嫨
-                if (this.m_nowSelectIndex == 2)
-                {
-                    return;
-                }
-                this.m_nowSelectIndex = 2;
-
-                btnScene.TextSize = 14;
-                btnScene.TextColor = UserCenterColor.Current.TextGrayColor3;
-                btnFunc.TextSize = 16;
-                btnFunc.TextColor = UserCenterColor.Current.TextColor2;
-                btnFuncLine.Visible = true;
-                btnSceneLine.Visible = false;
-
-                this.SelectTabEvent?.Invoke(2);
-            };
-            //鍥炶皟鏂规硶
-            if (this.m_nowSelectIndex == 1)
-            {
-                this.m_nowSelectIndex = 0;
-                frameScene.ButtonClickEvent?.Invoke(null, null);
-            }
-            if (this.m_nowSelectIndex == 2)
-            {
-                this.m_nowSelectIndex = 0;
-                frameFunc.ButtonClickEvent?.Invoke(null, null);
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鎺т欢鎽ф瘉___________________________
-
-        /// <summary>
-        /// 鎺т欢鎽ф瘉
-        /// </summary>
-        public override void RemoveFromParent()
-        {
-            this.SelectTabEvent = null;
-
-            base.RemoveFromParent();
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�)
-        /// </summary>
-        /// <param name="index">1锛氬満鏅�  2锛氬姛鑳�</param>
-        public void SetDefultIndex(int index)
-        {
-            this.m_nowSelectIndex = index;
-        }
-
-        #endregion
-    }
-}
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// <para>鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)</para>
+    /// <para>2020.03.10鍙樻洿:瀹冨彉鏇翠负鏂囧瓧鍨嬭彍鍗曟帶浠�</para>
+    /// </summary>
+    public class SceneFunctionSwitchControl : HorizontalScrolViewLayout
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 閫夋嫨浜嬩欢(浠�0寮�濮�)
+        /// </summary>
+        public Action<int> SelectTabEvent = null;
+        /// <summary>
+        /// 鍓嶅洖閫夋嫨鐨勭储寮�
+        /// </summary>
+        public int OldSelectIndex = 0;
+
+        private int m_nowSelectIndex = 0;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勫垎鏀�(浠�0寮�濮�)
+        /// </summary>
+        public int nowSelectIndex
+        {
+            get { return m_nowSelectIndex; }
+        }
+
+        /// <summary>
+        ///  鎵�鏈夊悕瀛楃殑鎺т欢
+        /// </summary>
+        private List<NormalViewControl> listNameControl = new List<NormalViewControl>();
+        /// <summary>
+        /// 鎵�鏈夌嚎鐨勬帶浠�
+        /// </summary>
+        private List<NormalViewControl> listLineControl = new List<NormalViewControl>();
+        /// <summary>
+        /// 榛樿鐨勯偅涓彍鍗�
+        /// </summary>
+        private FrameLayoutStatuControl frameDefult = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)
+        /// </summary>
+        public SceneFunctionSwitchControl()
+        {
+            this.Height = Application.GetRealHeight(90);
+        }
+
+        /// <summary>
+        ///  鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠)
+        /// </summary>
+        /// <param name="listTitleText">鑿滃崟鏂囧瓧鍒楄〃</param>
+        /// <param name="rightSpace">鍙宠竟绌虹櫧瀹藉害</param>
+        public void InitControl(List<string> listTitleText, int rightSpace = 0)
+        {
+            if (listTitleText.Count == 0) { return; }
+            this.listNameControl.Clear();
+            this.listLineControl.Clear();
+
+            var btnTemp = new NormalViewControl(10, 10, false);
+            btnTemp.TextSize = 16;
+
+            //鍋氭垚澶撮儴鑿滃崟鏂囧瓧
+            for (int i = 0; i < listTitleText.Count; i++)
+            {
+                btnTemp.Text = listTitleText[i];
+                //娣诲姞鏍囬鎺т欢
+                this.AddTitleTextControl(i, listTitleText[i], btnTemp.GetRealWidthByText());
+            }
+            //娣诲姞鍙宠竟绌虹櫧瀹藉害
+            if (rightSpace > 0)
+            {
+                //娣诲姞涓�涓棿闅旈棿璺�
+                var frameSpace = new FrameLayout();
+                frameSpace.Width = Application.GetRealWidth(rightSpace);
+                this.AddChidren(frameSpace);
+            }
+            //鍥炶皟鏂规硶
+            this.frameDefult.ButtonClickEvent?.Invoke(null, null);
+        }
+
+        /// <summary>
+        /// 娣诲姞鏍囬鎺т欢
+        /// </summary>
+        /// <param name="i_index"></param>
+        /// <param name="titleText"></param>
+        private void AddTitleTextControl(int i_index, string titleText, int realWidth)
+        {
+            //娣诲姞涓�涓棿闅旈棿璺�
+            var frameSpace = new FrameLayout();
+            frameSpace.Width = Application.GetRealWidth(58);
+            this.AddChidren(frameSpace);
+
+            //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�)
+            var frameBack = new FrameLayoutStatuControl();
+            frameBack.UseClickStatu = false;
+            frameBack.Width = realWidth;
+            this.AddChidren(frameBack);
+            //鍚嶇О
+            var btnName = new NormalViewControl(frameBack.Width, Application.GetRealHeight(63), false);
+            btnName.Text = titleText;
+            btnName.TextAlignment = TextAlignment.Center;
+            if (m_nowSelectIndex == i_index)
+            {
+                this.frameDefult = frameBack;
+                //閫夋嫨鐘舵��
+                btnName.TextSize = 16;
+                btnName.IsBold = true;
+                btnName.TextColor = UserCenterColor.Current.TextColor2;
+            }
+            else
+            {
+                btnName.TextColor = UserCenterColor.Current.TextGrayColor3;
+            }
+            frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent);
+            //娣诲姞缂撳瓨
+            this.listNameControl.Add(btnName);
+
+            //搴曠嚎
+            var btnLine = new NormalViewControl(40, 10, true);
+            btnLine.Y = btnName.Bottom + Application.GetRealHeight(6);
+            btnLine.X = btnName.X + btnName.Width / 2 - Application.GetRealWidth(40) / 2;
+            btnLine.Radius = (uint)Application.GetRealHeight(10) / 2;
+            btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
+            frameBack.AddChidren(btnLine, ChidrenBindMode.BindEvent);
+            if (m_nowSelectIndex != i_index)
+            {
+                btnLine.Visible = false;
+            }
+            //娣诲姞缂撳瓨
+            this.listLineControl.Add(btnLine);
+
+            frameBack.ButtonClickEvent += (sender, e) =>
+            {
+                //閫夋嫨鐨勬槸鍚屼竴涓垎鏀�,鍒欐棤鏁�
+                if (this.m_nowSelectIndex == i_index && e != null)
+                {
+                    //鎵嬪姩鐐瑰嚮鐨勬墠澶勭悊
+                    return;
+                }
+                this.OldSelectIndex = this.m_nowSelectIndex;
+                this.m_nowSelectIndex = i_index;
+                //褰撳墠鏂囧瓧鍙樿壊
+                btnName.TextSize = 16;
+                btnName.TextColor = UserCenterColor.Current.TextColor2;
+                btnName.IsBold = true;
+                btnLine.Visible = true;
+
+                //杩樺師鍏朵粬鐨勯鑹�
+                for (int i = 0; i < listNameControl.Count; i++)
+                {
+                    if (this.m_nowSelectIndex != i)
+                    {
+                        listNameControl[i].TextSize = 14;
+                        listNameControl[i].IsBold = false;
+                        listNameControl[i].TextColor = UserCenterColor.Current.TextGrayColor3;
+
+                        listLineControl[i].Visible = false;
+                    }
+                }
+                this.SelectTabEvent?.Invoke(i_index);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鎺т欢鎽ф瘉___________________________
+
+        /// <summary>
+        /// 鎺т欢鎽ф瘉
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            this.SelectTabEvent = null;
+            if (this.Parent != null)
+            {
+                base.RemoveFromParent();
+            }
+        }
+
+        /// <summary>
+        /// 鈽嗏槅绉婚櫎鍏ㄩ儴鎺т欢鈽嗏槅
+        /// </summary>
+        public override void RemoveAll()
+        {
+            if (this.Parent != null)
+            {
+                base.RemoveAll();
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 璁剧疆鍒濆閫夋嫨
+        /// </summary>
+        /// <param name="index">浠�0寮�濮�</param>
+        public void SetDefultIndex(int index)
+        {
+            if (frameDefult != null && frameDefult.Parent != null)
+            {
+                if (index < this.listNameControl.Count)
+                {
+                    this.ScrollToViewIndex(index * 2 + 1);
+                    //璋冪敤鐐瑰嚮浜嬩欢
+                    this.listNameControl[index].ButtonClickEvent(null, null);
+                }
+                return;
+            }
+            this.m_nowSelectIndex = index;
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0