From 965290476c027deb96891cde1095d9a100581a6b Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 20 二月 2020 09:13:32 +0800 Subject: [PATCH] 2020-02-20 1.优化更新。 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs index 44d93c1..be79cc4 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs @@ -573,8 +573,9 @@ new Alert ("", "Please setting date!", "Close").Show (); return; } - timerTemp.TimerName = etName.Text.Trim (); - if (string.IsNullOrEmpty (timerTemp.TimerName)) { + + string mTimerName = etName.Text.Trim (); + if (string.IsNullOrEmpty (mTimerName)) { //new Alert ("", "璇峰~鍐欏畾鏃跺櫒鍚嶇О!", "Close").Show (); new Alert ("", "Please set name for the timer!", "Close").Show (); return; @@ -592,7 +593,8 @@ return; } - var mTimer = listTimer.Find ((obj) => obj.TimerName == timerTemp.TimerName); + //鍚嶅瓧閲嶅鍒ゆ柇闄愬埗 + var mTimer = listTimer.Find ((obj) => obj.TimerName == mTimerName); if (isEdit) { if (mTimer != null && mTimer.Id != timerTemp.Id) { new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); @@ -601,6 +603,22 @@ } else { if (mTimer != null) { new Alert ("", "The timer name already exists. Please change it before saving it.", "Close").Show (); + return; + } + } + + //2020-02-10 鏃堕棿閲嶅鍒ゆ柇闄愬埗 + string mExecutionTime = btnTimelbl.Text; + //timerTemp.ExecutionTime = btnTimelbl.Text; + var mTimerExecutionTime = listTimer.Find ((obj) => (obj.ExecutionTime == mExecutionTime)); + if (isEdit) { + if (mTimerExecutionTime != null && mTimerExecutionTime.Id != timerTemp.Id) { + new Alert ("", "The timer time already exists. Please change it before saving it.", "Close").Show (); + return; + } + } else { + if (mTimerExecutionTime != null) { + new Alert ("", "The timer time already exists. Please change it before saving it.", "Close").Show (); return; } } @@ -641,6 +659,9 @@ if (timerTemp.Periodicity [timerTemp.Periodicity.Length - 1] == ',') { timerTemp.Periodicity = timerTemp.Periodicity.Remove (timerTemp.Periodicity.Length - 1, 1); } + + + timerTemp.IsStart = true; if (string.IsNullOrEmpty (timerTemp.Id)) { timerTemp.Id = Guid.NewGuid ().ToString (); -- Gitblit v1.8.0