| | |
| | | timerTemp.RoomName = roomNameList [0]; |
| | | } |
| | | btnRoomChoose.Text = timerTemp.RoomName; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region Devices |
| | | timerControlDeviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DeviceInfo>> (timerTemp.ControlDeviceData);//devicesControlDataList |
| | | try { |
| | | timerControlDeviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DeviceInfo>> (timerTemp.ControlDeviceData);//devicesControlDataList |
| | | } catch { |
| | | timerControlDeviceList = null; |
| | | } |
| | | |
| | | if (timerControlDeviceList == null) |
| | | timerControlDeviceList = new List<DeviceInfo> (); |
| | | |
| | |
| | | //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 && !isEdit) { |
| | | } 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; |
| | | } |
| | |
| | | timerTemp.Periodicity = timerTemp.Periodicity.Remove (timerTemp.Periodicity.Length - 1, 1); |
| | | } |
| | | timerTemp.IsStart = true; |
| | | if (string.IsNullOrEmpty (timerTemp.Guid)) { |
| | | timerTemp.Guid = Guid.NewGuid ().ToString (); |
| | | if (string.IsNullOrEmpty (timerTemp.Id)) { |
| | | timerTemp.Id = Guid.NewGuid ().ToString (); |
| | | } |
| | | timerTemp.ControlDeviceData = Newtonsoft.Json.JsonConvert.SerializeObject (timerControlDeviceList); |
| | | MainPage.Loading.Start ("Saving..."); |
| | |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (timerTemp); |
| | | ResponsePack revertObj = null; |
| | | if (isEdit) { |
| | | revertObj = MainPage.RequestHttps (API.EditTimer, requestJson, true); |
| | | revertObj = MainPage.RequestHttps (API.EditTimer, requestJson); |
| | | } else { |
| | | revertObj = MainPage.RequestHttps (API.AddTimer, requestJson, true); |
| | | revertObj = MainPage.RequestHttps (API.AddTimer, requestJson); |
| | | } |
| | | |
| | | Application.RunOnMainThread (() => { |