public void Start(Control sourceControl, Effects.Effects effects, Point location, IPreview preview) { if (IsDisposed) { return; } if (!IsHandleCreated) { CreateHandle(); } _effects = effects; SourceControl = sourceControl ?? throw new ArgumentNullException(nameof(sourceControl)); IsDragging = true; Location = location; Preview = preview; UpdatablePreview = preview as IUpdatablePreview; PreviewOpacityController = preview as IPreviewOpacityController; if (UpdatablePreview is object) { UpdatablePreview.Updated += OnUpdatablePreviewUpdated; UpdatablePreview?.Start(); } InvalidatePreview(); _effects.StartEffect.Start(new IEffect.Arguments(this, SourceControl, null)); }
public void Stop(Control target, bool wasCancelled) { if (!IsDragging) { return; } if (UpdatablePreview is object) { UpdatablePreview.Stop(); UpdatablePreview.Updated -= OnUpdatablePreviewUpdated; } if (wasCancelled) { _effects.CancelEffect.Start(new IEffect.Arguments(this, SourceControl, target)); } else { _effects.DropEffect.Start(new IEffect.Arguments(this, SourceControl, target)); } IsDragging = false; }