From ffdeae1a43e1539f9533f93d64089994db6c742b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 09 六月 2021 17:23:01 +0800 Subject: [PATCH] Merge branch 'tzy2' into wxr6 --- HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockAlwaysOnManagerPage.cs | 535 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 535 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockAlwaysOnManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockAlwaysOnManagerPage.cs new file mode 100644 index 0000000..3db55fd --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockAlwaysOnManagerPage.cs @@ -0,0 +1,535 @@ +锘縰sing Shared; +using HDL_ON.UI.CSS; +using HDL_ON.Stan; +using System; +using System.Collections.Generic; +using System.Text; +using HDL_ON.Entity; + +namespace HDL_ON.UI +{ + /// <summary> + /// 闂ㄩ攣甯稿紑鑷姩鍖栫紪杈戠晫闈� + /// </summary> + public class DoorLockAlwaysOnManagerPage : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 甯稿紑鑷姩鍖栦俊鎭� + /// </summary> + private AlwayOnAutomationInfo automationInfo = null; + /// <summary> + /// 涓�浜涙枃鏈� + /// </summary> + private Dictionary<string, string> dicText = new Dictionary<string, string>(); + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm(AlwayOnAutomationInfo info) + { + this.automationInfo = info; + if (info == null) + { + this.automationInfo = new AlwayOnAutomationInfo(); + //鏂板缓鑷姩鍖� + base.SetTitleText(Language.StringByID(StringId.newAutomation)); + } + else + { + //缂栬緫鑷姩鍖� + base.SetTitleText(Language.StringByID(StringId.editAutomation)); + } + + this.dicText["鍛�1"] = Language.StringByID(StringId.monday); + this.dicText["鍛�2"] = Language.StringByID(StringId.tuesday); + this.dicText["鍛�3"] = Language.StringByID(StringId.wednesday); + this.dicText["鍛�4"] = Language.StringByID(StringId.thursday); + this.dicText["鍛�5"] = Language.StringByID(StringId.friday); + this.dicText["鍛�6"] = Language.StringByID(StringId.saturday); + this.dicText["鍛�7"] = Language.StringByID(StringId.sunday); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍒濆鍖栨潯浠舵帶浠� + this.InitConditionControl(); + //鍒濆鍖栫洰鏍囨帶浠� + this.InitTargetControl(); + //鍒濆鍖栧惊鐜柟寮忔帶浠� + this.InitLoopControl(); + + //纭鎸夐挳 + var btnSave = this.AddBottomClickButton(Language.StringByID(StringId.Confirm)); + btnSave.ButtonClickEvent += (sender, e) => + { + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栨潯浠舵帶浠禵____________________ + + /// <summary> + /// 鍒濆鍖栨潯浠舵帶浠� + /// </summary> + private void InitConditionControl() + { + //濡傛灉 + var btnIf = new NormalViewControl(300, 22, true); + btnIf.X = HdlControlResourse.XXLeft; + btnIf.Y = Application.GetRealHeight(12); + btnIf.TextID = StringId.ifCondition; + btnIf.TextSize = CSS_FontSize.SubheadingFontSize; + btnIf.TextColor = CSS_Color.FirstLevelTitleColor; + btnIf.IsBold = true; + bodyFrameLayout.AddChidren(btnIf); + + //鐧借壊鑳屾櫙瀹瑰櫒 + var frameBack = new FrameLayout(); + frameBack.Y = btnIf.Bottom + Application.GetRealHeight(12); + frameBack.Width = Application.GetRealWidth(343); + frameBack.Height = Application.GetRealHeight(88); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; + frameBack.Radius = (uint)Application.GetRealWidth(12); + bodyFrameLayout.AddChidren(frameBack); + + //鏉′欢 + var rowConditon = new FrameRowControl(); + rowConditon.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + rowConditon.Width = frameBack.Width; + frameBack.AddChidren(rowConditon); + var btnConditon = rowConditon.AddLeftCaption(Language.StringByID(StringId.Condtion), 300); + btnConditon.TextColor = CSS_Color.FirstLevelTitleColor; + //搴曠嚎 + rowConditon.AddBottomLine(); + + //鏃跺埢 + var rowTime = new FrameRowControl(); + rowTime.Y = rowConditon.Bottom; + rowTime.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + rowTime.Width = frameBack.Width; + frameBack.AddChidren(rowTime); + rowTime.AddLeftIcon(28, "LogicIcon/time.png"); + var btnTime = rowTime.AddLeftCaption(Language.StringByID(StringId.hour), 300); + btnTime.TextColor = CSS_Color.FirstLevelTitleColor; + rowTime.AddRightArrow(); + var btnValue = rowTime.AddMostRightView(this.automationInfo.Hour + ":" + this.automationInfo.Minute.ToString().PadLeft(2, '0'), 80); + rowTime.ButtonClickEvent += (sender, e) => + { + //鏃堕棿閫夋嫨寮圭獥 + var form = new BottomTimeSelectControl(); + form.InitControl(this.automationInfo.Hour, this.automationInfo.Minute); + form.FinishEvent += (div, selectHour, selectMin) => + { + if (div != 1) { return; } + this.automationInfo.Hour = selectHour; + this.automationInfo.Minute = selectMin; + btnValue.Text = this.automationInfo.Hour + ":" + this.automationInfo.Minute.ToString().PadLeft(2, '0'); + }; + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栫洰鏍囨帶浠禵____________________ + + /// <summary> + /// 鍒濆鍖栫洰鏍囨帶浠� + /// </summary> + private void InitTargetControl() + { + //灏辨墽琛� + var btnExecuted = new NormalViewControl(300, 22, true); + btnExecuted.X = HdlControlResourse.XXLeft; + btnExecuted.Y = Application.GetRealHeight(154); + btnExecuted.TextID = StringId.isExecuted; + btnExecuted.TextSize = CSS_FontSize.SubheadingFontSize; + btnExecuted.TextColor = CSS_Color.FirstLevelTitleColor; + btnExecuted.IsBold = true; + bodyFrameLayout.AddChidren(btnExecuted); + + //鐧借壊鑳屾櫙瀹瑰櫒 + var frameBack = new FrameLayout(); + frameBack.Y = btnExecuted.Bottom + Application.GetRealHeight(12); + frameBack.Width = Application.GetRealWidth(343); + frameBack.Height = Application.GetRealHeight(88); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; + frameBack.Radius = (uint)Application.GetRealWidth(12); + bodyFrameLayout.AddChidren(frameBack); + + //鍔ㄤ綔琛屾帶浠� + var rowAction = new FrameRowControl(); + rowAction.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + rowAction.Width = frameBack.Width; + frameBack.AddChidren(rowAction); + //鍔ㄤ綔 + var btnAction = rowAction.AddLeftCaption(Language.StringByID(StringId.Action), 300); + btnAction.TextColor = CSS_Color.FirstLevelTitleColor; + //搴曠嚎 + rowAction.AddBottomLine(); + + //甯稿紑妯″紡琛屾帶浠� + var rowModel = new FrameRowControl(); + rowModel.Y = rowAction.Bottom; + rowModel.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + rowModel.Width = frameBack.Width; + frameBack.AddChidren(rowModel); + //鍥炬爣 + rowModel.AddLeftIcon(28, "FunctionIcon/DoorLock/NormallyOpenIcon2.png"); + //甯稿紑妯″紡 + var btnAlwayOn = rowModel.AddLeftCaption(Language.StringByID(StringId.AlwaysOnModel), 300); + btnAlwayOn.TextColor = CSS_Color.FirstLevelTitleColor; + //鍙崇澶� + rowModel.AddRightArrow(); + //鍊� + var btnValue = rowModel.AddMostRightView(this.automationInfo.IsOpenAlwayOn == true ? + Language.StringByID(StringId.kaiqi) : Language.StringByID(StringId.Close), 80); + + rowModel.ButtonClickEvent += (sender, e) => + { + //閫夋嫨寮圭獥 + var form = new BottomMenuSelectControl(2); + //寮�鍚� + form.AddMenu(Language.StringByID(StringId.kaiqi), () => + { + this.automationInfo.IsOpenAlwayOn = true; + btnValue.Text = Language.StringByID(StringId.kaiqi); + }); + //鍏抽棴 + form.AddMenu(Language.StringByID(StringId.Close), () => + { + this.automationInfo.IsOpenAlwayOn = false; + btnValue.Text = Language.StringByID(StringId.Close); + },CSS_Color.PromptingColor1); + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栧惊鐜柟寮忔帶浠禵________________ + + /// <summary> + /// 鍒濆鍖栧惊鐜柟寮忔帶浠� + /// </summary> + private void InitLoopControl() + { + //寰幆鏂瑰紡 + var btnloop = new NormalViewControl(300, 22, true); + btnloop.X = HdlControlResourse.XXLeft; + btnloop.Y = Application.GetRealHeight(296); + btnloop.TextID = StringId.cyclic; + btnloop.TextSize = CSS_FontSize.SubheadingFontSize; + btnloop.TextColor = CSS_Color.FirstLevelTitleColor; + btnloop.IsBold = true; + bodyFrameLayout.AddChidren(btnloop); + + //鍛ㄦ湡鐨勭櫧鑹茶儗鏅鍣� + var frameDayBack = new FrameLayout(); + frameDayBack.Y = btnloop.Bottom + Application.GetRealHeight(12); + frameDayBack.Width = Application.GetRealWidth(343); + frameDayBack.Height = Application.GetRealHeight(50); + frameDayBack.Gravity = Gravity.CenterHorizontal; + frameDayBack.BackgroundColor = CSS_Color.MainBackgroundColor; + frameDayBack.Radius = (uint)Application.GetRealWidth(12); + bodyFrameLayout.AddChidren(frameDayBack); + + //鍛ㄦ湡琛屾帶浠� + var rowLoop = new FrameRowControl(); + rowLoop.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + rowLoop.Width = frameDayBack.Width; + rowLoop.Height = Application.GetRealHeight(50); + frameDayBack.AddChidren(rowLoop); + //鍛ㄦ湡 + var cycleText = this.GetLoopCondtionText(); + var btnCycle = rowLoop.AddLeftCaption(cycleText, 270); + btnCycle.TextColor = CSS_Color.FirstLevelTitleColor; + btnCycle.IsMoreLines = false;//璁╁畠涓嶆崲琛屼簡,涓嶇劧鏈夌偣闅剧湅 + //鍙崇澶� + rowLoop.AddRightArrow(); + rowLoop.ButtonClickEvent += (sender, e) => + { + //鏄剧ず鍛ㄦ湡寰幆閰嶇疆绐楀彛 + this.ShowLoopMethordSettionDialog(btnCycle); + }; + + //鎺ㄩ�佺殑鐧借壊鑳屾櫙瀹瑰櫒 + var framePushBack = new FrameLayout(); + framePushBack.Y = frameDayBack.Bottom + Application.GetRealHeight(8); + framePushBack.Width = Application.GetRealWidth(343); + framePushBack.Height = Application.GetRealHeight(100); + framePushBack.Gravity = Gravity.CenterHorizontal; + framePushBack.BackgroundColor = CSS_Color.MainBackgroundColor; + framePushBack.Radius = (uint)Application.GetRealWidth(12); + bodyFrameLayout.AddChidren(framePushBack); + + //鎺ㄩ�佽鎺т欢 + var rowPush = new FrameRowControl(); + rowPush.Width = framePushBack.Width; + rowPush.Height = Application.GetRealHeight(50); + rowPush.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + framePushBack.AddChidren(rowPush); + //鎵ц鎺ㄩ�� + var btnPush = rowPush.AddLeftCaption(Language.StringByID(StringId.push), 300); + btnPush.TextColor = CSS_Color.FirstLevelTitleColor; + //搴曠嚎 + rowPush.AddBottomLine(); + //鎺ㄩ�佺殑寮�鍏虫寜閽� + var btnPushSwitch = rowPush.AddMostRightSwitchIcon(); + btnPushSwitch.ButtonClickEvent += (sender, e) => + { + btnPushSwitch.IsSelected = !btnPushSwitch.IsSelected; + }; + + //鍙戦�侀�氱煡琛屾帶浠� + var rowNotice = new FrameRowControl(); + rowNotice.Y = rowPush.Bottom; + rowNotice.Width = framePushBack.Width; + rowNotice.Height = Application.GetRealHeight(50); + rowNotice.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; + framePushBack.AddChidren(rowNotice); + //鍙戦�侀�氱煡 + var btnNotice = rowNotice.AddLeftCaption(Language.StringByID(StringId.notification), 300); + btnNotice.TextColor = CSS_Color.FirstLevelTitleColor; + //鍙崇澶� + rowNotice.AddRightArrow(); + rowNotice.ButtonClickEvent += (sender, e) => + { + var form = new UI2.Intelligence.Automation.InputPushText(); + MainPage.BasePageView.AddChidren(form); + //form.Show(this.automationInfo.PushSettion); + form.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //form.action += (pushInfo) => + //{ + // //璧嬪�� + // this.automationInfo.PushSettion = pushInfo; + //}; + }; + } + + #endregion + + #region 鈻� 鏄剧ず鍛ㄦ湡寰幆閰嶇疆绐楀彛_______________ + + /// <summary> + /// 鏄剧ず鍛ㄦ湡寰幆閰嶇疆绐楀彛 + /// </summary> + private void ShowLoopMethordSettionDialog(NormalViewControl btnCycle) + { + //涔嬪墠閫夋嫨鐨勬帶浠� + NormalViewControl btnOldView = null; + + var form = new BottomItemEditorControl(4, Language.StringByID(StringId.cyclic)); + form.ClickConfirmClose = false; + //鎵ц涓�娆� + form.AddRowMenu(Language.StringByID(StringId.performA), string.Empty, (btnView, btnValue) => + { + this.automationInfo.LoopDiv = 1; + if (btnOldView != null) + { + //杩樺師棰滆壊 + btnOldView.TextColor = CSS_Color.FirstLevelTitleColor; + } + //鍙樻洿棰滆壊 + btnView.TextColor = CSS_Color.textConfirmColor; + btnOldView = btnView; + //鍙樻洿鏄剧ず鏂囨湰 + btnCycle.Text = this.GetLoopCondtionText(); + + }, false); + + //姣忓ぉ + form.AddRowMenu(Language.StringByID(StringId.days), string.Empty, (btnView, btnValue) => + { + this.automationInfo.LoopDiv = 2; + if (btnOldView != null) + { + //杩樺師棰滆壊 + btnOldView.TextColor = CSS_Color.FirstLevelTitleColor; + } + //鍙樻洿棰滆壊 + btnView.TextColor = CSS_Color.textConfirmColor; + btnOldView = btnView; + //鍙樻洿鏄剧ず鏂囨湰 + btnCycle.Text = this.GetLoopCondtionText(); + + }, false); + + //姣忓懆 + form.AddRowMenu(Language.StringByID(StringId.weekly), string.Empty, (btnView, btnValue) => + { + //鍏抽棴寮圭獥,鏄剧ず鍛ㄦ湡寰幆(鏄熸湡)鐨勯厤缃獥鍙� + form.Close(); + this.ShowLoopMethordWeekDialog(btnCycle); + }); + + //姣忔湀 + form.AddRowMenu(Language.StringByID(StringId.monthly), string.Empty, (btnView, btnValue) => + { + //鍏抽棴寮圭獥,鏄剧ず鍛ㄦ湡寰幆(鏈堜唤)鐨勯厤缃獥鍙� + form.Close(); + this.ShowLoopMethordMonthDialog(btnCycle); + }); + + form.FinishEvent += (div) => + { + //褰撶偣鍑讳簡纭鏃�,濡傛灉杩樻病閫夋嫨锛屽垯鏃犲弽搴� + if (div != 1 || btnOldView == null) { return; } + + form.Close(); + }; + } + + /// <summary> + /// 鏄剧ず鍛ㄦ湡寰幆(鏄熸湡)鐨勯厤缃獥鍙� + /// </summary> + private void ShowLoopMethordWeekDialog(NormalViewControl btnCycle) + { + //鏄熸湡涓�鍒版槦鏈熸棩 + var listText = new List<string>(); + listText.Add(this.dicText["鍛�1"]); + listText.Add(this.dicText["鍛�2"]); + listText.Add(this.dicText["鍛�3"]); + listText.Add(this.dicText["鍛�4"]); + listText.Add(this.dicText["鍛�5"]); + listText.Add(this.dicText["鍛�6"]); + listText.Add(this.dicText["鍛�7"]); + + var listSelect = new List<int>(); + if (this.automationInfo.LoopDiv == 3) + { + //涔嬪墠閫夋嫨鐨勬槸杩欎釜鍖哄垎鎵嶈兘鏈夐粯璁ら�夋嫨 + foreach (var value in this.automationInfo.ListLoopValue) + { + //榛樿閫夋嫨 + listSelect.Add(value - 1); + } + } + + var form = new BottomItemSelectControl(7, Language.StringByID(StringId.cyclic)); + form.AddRowMenu(listText, listSelect); + form.FinishEvent += (div, listIndex) => + { + if (div == 0) + { + //濡傛灉鐐瑰嚮浜嗗彇娑�,鍒欒皟璧� 鍛ㄦ湡寰幆閰嶇疆绐楀彛 + this.ShowLoopMethordSettionDialog(btnCycle); + return; + } + //鏇存敼缂撳瓨 + this.automationInfo.LoopDiv = 3; + this.automationInfo.ListLoopValue = new List<int>(); + + foreach (var index in listIndex) + { + this.automationInfo.ListLoopValue.Add(index + 1); + } + //鍙樻洿鏄剧ず鏂囨湰 + btnCycle.Text = this.GetLoopCondtionText(); + }; + } + + /// <summary> + /// 鏄剧ず鍛ㄦ湡寰幆(鏈堜唤)鐨勯厤缃獥鍙� + /// </summary> + private void ShowLoopMethordMonthDialog(NormalViewControl btnCycle) + { + var listSelect = new List<int>(); + if (this.automationInfo.LoopDiv == 4) + { + //涔嬪墠閫夋嫨鐨勬槸杩欎釜鍖哄垎鎵嶈兘鏈夐粯璁ら�夋嫨 + foreach (var value in this.automationInfo.ListLoopValue) + { + //榛樿閫夋嫨 + listSelect.Add(value); + } + } + + var form = new BottomSomeDaySelectControl(Language.StringByID(StringId.monthly)); + form.InitControl(listSelect); + form.FinishEvent += (div, listIndex) => + { + if (div == 0) + { + //濡傛灉鐐瑰嚮浜嗗彇娑�,鍒欒皟璧� 鍛ㄦ湡寰幆閰嶇疆绐楀彛 + this.ShowLoopMethordSettionDialog(btnCycle); + return; + } + //鏇存敼缂撳瓨 + this.automationInfo.LoopDiv = 4; + this.automationInfo.ListLoopValue = new List<int>(); + + foreach (var day in listIndex) + { + this.automationInfo.ListLoopValue.Add(day); + } + //鍙樻洿鏄剧ず鏂囨湰 + btnCycle.Text = this.GetLoopCondtionText(); + }; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鑾峰彇寰幆鏉′欢鐨勭炕璇戞枃鏈� + /// </summary> + /// <returns></returns> + private string GetLoopCondtionText() + { + //鎵ц涓�娆� + if (this.automationInfo.LoopDiv == 1) + { + return Language.StringByID(StringId.performA); + } + //姣忓ぉ + else if (this.automationInfo.LoopDiv == 2) + { + return Language.StringByID(StringId.days); + } + //姣忓懆 + else if (this.automationInfo.LoopDiv == 3) + { + var textValue = string.Empty; + foreach (var weekValue in this.automationInfo.ListLoopValue) + { + textValue += this.dicText["鍛�" + weekValue] + ","; + } + //鍘绘帀鏈�鍚庣殑閫楀彿 + return textValue.Substring(0, textValue.Length - 1); + } + //姣忔湀 + else if (this.automationInfo.LoopDiv == 4) + { + var textValue = Language.StringByID(StringId.monthly) + " "; + foreach (var day in this.automationInfo.ListLoopValue) + { + textValue += day.ToString() + ","; + } + //鍘绘帀鏈�鍚庣殑閫楀彿 + return textValue.Substring(0, textValue.Length - 1); + } + return string.Empty; + } + + #endregion + } +} -- Gitblit v1.8.0