| | |
| | | public class AddSchedule : FrameLayout |
| | | { |
| | | VerticalScrolViewLayout bodyView; |
| | | FrameLayout devicesListView; |
| | | Action<Timer> action; |
| | | List<Common> roomDeviceList = new List<Common>(); |
| | | List<string> roomNameList = new List<string> (); |
| | |
| | | }; |
| | | devicesView.AddChidren (btnDeviceTitle); |
| | | |
| | | var devicesListView = new FrameLayout () { |
| | | devicesListView = new FrameLayout () { |
| | | Height = Application.GetRealHeight (130 * roomDeviceList.Count), |
| | | }; |
| | | bodyView.AddChidren (devicesListView); |
| | |
| | | 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; |
| | |
| | | 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 (); |
| | |
| | | } 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; |
| | | } |
| | | } |
| | |
| | | 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 (); |
| | |
| | | } |
| | | }); |
| | | } catch (Exception ex) { |
| | | Console.WriteLine (ex.Message); |
| | | Utlis.WriteLine (ex.Message); |
| | | } finally { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | //(1)Success 则调用此接口成功 |
| | |
| | | private static void InitDeviceListView (List<Common> roomDeviceList, List<DeviceInfo> timerControlDeviceList, FrameLayout devicesListView) |
| | | { |
| | | devicesListView.RemoveAll (); |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | try { |
| | | int iniIndex = 0; |
| | |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | #if __IOS__ |
| | | |
| | | |
| | | #else |
| | | //刷新devicesListView 高度 |
| | | devicesListView.Height = Application.GetRealHeight (130 * roomDeviceList.Count); |
| | | #endif |
| | | |
| | | foreach (var deviceCommon2 in roomDeviceList) { |
| | | if (deviceCommon2 == null) |
| | | continue; |
| | |
| | | btnFanLevel.Text = "S" + e.ToString (); |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("ss1: " + ex.Message); |
| | | Utlis.WriteLine ("ss1: " + ex.Message); |
| | | } |
| | | }; |
| | | |
| | |
| | | #endregion |
| | | } |
| | | }catch(Exception ex) { |
| | | Console.WriteLine ("AddSchedule error : "+ ex.Message); |
| | | Utlis.WriteLine ("AddSchedule error : "+ ex.Message); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine (ex.Message); |
| | | Utlis.WriteLine (ex.Message); |
| | | } finally { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |