From 81307af66465a6b5ba189b0fb9b347787f004a4e Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 30 十二月 2020 16:14:15 +0800 Subject: [PATCH] 2020-12-30-1 --- ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs | 75 +++++++++++++++++++++++-------------- 1 files changed, 46 insertions(+), 29 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs index 1d0328b..fbcce00 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs @@ -17,6 +17,8 @@ } /// 缁欏緪姊呭埛鏂扮晫闈㈢敤鐨� public Action<bool> action; + // 鍒锋柊涓婃姤鐣岄潰鐨凙ction + public Action<string, bool> updateCurrentDoorlockActionTemp; ///绗簩鍧楃涓�绾х埗鎺т欢 FrameLayout fLayout = new FrameLayout(); ///绗笁鍧楃涓�绾х埗鎺т欢 @@ -37,7 +39,7 @@ public int timeLong = 0; public async void Show() { - + #region 鐣岄潰鐨勫竷灞�浠g爜 UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦 TopView view = new TopView(); @@ -64,7 +66,6 @@ this.AddChidren(middle); #endregion //鏄父寮�妯″紡鍐嶅幓璇诲彇 - Send.CurrentDoorLock.IsDoorLockNormallyMode = true; if (Send.CurrentDoorLock.IsDoorLockNormallyMode) { //杩涙潵鏇存柊涓�娆� @@ -131,8 +132,8 @@ ///娣诲姞鑷姩鍖栧浘鏍囩殑鎺т欢 var addIconBtn = new Button { - Width = Application.GetMinRealAverage(69), - Height = Application.GetMinRealAverage(69), + Width = Application.GetRealWidth(69), + Height = Application.GetRealWidth(69), X = Application.GetRealWidth(890), Y = Application.GetRealHeight(60), UnSelectedImagePath = "ZigeeLogic/add.png", @@ -221,8 +222,25 @@ } catch { } }; - - //UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, _bool) => //{ // var key = Send.CurrentDoorLock.DeviceAddr + Send.CurrentDoorLock.DeviceEpoint; // if (DoorlockKey == key) // { // try // { // Application.RunOnMainThread(() => // { // Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool; // ModeView(); // }); // } // catch { } // } //}; + + updateCurrentDoorlockActionTemp = (DoorlockKey, _bool) => + { + + var key = Send.CurrentDoorLock.DeviceAddr; + if (DoorlockKey == key) + { + try + { + Application.RunOnMainThread(() => + { + Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool; + ModeView(); + }); + } + catch { } + } + }; + UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += updateCurrentDoorlockActionTemp; } /// <summary> /// 甯稿紑妯″紡寮�鍏冲垏鎹㈠浘鏍囩晫闈� @@ -236,8 +254,8 @@ { X = Application.GetRealWidth(395), Y = Application.GetRealHeight(92), - Width = Application.GetMinRealAverage(294), - Height = Application.GetMinRealAverage(294), + Width = Application.GetRealWidth(294), + Height = Application.GetRealWidth(294), }; fLayout.AddChidren(modeIconBtn); if (Send.CurrentDoorLock.IsDoorLockNormallyMode) @@ -333,16 +351,15 @@ ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈� year = datetime.Year.ToString();//閭d竴骞� month = datetime.Month.ToString();//閭d竴鏈� - var d = int.Parse(datetime.ToString("dd"));//閭d竴澶� - var h = int.Parse(datetime.ToString("HH"));//灏忔椂 - int dayInt = (h + timeValue) / 24;//璁剧疆鏃堕棿+褰撳墠绯荤粺鏃堕棿鏄惁瓒呭嚭24灏忔椂 - hour = (h + timeValue) % 24;//璁剧疆鏃堕棿+褰撳墠绯荤粺鏃堕棿鏄惁瓒呭嚭24灏忔椂鍓╀笅澶氬皯灏忔椂 - days = d + dayInt;//褰撳墠绯荤粺澶╂暟+鎵ц鍚庡ぉ鏁� + days = int.Parse(datetime.ToString("dd"));//閭d竴澶� + hour = int.Parse(datetime.ToString("HH"));//灏忔椂 minute = datetime.Minute;//鍒嗛挓 + timeLong = 0; } else { - ///璇诲彇绯荤粺鏃堕棿 year = DateTime.Now.Year.ToString();//閭d竴骞� + ///璇诲彇绯荤粺鏃堕棿 + year = DateTime.Now.Year.ToString();//閭d竴骞� month = DateTime.Now.Month.ToString();//閭d竴鏈� var d = DateTime.Now.ToString("dd");//閭d竴澶� var h = int.Parse(DateTime.Now.ToString("HH"));//灏忔椂 @@ -389,8 +406,8 @@ ///涓嬩竴绾ц彍鍗曞浘鏍囨帶浠� var nextIconBtn = new Button { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(104), + Width = Application.GetRealWidth(104), + Height = Application.GetRealWidth(104), X = Application.GetRealWidth(861), Y = Application.GetRealHeight(17), UnSelectedImagePath = "ZigeeLogic/nextIconSone.png", @@ -574,7 +591,7 @@ selectedRow = logicRow; }; a++; - ///鏄剧ず閫昏緫鍚嶇О鐨勬帶浠� + ///鏄剧ず閫昏緫鍚嶇О鐨勬帶浠� var nameBtn = new Button { Height = Application.GetRealHeight(58), @@ -590,8 +607,8 @@ ///鏄剧ず鐩爣鍔熻兘鑳屾櫙棰滆壊鐨勬帶浠� var typeBjBtn = new FrameLayout { - Width = Application.GetMinRealAverage(82), - Height = Application.GetMinRealAverage(82), + Width = Application.GetRealWidth(82), + Height = Application.GetRealWidth(82), X = Application.GetRealWidth(17), Y = Application.GetRealHeight(84), Radius = (uint)Application.GetMinRealAverage(41), @@ -601,16 +618,16 @@ ///鏄剧ず鐩爣鍔熻兘鍥炬爣鐨勬帶浠� var typeIconBtn = new Button { - Width = Application.GetMinRealAverage(58), - Height = Application.GetMinRealAverage(58), + Width = Application.GetRealWidth(58), + Height = Application.GetRealWidth(58), Gravity = Gravity.Center, }; typeBjBtn.AddChidren(typeIconBtn); ///閫昏緫寮�鍏冲浘鏍囩殑鎺т欢 var switchBtn = new Button { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(63), + Width = Application.GetRealWidth(104), + Height = Application.GetRealWidth(63), UnSelectedImagePath = "ZigeeLogic/logicclose.png", SelectedImagePath = "ZigeeLogic/logicopen.png", X = Application.GetRealWidth(815), @@ -690,19 +707,19 @@ ///鍒犻櫎鐐瑰嚮浜嬩欢 del.MouseUpEventHandler += (sender, e) => { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, + var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm, Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - alert.ConfirmClickEvent += () => + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + alert.ConfirmClickEvent += () => { Common.Logic.SoneLogicList.Remove(logic); //logicRow.Parent.RemoveFromParent(); fLayoutLogic.RemoveFromParent(); - Send.DelLogic(logic.LogicId); + Send.DelLogic(logic.LogicId); }; - }; + }; } } /// <summary> -- Gitblit v1.8.0