From 70fe48768ea3695780f4b2ae32e940d50bb580c7 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期四, 07 五月 2020 17:50:42 +0800 Subject: [PATCH] 2020-05-07-3 --- ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs | 224 +++++++++++++++++++++++-------------------------------- 1 files changed, 95 insertions(+), 129 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs index ae7f8e6..300871c 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs @@ -16,23 +16,11 @@ { Tag = "SoneLogic"; } - /// <summary> - /// - /// </summary> - /// <param name="action">缁欏緪姊呭埛鏂扮晫闈㈢敤鐨�</param> - /// <param name="bool_If"></param> - public async void Show(Action action, bool bool_If = false) + /// 缁欏緪姊呭埛鏂扮晫闈㈢敤鐨� + public Action<bool> action; + public async void Show() { - #region 寰愭鍙繖鏍峰仛鐨� - string key = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint; - if (Send.CurrentDoorLock.IsDoorLockNormallyMode.ContainsKey(key)) - { - if (Send.CurrentDoorLock.IsDoorLockNormallyMode[key] == true) - { - bool_If = true; - } - } - #endregion + #region 鐣岄潰鐨勫竷灞�浠g爜 UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦 TopView view = new TopView(); @@ -41,13 +29,11 @@ view.clickBtn.MouseDownEventHandler += (sender, e) => { UserView.HomePage.Instance.ScrollEnabled = true; + RemoveFromParent(); if (action != null) { - action(); + action(Send.CurrentDoorLock.IsDoorLockNormallyMode); } - - RemoveFromParent(); - }; var middle = new FrameLayout @@ -75,18 +61,16 @@ Y = Application.GetRealHeight(92), Width = Application.GetMinRealAverage(294), Height = Application.GetMinRealAverage(294), - UnSelectedImagePath = "ZigeeLogic/noMode.png", - SelectedImagePath = "ZigeeLogic/openMode.png", }; fLayout.AddChidren(modeIconBtn); - if (bool_If) + if (Send.CurrentDoorLock.IsDoorLockNormallyMode) { /// 鏌ユ壘鏄惁瀛樺湪鏃舵晥鎬ц嚜鍔ㄥ寲锛涙湁鐨勮瘽灏辫繑鍥炶嚜鍔ㄥ寲瀵硅薄; var logic = await SkipView.GetLogicIfon(); fLayout.Height = Application.GetRealHeight(780);//鏀瑰彉楂樺害 - modeIconBtn.IsSelected = true;//鏀瑰彉鍥炬爣鐘舵�� + modeIconBtn.UnSelectedImagePath = "ZigeeLogic/openMode.png";//鏀瑰彉鍥炬爣鐘舵�� ///绗簩绾х埗鎺т欢 var openModeFl = new FrameLayout { @@ -108,60 +92,41 @@ TextSize = 16, }; openModeFl.AddChidren(closeBtn); - closeBtn.MouseUpEventHandler += (sender, e) => + closeBtn.MouseUpEventHandler += async (sender, e) => { - - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - alert.ConfirmClickEvent += async () => + var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); + if (result) { + if (logic != null) + { + ///鏈夊彲鑳藉彧鏈夊父寮�妯″紡锛屾病鏈夋椂鏁堟�ц嚜鍔ㄥ寲 + ///娌℃湁鍒ゆ柇鐨勮瘽锛岄�昏緫浼氫负绌猴紝鎶涘嚭寮傚父; + Send.DelLogic(logic.LogicId); + } + Send.CurrentDoorLock.IsDoorLockNormallyMode = false; + this.RemoveFromParent(); + var soneLogicList = new SoneLogicList(); + UserView.HomePage.Instance.AddChidren(soneLogicList); + UserView.HomePage.Instance.PageIndex += 1; + soneLogicList.Show(); + soneLogicList.action = action; + } + else + { + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.closeFailed)); + } - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock, action); - - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LogicAction += (d) => { - this.RemoveFromParent(); - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(() => { }, false); - - }; - - /////xm - //var result = await SkipView.OpenMode(false, Send.CurrentDoorLock); - //if (result) - //{ - // if (logic != null) - // { - // ///鏈夊彲鑳藉彧鏈夊父寮�妯″紡锛屾病鏈夋椂鏁堟�ц嚜鍔ㄥ寲 - // ///娌℃湁鍒ゆ柇鐨勮瘽锛岄�昏緫浼氫负绌猴紝鎶涘嚭寮傚父; - // Send.DelLogic(logic.LogicId); - // } - // this.RemoveFromParent(); - // var soneLogicList = new SoneLogicList(); - // UserView.HomePage.Instance.AddChidren(soneLogicList); - // UserView.HomePage.Instance.PageIndex += 1; - // soneLogicList.Show(()=>{ },false); - //} - //else { - // ///鎻愮ず澶辫触 - //} - - }; }; ///鏄剧ず澶辨晥璁剧疆鏃堕棿鏂囨湰鎺т欢 var timeTextBtn = new Button { Y = Application.GetRealHeight(127 + 69), - X = Application.GetRealWidth(225), - Width = Application.GetRealWidth(634), + X = Application.GetRealWidth(125), + Width = Application.GetRealWidth(634+200), Height = Application.GetRealHeight(60), TextSize = 15, TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Text = "鏃舵晥鎬у父寮�璁剧疆12:20", }; if (logic != null) { @@ -171,15 +136,21 @@ ///鏃舵晥鎬у父寮�鍙湁涓�涓潯浠�; try { - var y = DateTime.Now.ToString("yy");//閭d竴骞� - var m = DateTime.Now.ToString("mm");//閭d竴鏈� + + var y = DateTime.Now.Year.ToString();//閭d竴骞� + var m = DateTime.Now.Month.ToString();//閭d竴鏈� var d = DateTime.Now.ToString("dd");//閭d竴澶� var h = int.Parse(DateTime.Now.ToString("HH"));//褰撳墠绯荤粺鏃堕棿 - var me = DateTime.Now.ToLongDateString(); var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); int dayInt = (h + timeInt) / 24;//绠楀嚭鍑犲ぉ鍚庢墽琛� int hour = (h + timeInt) % 24;//绠楀嚭鍑犲ぉ鍚庨偅涓椂闂存墽琛� - timeTextBtn.Text = "鏃舵晥鎬у父寮�璁剧疆" + y + "骞�" + m + "鏈�" + d + dayInt + "鍙�" + timeInt + "鏃�" + "鎵ц"; + int days = int.Parse(d) + dayInt; + string text1 = Language.StringByID(MyInternationalizationString.timeSensitive); + string text2= Language.StringByID(MyInternationalizationString.yearSone); + string text3 = Language.StringByID(MyInternationalizationString.monthSone); + string text4= Language.StringByID(MyInternationalizationString.numberSone); + string text5= Language.StringByID(MyInternationalizationString.executeSone); + timeTextBtn.Text = text1 + y + text2 + m + text3 + days.ToString() + text4 + hour.ToString() + text5; } catch { } @@ -187,7 +158,7 @@ else { fLayout.Height = Application.GetRealHeight(645);//鏀瑰彉楂樺害 - modeIconBtn.IsSelected = false;//鏀瑰彉鍥炬爣鐘舵�� + modeIconBtn.UnSelectedImagePath = "ZigeeLogic/noMode.png";//鏀瑰彉鍥炬爣鐘舵�� ///绗簩绾х埗鎺т欢 var modeFl = new FrameLayout { @@ -222,71 +193,67 @@ Height = Application.GetMinRealAverage(104), X = Application.GetRealWidth(861), Y = Application.GetRealHeight(17), - UnSelectedImagePath = "ZigeeLogic/next.png", + UnSelectedImagePath = "ZigeeLogic/nextIconSone.png", }; modeFl.AddChidren(nextIconBtn); - - nextIconBtn.MouseUpEventHandler += (sender, e) => - { - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidTimeDialog(Send.CurrentDoorLock, action); - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LogicAction += (d) => { - this.RemoveFromParent(); - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(() => { }, true); + nextIconBtn.MouseUpEventHandler += (sender, e) => + { - }; - #region - /* - LogicView.TipView.ShowConfrimTip(() => - {///鍐嶆纭 + LogicView.TipView.ShowConfrimTip(() => + + {///鍐嶆纭 LogicView.TipView.ShowInputTip(true, async (str) => - {///纭鍙戦�佸懡浠� + {///纭鍙戦�佸懡浠� try - { + { ///xm - var result = await SkipView.OpenMode(true,Send.CurrentDoorLock); - if (!result) - { - Application.RunOnMainThread(() => - { - ///鎻愮ず澶辫触 - }); - return; - } - else - { + var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); + if (!result) + { + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed)); + return; + } + else + { ///鍥犱负鏈夊父寮�妯″紡涓嬫墠鍙互鍒涘缓澶辨晥閫昏緫锛� SkipView.GetLogicAll();//鍒犻櫎涔嬪墠鎵�鏈夊け鏁堥�昏緫 var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//娣诲姞涓�鏉″け鏁堥�昏緫 if (!addResult) - { - ///鎻愮ず澶辫触 - return; - } - this.RemoveFromParent(); - var soneLogicList = new SoneLogicList(); - UserView.HomePage.Instance.AddChidren(soneLogicList); - UserView.HomePage.Instance.PageIndex += 1; - soneLogicList.Show(() => { }, true); + { + ///鍙璇村鏋滃父寮�妯″紡寮�锛屽垱寤鸿嚜鍔ㄥ寲澶辫触锛岄偅涔堝皢瑕佸彂涓�鏉″父寮�妯″紡鍏抽棴鍛戒护; + UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); + ///鎻愮ず澶辫触 + LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed)); + return; + } + Send.CurrentDoorLock.IsDoorLockNormallyMode = true; + this.RemoveFromParent(); + var soneLogicList = new SoneLogicList(); + UserView.HomePage.Instance.AddChidren(soneLogicList); + UserView.HomePage.Instance.PageIndex += 1; + soneLogicList.Show(); + soneLogicList.action= action; + //soneLogicList.action += (c) => { + // if (action != null) + // { + // action(Send.CurrentDoorLock.IsDoorLockNormallyMode); + // } + //}; - } - } - catch - { + } + } + catch + { - } - }); + } + }); - }); - */ + }); - #endregion - }; + }; } #endregion @@ -437,14 +404,11 @@ /// 鍔犺浇鑷姩鍖栧垪琛� /// </summary> /// <param name="verticalRefresh"></param> + RowLayout selectedRow = new RowLayout() { Tag = "0" };//璁板綍宸︽粦鐘舵�� + int a = 1; private void RefreshView(VerticalRefreshLayout verticalRefresh) { verticalRefresh.RemoveAll(); - for (int i = 0; i < 6; i++) - { - Common.Logic.SoneLogicList.Add(new Common.Logic { LogicName = i.ToString() }); - - } foreach (var logic in Common.Logic.SoneLogicList) { #region 鑷姩鍖栧竷灞�View @@ -461,17 +425,19 @@ LineColor = ZigbeeColor.Current.LogicBackgroundColor, BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, SubViewWidth = Application.GetRealWidth(184),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� + Tag = a.ToString(), }; fLayout.AddChidren(logicRow); //宸︽粦鑿滃崟浜嬩欢 logicRow.OpenMenuAction += () => { - //if (selectedRow.Tag.ToString() != logicRowlayout.Tag.ToString()) - //{ //淇濈暀宸︽粦鍙湁涓�涓�; - // selectedRow.HideMenu();// - //} - //selectedRow = logicRowlayout; + if (selectedRow.Tag.ToString() != logicRow.Tag.ToString()) + { //淇濈暀宸︽粦鍙湁涓�涓�; + selectedRow.HideMenu();// + } + selectedRow = logicRow; }; + a++; ///鏄剧ず閫昏緫鍚嶇О鐨勬帶浠� var nameBtn = new Button { -- Gitblit v1.8.0