public override void DragDropCompleted(DragDropState state) { var appointment = GetAppointment(state.Appointment) as CustomAppointment; appointment.Body = "DragDrop completed at: " + DateTime.Now; base.DragDropCompleted(state); }
public override void ResizeCanceled(DragDropState state) { var appointment = GetAppointment(state.Appointment) as CustomAppointment; appointment.Body = "Resize Canceled"; base.ResizeCanceled(state); }
public override void DragDropCompleted(DragDropState state) { // In order to avoid the removal of the items from the ListBox, // when an item is dropped we shouldn't call the base method. // // base.DragDropCompleted(state); }
public override void DragDropCanceled(DragDropState state) { var appointment = state.Appointment as CustomAppointment; appointment.Body = "DragDrop canceled at: " + DateTime.Now; base.DragDropCanceled(state); }
public override void Resize(DragDropState state) { var appointment = state.Appointment as CustomAppointment; var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; appointment.Body = "Resize finished. New duration: " + duration.ToString("h\\:mm\\:ss"); base.Resize(state); }
/// <summary> /// Gets the value specifying whether the resize operation can be finished, or not. /// </summary> /// <param name="state">DragDropState identifying the current resize operation.</param> /// <returns>True when the resize operation can be finished, otherwise false.</returns> public override bool CanResize( DragDropState state ) { var overlap = state.DestinationAppointmentsSource .OfType<IAppointment> () .Where ( a => a != state.Appointment ) .All ( a => state.DestinationSlots.All ( s => !AreOverlapping ( a, s ) ) ); return overlap; }
public override IEnumerable <IOccurrence> CoerceDraggedItems(DragDropState state) { var resource = (GetAppointment(state.Appointment) as Appointment).Resources.First(); var allAppointments = state.SourceAppointmentsSource.Cast <IOccurrence>(); var desiredAppointments = allAppointments.Where(a => (a as Appointment).Resources.Any(r => r == resource) && !(a as CustomAppointment).IsReadOnly); return(desiredAppointments); }
public DragEventArgs(IColossalControl source, DragDropState state, object data, Vector2 position, IColossalControl target) { this.State = state; this.Data = data; this.Position = position; this.Source = source; this.Target = target; }
public override bool CanDrop(DragDropState state) { var draggedOccurrence = state.Appointment as Occurrence; return state.DestinationAppointmentsSource .OfType<IAppointment>() .Where((IAppointment a) => !state.DraggedAppointments.Contains(a)) .All((IAppointment a) => state.DestinationSlots.All((Slot s) => !ConflictChecking.AreOverlapping(a, s, draggedOccurrence))); }
public override void Resize(DragDropState state) { var appointment = GetAppointment(state.Appointment) as CustomAppointment; var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; appointment.Body = "Resize finished. New duration: " + duration.ToString("h\\:mm\\:ss"); base.Resize(state); }
public override bool CanDrop(DragDropState state) { var draggedOccurrence = state.Appointment as Occurrence; return(state.DestinationAppointmentsSource .OfType <IAppointment>() .Where((IAppointment a) => !state.DraggedAppointments.Contains(a)) .All((IAppointment a) => state.DestinationSlots.All((Slot s) => !ConflictChecking.AreOverlapping(a, s, draggedOccurrence)))); }
/// <summary> /// Returns a value specifying whether the current drag operation can be completed. /// </summary> /// <param name="state">DragDropState that provides context for the current operation.</param> /// <returns> /// True if the drag operation can be completed, otherwise false. /// </returns> /// <remarks> /// This method is called only in the context of the drop target control. /// </remarks> public override bool CanDrop(DragDropState state) { if (state == null) throw new ArgumentNullException("state"); var columns = state.DraggedItems as IEnumerable<IGridColumn>; return columns != null && columns.Any(); }
public override void DragDropCompleted(DragDropState state) { if (lastSource != null) { base.DragDropCompleted(state); lastSource = null; } }
/// <summary> /// Gets the value specifying whether the resize operation can be finished, or not. /// </summary> /// <param name="state">DragDropState identifying the current resize operation.</param> /// <returns>True when the resize operation can be finished, otherwise false.</returns> public override bool CanResize(DragDropState state) { var overlap = state.DestinationAppointmentsSource .OfType <IAppointment> () .Where(a => a != state.Appointment) .All(a => state.DestinationSlots.All(s => !AreOverlapping(a, s))); return(overlap); }
public override void Drop(DragDropState state) { if (!state.IsSameControl && state.DraggedItems.Cast <StatInfo>().All(x => x is StatInfoBreak)) { base.DragDropCanceled(state); return; } base.Drop(state); }
/// <summary> /// The drag drop completed. /// </summary> /// <param name="state">The state.</param> /// <exception cref="System.ArgumentNullException">state</exception> /// <exception cref="ArgumentNullException"></exception> public override void DragDropCompleted(DragDropState state) { if (state == null || state.DraggedItems == null) throw new ArgumentNullException("state"); if (state.IsSameControl) { //change column order base.DragDropCompleted(state); } }
public override void DragDropCanceled(DragDropState state) { if (!state.DraggedItems.Cast <StatInfo>().All(x => x is StatInfoBreak)) { base.DragDropCanceled(state); } else { base.DragDropCompleted(state); } }
public override bool CanStartDrag(DragDropState state) { var draggedAppointment = state.Appointment as CustomAppointment; if (draggedAppointment != null && draggedAppointment.IsReadOnly) { return(false); } return(base.CanStartDrag(state)); }
public override bool CanStartResize(DragDropState state) { var appointment = state.Appointment as CustomAppointment; if (appointment != null && appointment.IsReadOnly) { return(false); } return(base.CanStartResize(state)); }
public override bool CanDrop(DragDropState state) { var appointment = state.Appointment as CustomAppointment; if (appointment.Resources.Count > 0 && appointment.Resources.First() != state.DestinationSlots.First().Resources.First()) { return false; } return base.CanDrop(state); }
public override void DragDropCompleted(DragDropState state) { var appointment = state.Appointment as Appointment; if (appointment != null) { appointment.Body = "DragDrop completed at: " + DateTime.Now; } base.DragDropCompleted(state); }
public override bool CanDrop(DragDropState state) { var appointment = state.Appointment as Appointment; if (appointment != null && appointment.Resources.Count > 0 && appointment.Resources.First() != state.DestinationSlots.First().Resources.First()) { return(false); } return(base.CanDrop(state)); }
public override void ResizeCanceled(DragDropState state) { var appointment = state.Appointment as Appointment; if (appointment != null) { appointment.Body = "Resize Canceled"; } base.ResizeCanceled(state); }
public override bool CanStartDrag(DragDropState state) { var draggedAppointment = state.Appointment as CustomAppointment; if (draggedAppointment.IsReadOnly) { return false; } return base.CanStartDrag(state); }
public override bool CanStartResize(DragDropState state) { var appointment = state.Appointment as CustomAppointment; if (appointment.IsReadOnly) { return false; } return base.CanStartResize(state); }
public override bool CanResize(DragDropState state) { var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; if (duration <= new TimeSpan(0, 30, 0) || duration >= new TimeSpan(2, 0, 1)) { return(false); } return(base.CanResize(state)); }
/// <summary> /// Gets the value specifying whether the drag operation can be performed, or not. /// </summary> /// <param name="state">DragDropState identifying the current drag operation.</param> /// <returns>True when the drag operation can be performed, otherwise false.</returns> public override bool CanStartDrag(DragDropState state) { var appointment = state.Appointment as IAppointment; if (appointment != null && appointment.Resources.Count > 0 && appointment.Resources[0] is LookupValueDto) { var visitStatus = ( LookupValueDto )appointment.Resources[0]; return(visitStatus.WellKnownName.Equals(VisitStatus.Scheduled, StringComparison.InvariantCultureIgnoreCase)); } return(base.CanStartDrag(state)); }
public override bool CanResize(DragDropState state) { var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; if (duration <= new TimeSpan(0, 30, 0) || duration >= new TimeSpan(2, 0, 1)) { return false; } return base.CanResize(state); }
/// <summary> /// Gets the value specifying whether the drag operation can be finished, or not. /// </summary> /// <param name="state">DragDropState identifying the current drag operation.</param> /// <returns>True when the drag operation can be finished, otherwise false.</returns> public override bool CanDrop( DragDropState state ) { var draggedAppointment = state.Appointment as IAppointment; if ( draggedAppointment == null ) { return false; } var overlap = state.DestinationAppointmentsSource .OfType<IAppointment> () .Where ( a => !state.DraggedAppointments.Contains ( a ) ) .All ( a => state.DestinationSlots.All ( s => !AreOverlapping ( a, s ) ) ); return overlap; }
/// <summary> /// The can drop. /// </summary> /// <param name="state">The state.</param> /// <returns>The <see cref="bool" />.</returns> /// <exception cref="System.ArgumentNullException">state</exception> /// <exception cref="ArgumentNullException"></exception> public override bool CanDrop(DragDropState state) { if (state == null || state.DraggedItems == null) throw new ArgumentNullException("state"); if (state.IsSameControl) { //change column order base.DragDropCompleted(state); return true; } return false; }
/// <summary> /// Gets the value specifying whether the drag operation can be finished, or not. /// </summary> /// <param name="state">DragDropState identifying the current drag operation.</param> /// <returns>True when the drag operation can be finished, otherwise false.</returns> public override bool CanDrop(DragDropState state) { var draggedAppointment = state.Appointment as IAppointment; if (draggedAppointment == null) { return(false); } var overlap = state.DestinationAppointmentsSource .OfType <IAppointment> () .Where(a => !state.DraggedAppointments.Contains(a)) .All(a => state.DestinationSlots.All(s => !AreOverlapping(a, s))); return(overlap); }
public override void Drop(DragDropState state) { var appointment = state.Appointment as CustomAppointment; if (appointment != null && appointment.IsDraggedFromListBox) { appointment.Body = "Dragged from the ListBox"; } if (state.IsControlPressed) { state.IsControlPressed = false; } base.Drop(state); }
/// <summary> /// Completes the drop operation. This method is called only in the context of the drop target control. /// </summary> /// <param name="state">DragDropState that provides context for the current operation.</param> /// <remarks> /// When the drag source and the drop target are the same control, this method is called before DragCompleted. /// </remarks> public override void Drop(DragDropState state) { if (state == null || state.DraggedItems == null) throw new ArgumentNullException("state"); //handle drop on Group Header var column = ((IEnumerable<IGridColumn>)state.DraggedItems).FirstOrDefault(); if (column != null) { var groups = ((IList<IGridColumn>)state.DestinationItemsSource).Where(g => g.GroupLevel.HasValue && g.GroupLevel.Value > 0).ToList(); if (groups.All(g => g.SystemName != column.SystemName)) column.GroupLevel = groups.Count() + 1; } }
public override void Drop(DragDropState state) { var appointment = state.Appointment as CustomAppointment; if (appointment.IsDraggedFromListBox) { appointment.Body = "Dragged from the ListBox"; } if (state.IsControlPressed) { state.IsControlPressed = false; } base.Drop(state); }
public override void Drop(DragDropState state) { var draggedItems = state.DraggedItems.OfType<Customer>().ToList(); TextBlock textBlock1 = new TextBlock(); textBlock1.Text = "Dropped item:"; TextBlock textBlock2 = new TextBlock(); textBlock2.Text = string.Format("ID: {0}", draggedItems[0].Id); TextBlock textBlock3 = new TextBlock(); textBlock3.Text = string.Format("Name: {0}", draggedItems[0].Name); StackPanel stackPanel = new StackPanel(); stackPanel.Children.Add(textBlock1); stackPanel.Children.Add(textBlock2); stackPanel.Children.Add(textBlock3); RadWindow.Alert(stackPanel); base.Drop(state); }
public void DragDrop(DragDropState state) { switch (state) { case DragDropState.Drag: _dragNDropAnim.SetBool("Drag", false); break; case DragDropState.Drop: _dragNDropAnim.SetBool("Drag", true); break; case DragDropState.Hidden: _dragNDropAnim.SetTrigger("Hide"); break; } }
public override bool CanResize(DragDropState state) { var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; if (duration <= new TimeSpan(0, 30, 0) || duration >= new TimeSpan(2, 0, 1)) { #if !WPF this.ResizeCursor = Cursors.Wait; #else this.ResizeCursor = Cursors.No; #endif return false; } this.ResizeCursor = Cursors.Hand; return base.CanResize(state); }
public override bool CanResize(DragDropState state) { var destinationSlot = state.DestinationSlots.First() as Slot; var duration = destinationSlot.End - destinationSlot.Start; if (duration <= new TimeSpan(0, 30, 0) || duration >= new TimeSpan(2, 0, 1)) { #if !WPF this.ResizeCursor = Cursors.Wait; #else this.ResizeCursor = Cursors.No; #endif return(false); } this.ResizeCursor = Cursors.Hand; return(base.CanResize(state)); }
public override void Drop(DragDropState state) { ObservableCollection <string> zonePlants = state.DestinationItemsSource as ObservableCollection <string>; List <string> newPlants = state.DraggedItems.OfType <string>().ToList(); List <string> existingPlants = new List <string>(); foreach (string newPlant in newPlants) { if (newPlant != null) { foreach (string zonePlant in zonePlants) { if (zonePlant.Equals(newPlant)) { existingPlants.Add(zonePlant); break; } } } } if (newPlants.Count > 1 && existingPlants.Any()) { string existingPlantsNames = ""; foreach (string plantName in existingPlants) { existingPlantsNames += plantName + Environment.NewLine; } RadWindow.Alert(new DialogParameters { Content = "No se copiaron los recursos, dado que los siguientes recursos " + Environment.NewLine + "ya exitían en la zona: " + Environment.NewLine + existingPlantsNames }); } else if (!existingPlants.Any()) { base.Drop(state); } }
/// <summary> /// Performs the drag operation. /// </summary> /// <param name="state">DragDropState identifying the current drag operation.</param> public override void Drop(DragDropState state) { var draggedAppointment = state.Appointment as IAppointment; if (draggedAppointment == null) { return; } if (!state.DestinationAppointmentsSource.OfType <IAppointment> ().Contains(draggedAppointment)) { draggedAppointment.Start = state.DestinationSlots.ElementAt(0).Start; draggedAppointment.End = state.DestinationSlots.ElementAt(0).End; var source = (state.SourceAppointmentsSource as IList); if (source == null && state.SourceAppointmentsSource is ICollectionView) { source = (state.SourceAppointmentsSource as ICollectionView).SourceCollection as IList; } if (source != null) { source.Remove(draggedAppointment); } var destination = (state.DestinationAppointmentsSource as IList); if (destination == null && state.DestinationAppointmentsSource is ICollectionView) { destination = (state.DestinationAppointmentsSource as ICollectionView).SourceCollection as IList; } if (destination != null) { destination.Add(draggedAppointment); if (AddedAppointmentCommand != null && AddedAppointmentCommand.CanExecute(draggedAppointment)) { AddedAppointmentCommand.Execute(draggedAppointment); } } } else { base.Drop(state); } }
public override void DragDropCompleted(DragDropState state) { var draggedItems = state.DraggedItems.OfType <Customer>().ToList(); TextBlock textBlock1 = new TextBlock(); textBlock1.Text = "Dragged item:"; TextBlock textBlock2 = new TextBlock(); textBlock2.Text = string.Format("ID: {0}", draggedItems[0].Id); TextBlock textBlock3 = new TextBlock(); textBlock3.Text = string.Format("Name: {0}", draggedItems[0].Name); StackPanel stackPanel = new StackPanel(); stackPanel.Children.Add(textBlock1); stackPanel.Children.Add(textBlock2); stackPanel.Children.Add(textBlock3); RadWindow.Alert(stackPanel); base.DragDropCompleted(state); }
} /// <summary> /// When overridden in a derived class completes the drag operation. This method is called only in the context of the drag source control. /// </summary> /// <param name="state">DragDropState that provides context for the current operation.</param> /// <remarks> /// When the drag source and the drop target are the same control, this method is called after Drop. /// This method is called only when the drag operation completed successfully. If this method is called, DragDropCanceled is not called. /// </remarks> public override void DragDropCompleted(DragDropState state)
public override void DragDropCompleted(DragDropState state) { var appointment = state.Appointment as CustomAppointment; appointment.Body = "DragDrop completed at: " + DateTime.Now; base.DragDropCompleted(state); }
/// <summary> /// Returns a value specifying whether the current drag operation can be completed. /// </summary> /// <param name="state">DragDropState that provides context for the current operation.</param> /// <returns> /// True if the drag operation can be completed, otherwise false. /// </returns> /// <remarks> /// This method is called only in the context of the drop target control. /// </remarks> public override bool CanDrop(DragDropState state) { if (state == null) throw new ArgumentNullException("state");
public override void ResizeCanceled(DragDropState state) { var appointment = state.Appointment as CustomAppointment; appointment.Body = "Resize Canceled"; base.ResizeCanceled(state); }
public override bool CanDrop(DragDropState state) { // Don't want to drop on the ListBox at all. return false; }
/// <summary> /// Returns a value specifying whether the drag operation can be started. /// </summary> /// <param name="state">DragDropState that provides context for the current operation.</param> /// <returns> /// True if the drag operation can be completed, otherwise false. /// </returns> /// <remarks> /// This method is called only in the context of the drag source control. /// </remarks> public override bool CanStartDrag(DragDropState state) { return false; }
/// <summary> /// Gets the value specifying whether the resize operation can be finished, or not. /// </summary> /// <param name="state">DragDropState identifying the current resize operation.</param> /// <returns>True when the resize operation can be finished, otherwise false.</returns> public override bool CanResize(DragDropState state) { return(false); }
/// <summary> /// This method is called when the drag and drop operations are completed. /// </summary> /// <param name="state">The drag drop state.</param> public override void DragDropCompleted(DragDropState state) { base.DragDropCompleted(state); RadDragAndDropManager.DragCueOffset = new Point(); }
protected override bool IsMovingItems(DragDropState state) { return(false); }
public override void Drop(DragDropState state) { }
public override IEnumerable<IOccurrence> CoerceDraggedItems(DragDropState state) { yield return state.Appointment; }
public override void Drop(DragDropState state) { base.Drop(state); lastSource = state.DestinationItemsSource; }
public override IEnumerable<IOccurrence> CoerceDraggedItems(DragDropState state) { var resource = (state.Appointment as Appointment).Resources.First(); var allAppointments = state.SourceAppointmentsSource.Cast<IOccurrence>(); var desiredAppointments = allAppointments.Where(a => (a as Appointment).Resources.Any(r => r == resource) && !(a as CustomAppointment).IsReadOnly); return desiredAppointments; }
public override bool CanStartDrag(DragDropState state) { return(false); }
public override void DragDropCompleted(DragDropState state) { base.DragDropCompleted(state); }