/// <summary> /// Drop handler /// </summary> /// <param name="data">shared data</param> /// <param name="pasteType">verbs one of {Copy | Move}</param> /// <param name="status">synchronous status for updating the console</param> /// <returns>true for success</returns> protected override bool OnPaste(SharedData data, DragAndDropVerb pasteType, SyncStatus status) { string displayName = ""; // get pasted name data.Add(new SharedDataItem("DisplayName")); try { displayName = Encoding.Unicode.GetString(data.GetItem("DisplayName").GetData()); } catch (Microsoft.ManagementConsole.Advanced.PrimarySnapInDataException) { return(false); } // find string in buffer displayName = displayName.Substring(0, displayName.IndexOf("\0")); // update pasted on node to show the drop this.SelectedNodes[0].DisplayName += " ( " + displayName + " Dropped)"; return(true); }
/// <summary> /// Drop handler /// </summary> /// <param name="data">shared data</param> /// <param name="pasteType">verbs one of {Copy | Move}</param> /// <param name="status">synchronous status for updating the console</param> /// <returns>true for success</returns> protected override bool OnPaste(SharedData data, DragAndDropVerb pasteType, SyncStatus status) { string displayName = ""; // get pasted name data.Add(new SharedDataItem("DisplayName")); try { displayName = Encoding.Unicode.GetString(data.GetItem("DisplayName").GetData()); } catch (Microsoft.ManagementConsole.Advanced.PrimarySnapInDataException) { return false; } // find string in buffer displayName = displayName.Substring(0, displayName.IndexOf("\0")); // update pasted on node to show the drop this.SelectedNodes[0].DisplayName += " ( " + displayName + " Dropped)"; return true; }