void lvwGraphs_DragEnter(object sender, DragEventArgs e) { if ((e.AllowedEffect & DragDropEffects.Copy) != 0 || (e.AllowedEffect & DragDropEffects.Move) != 0) { if (e.Data.GetDataPresent(typeof(CopyMoveDragInfo))) { //Cannot Copy/Move if a read-only manager is the target if (this._manager.IsReadOnly) { return; } CopyMoveDragInfo info = e.Data.GetData(typeof(CopyMoveDragInfo)) as CopyMoveDragInfo; if (info == null) { return; } DragDropEffects effects = DragDropEffects.Copy; if (info.Source.DeleteSupported) { effects = effects | DragDropEffects.Move; //Move only possible if the source manager supports DeleteGraph() } e.Effect = effects; } } }
void lvwGraphs_ItemDrag(object sender, ItemDragEventArgs e) { if (this.lvwGraphs.SelectedItems.Count > 0) { String graphUri = this.lvwGraphs.SelectedItems[0].Text; CopyMoveDragInfo info = new CopyMoveDragInfo(this, graphUri); DragDropEffects effects = DragDropEffects.Copy; if (this._manager.DeleteSupported) { effects = effects | DragDropEffects.Move; //Move only possible if this manager supports DeleteGraph() } this.lvwGraphs.DoDragDrop(info, effects); } }
void lvwGraphs_DragDrop(object sender, DragEventArgs e) { if ((e.AllowedEffect & DragDropEffects.Copy) != 0 || (e.AllowedEffect & DragDropEffects.Move) != 0) { if (e.Data.GetDataPresent(typeof(CopyMoveDragInfo))) { CopyMoveDragInfo info = e.Data.GetData(typeof(CopyMoveDragInfo)) as CopyMoveDragInfo; if (info == null) { return; } //Check whether Move is permitted? if ((e.Effect & DragDropEffects.Move) != 0) { CopyMoveDialogue copyMoveConfirm = new CopyMoveDialogue(info, this._manager); if (copyMoveConfirm.ShowDialog() == DialogResult.OK) { if (copyMoveConfirm.IsMove) { info.Form.MoveGraph(info.SourceUri, this._manager); } else if (copyMoveConfirm.IsCopy) { info.Form.CopyGraph(info.SourceUri, this._manager); } } } else { //Just do a Copy info.Form.CopyGraph(info.SourceUri, this._manager); } } } }
public CopyMoveDialogue(CopyMoveDragInfo info, Connection target) { InitializeComponent(); this.lblConfirm.Text = String.Format(this.lblConfirm.Text, info.SourceUri, info.Source, target); }
public CopyMoveDialogue(CopyMoveDragInfo info, IStorageProvider target) { InitializeComponent(); this.lblConfirm.Text = String.Format(this.lblConfirm.Text, info.SourceUri, info.Source.ToString(), target.ToString()); }