From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 21 七月 2020 09:46:53 +0800 Subject: [PATCH] 请合并最新多功能面板代码 --- ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectLightForm.cs | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 311 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectLightForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectLightForm.cs new file mode 100755 index 0000000..996445d --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AlarmTargetStatuSelectLightForm.cs @@ -0,0 +1,311 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.Safety +{ + /// <summary> + /// 鐏厜绫荤殑瀹夐槻鎶ヨ璁剧疆鐣岄潰 + /// </summary> + public class AlarmTargetStatuSelectLightForm : DialogCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 缁撴潫閫夋嫨鐨勪簨浠�(key:鍏ㄩ儴鐘舵�佺殑缈昏瘧鏂囨湰) + /// </summary> + public Action<string, List<Safeguard.TaskListInfo>> FinishSelectEvent = null; + /// <summary> + /// 鍔ㄤ綔淇℃伅 1 寮�鍏�/ 3浜害璋冭妭 + /// </summary> + private Dictionary<int, Safeguard.TaskListInfo> dicTaskinfo = new Dictionary<int, Safeguard.TaskListInfo>(); + /// <summary> + /// 杩涘害鏉℃渶澶у�� + /// </summary> + private int MaxValue = 254; + + #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 || data.TaskType == 3) + { + dicTaskinfo[data.TaskType] = 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(1169); + frameTransparent.Height = Application.GetRealHeight(900);//楂樺害灏辨槸瑕佸畠瓒呰繃锛岄殢渚挎悶鐨� + 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); + if (dicTaskinfo.ContainsKey(3) == true) + { + btnPersent.Text = ((int)(dicTaskinfo[3].Data1 * 1.0 / MaxValue * 100)) + "%"; + } + + //杩涘害鏉� + var seekBar = new SeekBarControl(919); + seekBar.Y = Application.GetRealHeight(268); + seekBar.ProgressBarColor = 0xfffdb500; + seekBar.MaxValue = this.MaxValue; + seekBar.Enable = false; + if (dicTaskinfo.ContainsKey(3) == true) + { + //3:浜害璋冭妭 + seekBar.Progress = dicTaskinfo[3].Data1; + } + detailBackFrame.AddChidren(seekBar); + seekBar.ProgressChangedEvent += (div, value) => + { + btnPersent.Text = ((int)(value * 1.0 / MaxValue * 100)) + "%"; + }; + + //绾� + var btnLine2 = new NormalViewControl(Application.GetRealWidth(919), ControlCommonResourse.BottomLineHeight, false); + btnLine2.Y = Application.GetRealHeight(417); + btnLine2.Gravity = Gravity.CenterHorizontal; + btnLine2.BackgroundColor = UserCenterColor.Current.ButtomLine; + detailBackFrame.AddChidren(btnLine2); + + //寮� + 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; + + //鍏� + var rowClose = new FrameRowControl(); + rowClose.Y = btnLine2.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; + seekBar.Enable = false; + + dicTaskinfo.Remove(1); + } + else + { + //閫夋嫨鍥炬爣鍒囨崲 + btnOpenSelect.Visible = true; + btnCloseSelect.Visible = false; + + //寮� 鍙敤 + btnOpen.TextColor = UserCenterColor.Current.TextColor1; + seekBar.Enable = true; + if (seekBar.Progress == 0) + { + seekBar.Progress = MaxValue; + btnPersent.Text = "100%"; + } + + //鍏� 涓嶅彲鐢� + btnClose.TextColor = UserCenterColor.Current.TextGrayColor3; + + 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(1); + } + else + { + //閫夋嫨鍥炬爣鍒囨崲 + btnCloseSelect.Visible = true; + btnOpenSelect.Visible = false; + + //鍏� 鍙敤 + btnClose.TextColor = UserCenterColor.Current.TextColor1; + + //寮� 涓嶅彲鐢� + btnOpen.TextColor = UserCenterColor.Current.TextGrayColor3; + seekBar.Enable = false; + + dicTaskinfo[1] = new Safeguard.TaskListInfo(); + dicTaskinfo[1].TaskType = 1; + dicTaskinfo[1].Data1 = 0; + } + }; + + //璁剧疆寮�鐨勯粯璁ゅ�� + if (dicTaskinfo.ContainsKey(1) == true && dicTaskinfo[1].Data1 == 1) + { + rowOpen.ButtonClickEvent?.Invoke(null, null); + } + //璁剧疆鍏崇殑榛樿鍊� + if (dicTaskinfo.ContainsKey(1) == true && dicTaskinfo[1].Data1 == 0) + { + rowClose.ButtonClickEvent?.Invoke(null, null); + } + + //瀹屾垚浜嬩欢 + btnFinish.ButtonClickEvent += (sender, e) => + { + if (btnOpenSelect.Visible == false || seekBar.Progress == 0) + { + //绉婚櫎鐧惧垎姣� + dicTaskinfo.Remove(3); + } + else + { + //鐧惧垎姣旇皟鑺� + dicTaskinfo[3] = new Safeguard.TaskListInfo(); + dicTaskinfo[3].TaskType = 3; + dicTaskinfo[3].Data1 = seekBar.Progress; + } + + 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?.Invoke(statuText, listData); + + this.CloseForm(); + }; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + this.FinishSelectEvent = null; + base.CloseFormBefore(); + } + + #endregion + } +} -- Gitblit v1.8.0