/// <summary> /// Schedules the appointment drop. /// </summary> /// <param name="sender">Sender value.</param> /// <param name="e">E value.</param> private async void Schedule_AppointmentDrop(object sender, AppointmentDropEventArgs e) { e.Cancel = false; var appointment = e.Appointment as ScheduleAppointment; this.label.Opacity = 1; this.label.HeightRequest = 50; if (Device.RuntimePlatform == "Android" || Device.RuntimePlatform == "iOS") { if (this.IsInNonAccessRegion(e.DropTime)) { e.Cancel = true; this.label.Text = "Cannot be moved to blocked time slots"; await this.label.FadeTo(0, 2000, Easing.SpringIn); this.label.HeightRequest = 0; return; } } this.label.Text = this.GetDroppedLocation(e.DropTime); await this.label.FadeTo(0, 2000, Easing.SpringIn); this.label.HeightRequest = 0; }
private void Schedule_AppointmentDrop(object sender, AppointmentDropEventArgs e) { var end = e.DropTime; var start = (e.Appointment as WorkScheduleItem).From; WorkScheduleItem item = e.Appointment as WorkScheduleItem; item.From = e.DropTime; item.To = item.From.AddHours(2); ViewModel.OffsetAllWorkScheduleItems(item); TimeSpan ts = end.Subtract(start); /* foreach(WorkScheduleItem wi in WorkItems) * { * wi.From = wi.From.Add(ts); * wi.To = wi.To.Add(ts); * } * * WorkScheduleItem[] items = new WorkScheduleItem[WorkItems.Count]; * WorkItems.CopyTo(items, 0); * WorkItems.Clear(); * * foreach(WorkScheduleItem wi in items) * { * WorkItems.Add(wi); * } * this.schedule.DataSource = WorkItems; */ // if (schedule.WorkWeekViewSettings.NonAccessibleBlocks[0].StartTime == e.DropTime.Hour || // (schedule.WorkWeekViewSettings.NonAccessibleBlocks[0].StartTime - 1 == e.DropTime.Hour && e.DropTime.Minute > 0)) }
/// <summary> /// drop event for schedule appointment. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SfSchedule_AppointmentDrop(object sender, AppointmentDropEventArgs e) { e.Cancel = false; if (IsInNonAccessRegion(e.DropTime)) { e.Cancel = true; DisplayToast("Cannot be moved to blocked time slots"); return; } DisplayToast("Moved to " + GetFormattedDroppedTime(e.DropTime)); }
private void Schedule_AppointmentDrop(object sender, AppointmentDropEventArgs e) { var changedResource = e.DropResourceItem; App.Current.MainPage.DisplayAlert("", "Resorce change into " + (changedResource as Employee).Name, "ok"); }
private void Bindable_AppointmentDrop(object sender, AppointmentDropEventArgs e) { (e.Appointment as Meeting).StartTime = e.DropTime; }
/// <summary> /// drop event for schedule appointment. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Schedule_AppointmentDrop(object sender, AppointmentDropEventArgs e) { if (IsInNonAccessRegion(e.DropTime)) { DisplayToast("Appointment cannot be dropped on blocked time slots"); e.Cancel = true; return; } if (!(e.Appointment as ScheduleAppointment).IsAllDay && IsAllDayRegion(dropPoint)) { e.Cancel = false; (e.Appointment as ScheduleAppointment).IsAllDay = true; (e.Appointment as ScheduleAppointment).StartTime = e.DropTime; (e.Appointment as ScheduleAppointment).EndTime = e.DropTime; DisplayToast("Moved to " + FormattedDate(e.DropTime)); } else if ((e.Appointment as ScheduleAppointment).IsAllDay && IsAllDayRegion(dropPoint)) { e.Cancel = false; NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents startDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day | NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, e.DropTime); NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day | NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, e.DropTime); NSDate startDate = calendar.DateFromComponents(startDateComponents); NSDate endDate = calendar.DateFromComponents(endDateComponents); e.DropTime = startDate; (e.Appointment as ScheduleAppointment).StartTime = startDate; (e.Appointment as ScheduleAppointment).IsAllDay = true; (e.Appointment as ScheduleAppointment).EndTime = endDate; DisplayToast("Moved to " + FormattedDate(startDate)); } else if ((e.Appointment as ScheduleAppointment).IsAllDay && !(IsAllDayRegion(dropPoint))) { e.Cancel = false; NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents startDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day | NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, e.DropTime); NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day | NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, e.DropTime); endDateComponents.Hour = endDateComponents.Hour + 1; NSDate startDate = calendar.DateFromComponents(startDateComponents); NSDate endDate = calendar.DateFromComponents(endDateComponents); e.DropTime = startDate; (e.Appointment as ScheduleAppointment).StartTime = startDate; (e.Appointment as ScheduleAppointment).IsAllDay = false; (e.Appointment as ScheduleAppointment).EndTime = endDate; DisplayToast("Moved to " + FormattedDate(startDate)); } else { e.Cancel = false; DisplayToast("Moved to " + FormattedDate(e.DropTime)); } }
private void ScheduleOnAppointmentDrop(object sender, AppointmentDropEventArgs e) { var dropTime = e.DropTime; e.DropTime = new DateTime(dropTime.Year, dropTime.Month, dropTime.Day, dropTime.Hour, 0, 0); }