public override object ConvertTo(object data, string format) { if (format == typeof(IDateRange).FullName) { var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List <object>).First() as Project; var task = new GanttTask { Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End }; return(task); } else if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleViewDragDropPayload), false)) { ScheduleViewDragDropPayload payload = (ScheduleViewDragDropPayload)DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false); if (payload != null) { return(payload.DraggedAppointments); } } else if (format == typeof(ScheduleViewDragDropPayload).FullName) { var customers = DataObjectHelper.GetData(data, typeof(Project), true) as IEnumerable; if (customers != null) { return(customers.OfType <Project>().Select(c => new Appointment { Subject = c.Name }).ToList()); } } return(null); }
public override object ConvertTo(object data, string format) { if (format == typeof(string).FullName && DataObjectHelper.GetDataPresent(data, "DragData", false)) { var customer = DataObjectHelper.GetData(data, "DragData", false) as Customer; var fullInfoString = "Name: " + customer.FirstName + " " + customer.LastName + ", Age: " + customer.Age; return(fullInfoString); } return(null); }
public override object ConvertTo(object data, string format) { if (format == typeof(ScheduleViewDragDropPayload).FullName && DataObjectHelper.GetDataPresent(data, typeof(Appointment), false)) { var appointments = (IEnumerable)DataObjectHelper.GetData(data, typeof(Appointment), false); if (appointments != null) { return(new ScheduleViewDragDropPayload(null, appointments.OfType <IOccurrence>().ToList())); } } return(null); }
public override IEnumerable <IOccurrence> ConvertDraggedData(object data) { if (DataObjectHelper.GetDataPresent(data, typeof(Appointment), false)) { var appointments = DataObjectHelper.GetData(data, typeof(Appointment), true) as IEnumerable; if (appointments != null) { return(appointments.OfType <IOccurrence>()); } } return(base.ConvertDraggedData(data)); }
public override IEnumerable<IOccurrence> ConvertDraggedData(object data) { if (DataObjectHelper.GetDataPresent(data, typeof(Customer), false)) { var customers = DataObjectHelper.GetData(data, typeof(Customer), true) as IEnumerable; if (customers != null) { var newApp = customers.OfType<Customer>().Select(c => new Appointment { Subject = c.Name }); return newApp; } } return base.ConvertDraggedData(data); }
public override IEnumerable <IOccurrence> ConvertDraggedData(object data) { if (DataObjectHelper.GetDataPresent(data, typeof(ClassDisplayModel), false)) { var cdms = DataObjectHelper.GetData(data, typeof(ClassDisplayModel), false) as IEnumerable; if (cdms != null) { return(cdms.OfType <ClassDisplayModel>().Select(c => new ScheduleAppointment { Subject = c.Name, ClassId = c.Id }));; } } return(base.ConvertDraggedData(data)); }