public async void ReceiveEditedORNewschedule(object arg, string id, TimeSpan start, TimeSpan stop, string interval, bool active) { var iProg = PageContext.EnableSpin(); try { EnableDisableDeleteButtonInRow(false); var viewObj = ScheduleView.Children[Convert.ToInt32(id) - 1]; await Task.Delay(500); ScheduleView.Children.RemoveAt(Convert.ToInt32(id) - 1); var uidays = (List <UIDay>)arg; //Add new schedule item view in small row DayConfigControl Schedule = new DayConfigControl(uidays, Navigation, this, active, scheduleList); Schedule.indexText = id; Schedule.editText = "edit"; Schedule.intervalText = interval; Schedule.StartTimeText = start; Schedule.StopTimeText = stop; Schedule.ScheduleReceived += ReceiveEditedORNewschedule; Schedule.DeleteDelegate += SingleDeleteDelegate; Schedule.DefaultUI = UIEnum.Schedul_NormalView; ScheduleView.Children.Insert(Convert.ToInt32(id) - 1, Schedule); //Make API call to update scheule to device var obj = JSONUtil.Build_Scheduler(uidays, start, stop, interval, active); obj.index = id.ToString(); scheduleList.scheduler[Convert.ToInt32(obj.index) - 1] = obj; scheduleList.request = "set"; scheduleList.info = "schedule"; if (PageContext != null && obj != null) { PageContext.EnableSpin(); await PageContext.SetSchedulerinVM(JsonConvert.SerializeObject(scheduleList)); DeviceInfoRequest activeStatus = new DeviceInfoRequest(); activeStatus.request = "status"; activeStatus.info = "scheduler"; activeStatus.index = Convert.ToInt32(id); activeStatus.value = active.ToString().ToLower(); await PageContext.SetScheduleActiveInactiveStatusinVM(activeStatus); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); UserDialogs.Instance.HideLoading(); } finally { PageContext.DisableSpin(iProg); } }