From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 07 五月 2020 10:40:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm
---
ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs | 439 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 439 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs
new file mode 100755
index 0000000..d0417ce
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs
@@ -0,0 +1,439 @@
+锘縰sing Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Shared.Phone
+{
+ /// <summary>
+ /// 涓汉涓績鐨勫叡閫氬熀灞傜敾闈紝缁ф壙浜庢鍏遍�氱殑鐢婚潰锛岃浣跨敤AddForm()鍑芥暟锛�
+ /// 鎴栬�匒ddFromAndRemoveNowForm()鍑芥暟瀹炵幇娣诲姞鐢婚潰锛岀劧鍚庡湪鍚勮嚜鐨勭敾闈腑锛�
+ /// 瀹炵幇涓�涓猄howForm()鐨勫嚱鏁�(鍙傛暟鐢辨坊鍔犵敾闈㈡椂锛屼娇鐢ㄧ殑鍑芥暟鐨勫弬鏁版寚瀹�)
+ /// </summary>
+ public class EditorCommonForm : CommonFormBase
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 杩斿洖鎸夐敭鐨勭偣鍑讳簨浠�(濡傛灉瀹炵幇姝や簨浠�,鍒欏簳灞傜殑浜嬩欢灏嗕笉浼氬啀瑙﹀彂)
+ /// </summary>
+ public Action<BackViewControl> BackButtonClickEvent = null;
+ /// <summary>
+ /// TopMenuFrameLayout
+ /// </summary>
+ public FrameLayout topMenuFrameLayout = null;
+ /// <summary>
+ /// TopFrameLayout
+ /// </summary>
+ public FrameLayout topFrameLayout = null;
+ /// <summary>
+ /// bodyFrameLayout
+ /// </summary>
+ public FrameLayout bodyFrameLayout = null;
+ /// <summary>
+ /// 宸︽粦浣胯兘
+ /// </summary>
+ private bool m_ScrollEnabled = true;
+ /// <summary>
+ /// 宸︽粦浣胯兘(鐣岄潰鍏抽棴鏃�,搴曞眰浼氳繕鍘�,鏃犻渶鍐嶅鐞�)
+ /// </summary>
+ public bool ScrollEnabled
+ {
+ get { return m_ScrollEnabled; }
+ set
+ {
+ if (UserView.HomePage.Instance.ScrollEnabled != value)
+ {
+ UserView.HomePage.Instance.ScrollEnabled = value;
+ this.m_ScrollEnabled = value;
+ }
+ }
+ }
+ /// <summary>
+ /// 缂撳瓨鍚姩鍙傛暟
+ /// </summary>
+ private object[] m_parameter = null;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鍒濆鍖栫晫闈㈡鏋�
+ /// </summary>
+ public override void InitForm()
+ {
+ base.InitForm();
+
+ //鍒濆鍖栧ご閮ㄦ帶浠�
+ this.InitTopFrameLayout();
+
+ //鍒濆鍖栦腑閮ㄦ帶浠�
+ this.InitBodyFrameLayout();
+
+ //鍒濆宸︽粦浣胯兘鍙�
+ this.ScrollEnabled = true;
+ }
+
+ /// <summary>
+ /// 鎵цShowForm()鏂规硶
+ /// </summary>
+ /// <param name="parameter">鍚姩鍙傛暟</param>
+ public override void LoadShowFormMethod(params object[] parameter)
+ {
+ this.m_parameter = parameter;
+ base.LoadShowFormMethod(parameter);
+ }
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖栫晫闈________________________
+
+ #region 鈻� Top________________________________
+
+ /// <summary>
+ /// 鍒濆鍖栧ご閮ㄦ帶浠�
+ /// </summary>
+ public void InitTopFrameLayout()
+ {
+ if (topFrameLayout != null)
+ {
+ topFrameLayout.RemoveAll();
+ }
+
+ //TopMenuFrameLayout鍋氭垚
+ topMenuFrameLayout = new FrameLayout();
+ topMenuFrameLayout.Height = ControlCommonResourse.TopMenuFrameHeight;
+ topMenuFrameLayout.BackgroundColor = UserCenterColor.Current.TopFrameLayout;
+ topMenuFrameLayout.Name = "topMenuFrameLayout";
+ this.AddChidren(topMenuFrameLayout);
+
+ //TopFrameLayout鍋氭垚
+ topFrameLayout = new FrameLayout();
+ topFrameLayout.Height = ControlCommonResourse.TopFrameHeight;
+ topFrameLayout.BackgroundColor = UserCenterColor.Current.TopFrameLayout;
+ topFrameLayout.Y = topMenuFrameLayout.Bottom;
+ topFrameLayout.Name = "topFrameLayout";
+ this.AddChidren(topFrameLayout);
+
+ //绾�
+ var btnLine = new NormalViewControl(topFrameLayout.Width, 1, false);
+ btnLine.BackgroundColor = 0x40000000;
+ btnLine.Y = topFrameLayout.Height - 1;
+ topFrameLayout.AddChidren(btnLine);
+
+ //杩斿洖閿�
+ var btnBack = new BackViewControl();
+ topFrameLayout.AddChidren(btnBack);
+ btnBack.InitControl();
+ btnBack.ButtonClickEvent += (sender, e) =>
+ {
+ if (this.BackButtonClickEvent != null)
+ {
+ //濡傛灉瀹炵幇姝や簨浠�,鍒欏簳灞傜殑浜嬩欢灏嗕笉浼氬啀瑙﹀彂
+ BackButtonClickEvent(btnBack);
+ return;
+ }
+ //鐢婚潰鍏抽棴
+ this.CloseForm();
+ };
+ topFrameLayout.AddTag("btnBack", btnBack);
+
+ //鏍囬
+ var txttitle = new Button();
+ txttitle.Name = "txtTitle";
+ txttitle.TextSize = 17;
+ txttitle.X = Application.GetRealWidth(161);
+ txttitle.Height = Application.GetRealHeight(75);
+ txttitle.Width = Application.GetRealWidth(850);
+ txttitle.Gravity = Gravity.CenterVertical;
+ txttitle.TextColor = UserCenterColor.Current.TopLayoutTitleText;
+ txttitle.TextAlignment = TextAlignment.CenterLeft;
+ txttitle.IsBold = true;
+ topFrameLayout.AddChidren(txttitle);
+
+ topFrameLayout.AddTag("txtTitle", txttitle);
+ }
+
+ #endregion
+
+ #region 鈻� Middle_____________________________
+
+ /// <summary>
+ /// 鍒濆鍖栦腑閮ㄦ帶浠�
+ /// </summary>
+ public void InitBodyFrameLayout()
+ {
+ if (bodyFrameLayout != null)
+ {
+ bodyFrameLayout.RemoveAll();
+ }
+ bodyFrameLayout = new FrameLayout();
+ bodyFrameLayout.Height = ControlCommonResourse.BodyFrameHeight;
+ bodyFrameLayout.Y = topFrameLayout.Bottom;
+ bodyFrameLayout.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
+ bodyFrameLayout.Name = "bodyFrameLayout";
+ this.AddChidren(bodyFrameLayout);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region 鈻� 娣诲姞鐣岄潰___________________________
+
+ /// <summary>
+ /// 娣诲姞鐢婚潰,鍚姩鍙傛暟鐢辨寚瀹氱敾闈㈢殑ShowForm鍑芥暟鎵�鎸囧畾
+ /// </summary>
+ /// <param name="parameter">鍚姩鍙傛暟锛氬弬鏁扮敱鎸囧畾鐢婚潰鐨凷howForm鍑芥暟鎵�鎸囧畾</param>
+ public override void AddForm(params object[] parameter)
+ {
+ base.AddForm(parameter);
+
+ //妫�娴嬭兘鍚﹁拷鍔犵敾闈�
+ if (UserCenterLogic.CheckCanAddForm(this) == false)
+ {
+ return;
+ }
+
+ UserView.HomePage.Instance.AddChidren(this);
+ UserView.HomePage.Instance.PageIndex += 1;
+
+ //鍒濆鍖栫晫闈㈡鏋�
+ this.InitForm();
+
+ //鎵цShowForm()鏂规硶
+ this.LoadShowFormMethod(parameter);
+ }
+
+ #endregion
+
+ #region 鈻� 鍏抽棴鐣岄潰___________________________
+
+ /// <summary>
+ /// 鐢婚潰鍏抽棴
+ /// </summary>
+ public override void CloseFormBefore()
+ {
+ base.CloseFormBefore();
+
+ //宸︽粦浣胯兘
+ this.ScrollEnabled = true;
+
+ this.BackButtonClickEvent = null;
+
+ this.m_parameter = null;
+ //娓呯┖bodyFrame
+ this.ClearBodyFrame();
+ }
+
+ #endregion
+
+ #region 鈻� 鏄剧ず閲嶆柊鍔犺浇_______________________
+
+ /// <summary>
+ /// 鏄剧ず閲嶆柊鍔犺浇鐨勭晫闈�(涓昏鏄敤鍦ㄧ晫闈㈠姞杞介敊璇椂锛屽啀娆″姞杞�)
+ /// </summary>
+ public override void ShowReLoadView()
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (bodyFrameLayout == null || bodyFrameLayout.Parent == null)
+ {
+ return;
+ }
+ //鍒囨崲涓洪噸鏂板姞杞芥ā寮忔椂鐨勪簨浠�
+ this.ReLoadModelEventMethod();
+
+ var frame = new FrameLayout();
+ frame.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(frame);
+
+ //閲嶆柊鍔犺浇
+ var btnReLoad = new BottomClickButton();
+ btnReLoad.Gravity = Gravity.Center;
+ btnReLoad.TextID = R.MyInternationalizationString.uDoReload;
+ frame.AddChidren(btnReLoad);
+ btnReLoad.ButtonClickEvent += (sender, e) =>
+ {
+ //娓呴櫎鍏ㄩ儴鎺т欢
+ this.ClearBodyFrame();
+
+ //鎵цShowForm()鏂规硶瀹炵幇閲嶆柊鍔犺浇
+ this.LoadShowFormMethod(this.m_parameter);
+ };
+
+ //娓呴櫎topFrameLayout鐨勯潪榛樿鐨勬帶浠�
+ var list = new List<View>();
+ for (int i = 0; i < topFrameLayout.ChildrenCount; i++)
+ {
+ var view = topFrameLayout.GetChildren(i);
+ if (view.Name == "btnBack" || view.Name == "txtTitle")
+ {
+ //杩欓噷鏄粯璁ょ殑搴曞眰鎺т欢
+ continue;
+ }
+ list.Add(view);
+ }
+ foreach (var view in list)
+ {
+ view?.RemoveFromParent();
+ }
+ });
+ }
+
+ /// <summary>
+ /// 鍒囨崲涓恒�愰噸鏂板姞杞芥ā寮忋�戞椂鐨勪簨浠跺嚱鏁�,鏃ㄥ湪鍏抽棴鎵�鏈夌嚎绋嬩俊鎭�
+ /// </summary>
+ public virtual void ReLoadModelEventMethod()
+ {
+ }
+
+ #endregion
+
+ #region 鈻� 娣诲姞甯姪鎺т欢_______________________
+
+ /// <summary>
+ /// 娣诲姞鏌ョ湅甯姪鎺т欢
+ /// </summary>
+ /// <returns></returns>
+ public NormalViewControl AddHelpControl()
+ {
+ //鏌ョ湅甯姪
+ var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false);
+ btnHelp.Y = Application.GetRealHeight(1388);
+ btnHelp.TextSize = 12;
+ btnHelp.TextAlignment = TextAlignment.Center;
+ btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor;
+ btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp);
+ bodyFrameLayout.AddChidren(btnHelp);
+ //搴曠嚎
+ int lineWidth = btnHelp.GetRealWidthByText();
+ var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
+ btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
+ btnLine.Gravity = Gravity.CenterHorizontal;
+ btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8);
+ bodyFrameLayout.AddChidren(btnLine);
+
+ return btnHelp;
+ }
+
+ #endregion
+
+ #region 鈻� 鏄剧ず娌℃湁鏁版嵁鐨勫浘鍍忔樉绀虹壒鏁坃________
+
+ /// <summary>
+ /// 鏄剧ず娌℃湁鏁版嵁鐨勫浘鍍忔樉绀虹壒鏁�
+ /// </summary>
+ /// <param name="frameTable">瀹瑰櫒</param>
+ /// <param name="i_Text">鏄剧ず鏂囧瓧</param>
+ /// <param name="Imagepath">鍥惧儚鍦板潃</param>
+ /// <param name="imageWith">鍥惧儚瀹藉害(闈炵湡瀹炲��)</param>
+ /// <param name="imageHeight">鍥惧儚楂樺害(闈炵湡瀹炲��)</param>
+ public void ShowNotDataImage(FrameLayout frameTable, string i_Text, string Imagepath = "Item/NoFunction.png", int imageWith = 683, int imageHeight = 392)
+ {
+ this.ShowNotDataImage(frameTable, new string[] { i_Text }, Imagepath, imageWith, imageHeight);
+ }
+
+ /// <summary>
+ /// 鏄剧ず娌℃湁鏁版嵁鐨勫浘鍍忔樉绀虹壒鏁�
+ /// </summary>
+ /// <param name="frameTable">瀹瑰櫒</param>
+ /// <param name="listText">鏄剧ず鏂囧瓧</param>
+ /// <param name="Imagepath">鍥惧儚鍦板潃</param>
+ /// <param name="imageWith">鍥惧儚瀹藉害(闈炵湡瀹炲��)</param>
+ /// <param name="imageHeight">鍥惧儚楂樺害(闈炵湡瀹炲��)</param>
+ public void ShowNotDataImage(FrameLayout frameTable, string[] listText, string Imagepath = "Item/NoFunction.png", int imageWith = 683, int imageHeight = 392)
+ {
+ var btnPic = new PicViewControl(imageWith, imageHeight);
+ btnPic.UnSelectedImagePath = Imagepath;
+ btnPic.Y = (int)(frameTable.Height * 0.382) - Application.GetRealHeight(imageHeight / 2);
+ btnPic.Gravity = Gravity.CenterHorizontal;
+ frameTable.AddChidren(btnPic);
+
+ int yy = btnPic.Bottom + Application.GetRealHeight(32);
+ for (int i = 0; i < listText.Length; i++)
+ {
+ var btnView = new NormalViewControl(frameTable.Width, Application.GetRealHeight(50), false);
+ btnView.Y = yy;
+ btnView.Text = listText[i];
+ btnView.TextAlignment = TextAlignment.Center;
+ btnView.TextSize = 12;
+ btnView.TextColor = UserCenterColor.Current.TextGrayColor1;
+ frameTable.AddChidren(btnView);
+
+ yy = btnView.Bottom;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________
+
+ /// <summary>
+ /// <para>鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�</para>
+ /// <para>閲嶅啓鐨勬椂鍊欒繑鍥炲�艰杩斿洖1(杩斿洖鍊兼槸缁欏簳灞備娇鐢ㄧ殑)</para>
+ /// </summary>
+ public virtual int FormActionAgainEvent()
+ {
+ return -1;
+ }
+
+ #endregion
+
+ #region 鈻� 娓呯┖BodyFrame______________________
+
+ /// <summary>
+ /// 娓呯┖BodyFrame
+ /// </summary>
+ public void ClearBodyFrame()
+ {
+ if (this.Parent == null)
+ {
+ return;
+ }
+ if (bodyFrameLayout == null || bodyFrameLayout.Parent == null)
+ {
+ return;
+ }
+ bodyFrameLayout.RemoveAll();
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸殑鏂规硶_________________________
+
+ /// <summary>
+ /// 璁剧疆鏍囬淇℃伅
+ /// </summary>
+ /// <param name="title">Title.</param>
+ public void SetTitleText(string title)
+ {
+ //璁剧疆澶撮儴淇℃伅
+ var btntitle = (Button)topFrameLayout.GetTagByKey("txtTitle");
+ btntitle.Text = title;
+ }
+
+ /// <summary>
+ /// 绉婚櫎杩斿洖閿�
+ /// </summary>
+ public void RemoveBackButton()
+ {
+ //绉婚櫎杩斿洖閿�
+ var back = (BackViewControl)topFrameLayout.GetTagByKey("btnBack");
+ back?.RemoveFromParent();
+ }
+
+ /// <summary>
+ /// 鑾峰彇杩斿洖閿�
+ /// </summary>
+ public BackViewControl GetBackButton()
+ {
+ //绉婚櫎杩斿洖閿�
+ var back = (BackViewControl)topFrameLayout.GetTagByKey("btnBack");
+ return back;
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0