From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码
---
ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectSwitchForm.cs | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 265 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectSwitchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectSwitchForm.cs
new file mode 100755
index 0000000..afbb668
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectSwitchForm.cs
@@ -0,0 +1,265 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.Safety
+{
+ /// <summary>
+ /// 寮�鍏崇被鐨勫畨闃叉姤璀﹁缃晫闈�
+ /// </summary>
+ public class AlarmTargetStatuSelectSwitchForm : DialogCommonForm
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 缁撴潫閫夋嫨鐨勪簨浠�(key:鍏ㄩ儴鐘舵�佺殑缈昏瘧鏂囨湰)
+ /// </summary>
+ public Action<string, List<Safeguard.TaskListInfo>> FinishSelectEvent = null;
+ /// <summary>
+ /// 鍔ㄤ綔淇℃伅 0鍏抽棴/ 1鎵撳紑
+ /// </summary>
+ private Dictionary<int, Safeguard.TaskListInfo> dicTaskinfo = new Dictionary<int, Safeguard.TaskListInfo>();
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+ /// </summary>
+ /// <param name="device"></param>
+ /// <param name="i_listTaskInfo"></param>
+ public void ShowForm(CommonDevice device, List<Safeguard.TaskListInfo> i_listTaskInfo)
+ {
+ if (i_listTaskInfo != null)
+ {
+ foreach (var data in i_listTaskInfo)
+ {
+ //浠ラ槻涓囦竴,鍓旈櫎涓嶅悎娉曟暟鎹�
+ if (data.TaskType == 1)
+ {
+ dicTaskinfo[data.Data1] = data;
+ }
+ }
+ }
+
+ //鍒濆鍖栦腑閮ㄤ俊鎭�
+ this.InitMiddleFrame(device);
+ }
+
+ /// <summary>
+ /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+ /// </summary>
+ private void InitMiddleFrame(CommonDevice device)
+ {
+ //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾)
+ int halfRoundHeigth = Application.GetRealHeight(116) / 2;
+
+ //鎼炰竴涓�忔槑鐨勬
+ var frameTransparent = new FrameLayout();
+ frameTransparent.Y = Application.GetRealHeight(1391);
+ frameTransparent.Height = Application.GetRealHeight(600);//楂樺害灏辨槸瑕佸畠瓒呰繃锛岄殢渚挎悶鐨�
+ frameTransparent.BackgroundColor = UserCenterColor.Current.Transparent;
+ bodyFrameLayout.AddChidren(frameTransparent);
+
+ //鐬庢悶鐨勪竴涓櫧妗�,鐢ㄦ潵鎸′綇澶撮儴鍗婂姬搴�
+ var frameBack = new FrameLayout();
+ frameBack.Y = halfRoundHeigth;
+ frameBack.BackgroundColor = UserCenterColor.Current.White;
+ frameBack.Height = Application.GetRealHeight(300);
+ frameTransparent.AddChidren(frameBack);
+
+ //寮у害鐨勫渾
+ var rowRound = new FrameLayout();
+ rowRound.Width = bodyFrameLayout.Width;
+ rowRound.Height = halfRoundHeigth * 2;
+ rowRound.BackgroundColor = UserCenterColor.Current.White;
+ rowRound.Radius = (uint)halfRoundHeigth;
+ frameTransparent.AddChidren(rowRound);
+
+ //澶撮儴淇℃伅
+ var btnTitle = new NormalViewControl(frameTransparent.Width, Application.GetRealHeight(70), false);
+ btnTitle.Y = Application.GetRealHeight(28);
+ btnTitle.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
+ btnTitle.TextColor = UserCenterColor.Current.TextColor4;
+ btnTitle.TextSize = 16;
+ btnTitle.TextAlignment = TextAlignment.Center;
+ rowRound.AddChidren(btnTitle);
+
+ //鍙栨秷
+ var btnCancel = new NormalViewControl(200, 60, true);
+ btnCancel.X = Application.GetRealWidth(81);
+ btnCancel.Y = Application.GetRealHeight(38);
+ btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1;
+ btnCancel.TextID = R.MyInternationalizationString.uCancel;
+ rowRound.AddChidren(btnCancel);
+ btnCancel.ButtonClickEvent += (sender, e) =>
+ {
+ this.CloseForm();
+ };
+
+ //瀹屾垚
+ var btnFinish = new NormalViewControl(200, 60, true);
+ btnFinish.X = Application.GetRealWidth(800);
+ btnFinish.Y = Application.GetRealHeight(38);
+ btnFinish.TextAlignment = TextAlignment.CenterRight;
+ btnFinish.TextColor = 0xfffb744a;
+ btnFinish.TextID = R.MyInternationalizationString.uFinish;
+ rowRound.AddChidren(btnFinish);
+
+ //绾�
+ var btnLine1 = new NormalViewControl(frameTransparent.Width, ControlCommonResourse.BottomLineHeight, false);
+ btnLine1.Y = Application.GetRealHeight(138);
+ btnLine1.BackgroundColor = UserCenterColor.Current.ButtomLine;
+ frameTransparent.AddChidren(btnLine1);
+
+ //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙
+ var detailBackFrame = new FrameLayout();
+ detailBackFrame.Y = btnLine1.Bottom;
+ detailBackFrame.Height = Application.GetRealHeight(700);//闅忎究瀹氱殑
+ detailBackFrame.BackgroundColor = UserCenterColor.Current.White;
+ frameTransparent.AddChidren(detailBackFrame);
+
+ //鐧惧垎姣�
+ var btnPersent = new NormalViewControl(150, 50, true);
+ btnPersent.Y = Application.GetRealHeight(196);
+ btnPersent.Gravity = Gravity.CenterHorizontal;
+ btnPersent.TextAlignment = TextAlignment.Center;
+ btnPersent.TextColor = UserCenterColor.Current.TextGrayColor2;
+ btnPersent.TextSize = 12;
+ detailBackFrame.AddChidren(btnPersent);
+
+ //寮�
+ var rowOpen = new FrameRowControl();
+ rowOpen.Y = Application.GetRealHeight(69);
+ rowOpen.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
+ rowOpen.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);
+ detailBackFrame.AddChidren(rowOpen);
+ var btnOpen = rowOpen.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSimpleOpen), 400);
+ btnOpen.TextColor = UserCenterColor.Current.TextGrayColor3;
+ var btnOpenSelect = rowOpen.AddMostRightEmptyIcon(58, 58);
+ btnOpenSelect.UnSelectedImagePath = "Item/ItemSelected.png";
+ btnOpenSelect.Visible = false;
+ //搴曠嚎
+ rowOpen.AddBottomLine();
+
+ //鍏�
+ var rowClose = new FrameRowControl();
+ rowClose.Y = rowOpen.Bottom + Application.GetRealHeight(12);
+ rowClose.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
+ rowClose.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);
+ detailBackFrame.AddChidren(rowClose);
+ var btnClose = rowClose.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSimpleClose), 400);
+ btnClose.TextColor = UserCenterColor.Current.TextGrayColor3;
+ var btnCloseSelect = rowClose.AddMostRightEmptyIcon(58, 58);
+ btnCloseSelect.UnSelectedImagePath = "Item/ItemSelected.png";
+ btnCloseSelect.Visible = false;
+
+ //鐐瑰嚮寮�
+ rowOpen.ButtonClickEvent += (sender, e) =>
+ {
+ if (btnOpenSelect.Visible == true)
+ {
+ //鍙栨秷,寮� 涓嶅彲鐢�
+ btnOpenSelect.Visible = false;
+ btnOpen.TextColor = UserCenterColor.Current.TextGrayColor3;
+
+ dicTaskinfo.Remove(1);
+ }
+ else
+ {
+ //閫夋嫨鍥炬爣鍒囨崲
+ btnOpenSelect.Visible = true;
+ btnCloseSelect.Visible = false;
+
+ //寮� 鍙敤
+ btnOpen.TextColor = UserCenterColor.Current.TextColor1;
+ //鍏� 涓嶅彲鐢�
+ btnClose.TextColor = UserCenterColor.Current.TextGrayColor3;
+
+ //绉婚櫎鍏抽棴
+ dicTaskinfo.Remove(0);
+
+ dicTaskinfo[1] = new Safeguard.TaskListInfo();
+ dicTaskinfo[1].TaskType = 1;
+ dicTaskinfo[1].Data1 = 1;
+ }
+ };
+ //鐐瑰嚮鍏�
+ rowClose.ButtonClickEvent += (sender, e) =>
+ {
+ if (btnCloseSelect.Visible == true)
+ {
+ //鍙栨秷,鍏� 涓嶅彲鐢�
+ btnCloseSelect.Visible = false;
+ btnClose.TextColor = UserCenterColor.Current.TextGrayColor3;
+
+ dicTaskinfo.Remove(0);
+ }
+ else
+ {
+ //閫夋嫨鍥炬爣鍒囨崲
+ btnCloseSelect.Visible = true;
+ btnOpenSelect.Visible = false;
+
+ //鍏� 鍙敤
+ btnClose.TextColor = UserCenterColor.Current.TextColor1;
+
+ //寮� 涓嶅彲鐢�
+ btnOpen.TextColor = UserCenterColor.Current.TextGrayColor3;
+
+ //绉婚櫎鎵撳紑
+ dicTaskinfo.Remove(1);
+
+ dicTaskinfo[0] = new Safeguard.TaskListInfo();
+ dicTaskinfo[0].TaskType = 1;
+ dicTaskinfo[0].Data1 = 0;
+ }
+ };
+
+ //璁剧疆寮�鐨勯粯璁ゅ��
+ if (dicTaskinfo.ContainsKey(1) == true)
+ {
+ rowOpen.ButtonClickEvent?.Invoke(null, null);
+ }
+ //璁剧疆鍏崇殑榛樿鍊�
+ if (dicTaskinfo.ContainsKey(0) == true)
+ {
+ rowClose.ButtonClickEvent?.Invoke(null, null);
+ }
+
+ //瀹屾垚浜嬩欢
+ btnFinish.ButtonClickEvent += (sender, e) =>
+ {
+ var listData = new List<Safeguard.TaskListInfo>();
+ foreach (var data in dicTaskinfo.Values)
+ {
+ listData.Add(data);
+ }
+ dicTaskinfo = null;
+
+ //鑾峰彇鐘舵�佺殑鏄剧ず鏂囨湰
+ string statuText = HdlSafeguardLogic.Current.GetAdjustTargetStatuText(listData);
+ this.FinishSelectEvent(statuText, listData);
+
+ this.CloseForm();
+ };
+ }
+
+ #endregion
+
+ #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+ /// <summary>
+ /// 鐣岄潰鍏抽棴
+ /// </summary>
+ public override void CloseFormBefore()
+ {
+ this.FinishSelectEvent = null;
+ base.CloseFormBefore();
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0