From c1863db0158fb6c2a1cd96686d514c98c1073937 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 17 一月 2020 11:58:18 +0800 Subject: [PATCH] 2020-01-17 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs | 42 +++++++++++++++++++++++++++++++++++++----- 1 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs index e3c9da0..44d93c1 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs @@ -7,6 +7,7 @@ public class AddSchedule : FrameLayout { VerticalScrolViewLayout bodyView; + FrameLayout devicesListView; Action<Timer> action; List<Common> roomDeviceList = new List<Common>(); List<string> roomNameList = new List<string> (); @@ -459,7 +460,7 @@ }; devicesView.AddChidren (btnDeviceTitle); - var devicesListView = new FrameLayout () { + devicesListView = new FrameLayout () { Height = Application.GetRealHeight (130 * roomDeviceList.Count), }; bodyView.AddChidren (devicesListView); @@ -577,14 +578,33 @@ //new Alert ("", "璇峰~鍐欏畾鏃跺櫒鍚嶇О!", "Close").Show (); new Alert ("", "Please set name for the timer!", "Close").Show (); return; - } else if (listTimer.Find ((obj) => obj.TimerName == timerTemp.TimerName) != null) {//2020-01-09 缂栬緫鐨勬椂鍊欎篃鎻愮ず閲嶅鍚嶅瓧 - new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); - return; } + //else if (listTimer.Find ((obj) => obj.TimerName == timerTemp.TimerName) != null && !isEdit) {//2020-01-09 缂栬緫鐨勬椂鍊欎篃鎻愮ず閲嶅鍚嶅瓧 + // //if (isEdit) { + + // //} + // new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); + // return; + //} + if (timerControlDeviceList.Count == 0) { new Alert ("", "Please choose at least one device!", "Close").Show (); return; } + + var mTimer = listTimer.Find ((obj) => obj.TimerName == timerTemp.TimerName); + if (isEdit) { + if (mTimer != null && mTimer.Id != timerTemp.Id) { + new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); + return; + } + } else { + if (mTimer != null) { + new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); + return; + } + } + timerTemp.Periodicity = ""; if (btnMonday.IsSelected == true && btnFriday.IsSelected == true && btnThursday.IsSelected == true && btnSunday.IsSelected == true && btnTuesday.IsSelected == true && btnSaturday.IsSelected == true && btnWednesday.IsSelected == true) { timerTemp.TimerType = TimerType.EveryDay; @@ -636,7 +656,7 @@ ResponsePack revertObj = null; if (isEdit) { revertObj = MainPage.RequestHttps (API.EditTimer, requestJson); - } else { + } else { revertObj = MainPage.RequestHttps (API.AddTimer, requestJson); } @@ -661,6 +681,8 @@ }; } + + /// <summary> //(1)Success 鍒欒皟鐢ㄦ鎺ュ彛鎴愬姛 @@ -697,6 +719,7 @@ private static void InitDeviceListView (List<Common> roomDeviceList, List<DeviceInfo> timerControlDeviceList, FrameLayout devicesListView) { devicesListView.RemoveAll (); + System.Threading.Tasks.Task.Run (() => { try { int iniIndex = 0; @@ -707,6 +730,15 @@ i++; } } + +#if __IOS__ + + +#else + //鍒锋柊devicesListView 楂樺害 + devicesListView.Height = Application.GetRealHeight (130 * roomDeviceList.Count); +#endif + foreach (var deviceCommon2 in roomDeviceList) { if (deviceCommon2 == null) continue; -- Gitblit v1.8.0