private void treeListView_ItemActivate(object sender, EventArgs e) { Object rowObject = treeListView.SelectedObject; if (rowObject == null) { return; } if (rowObject is string && (string)rowObject == "..") { var newDir = Directory.GetParent(textBoxPath.Text); if (newDir != null) { rowObject = newDir; } else { rowObject = new DirectoryInfo(textBoxPath.Text); } } if (rowObject is DirectoryInfo) { textBoxPath.Text = ((DirectoryInfo)rowObject).FullName; PopulateListFromPath(textBoxPath.Text); } else { if (rowObject is RecordLine) { var view = RecordSetView.LoadRecordLine((RecordLine)rowObject, textBoxPath.Text); if (view != null) { view.Show(GlobalSettings.Instance.DockPanelInstance); } AddDragDropHandler(view); } if (rowObject is Record) { var view = RecordSetView.LoadRecording((Record)rowObject, textBoxPath.Text); if (view != null) { view.Show(GlobalSettings.Instance.DockPanelInstance); } AddDragDropHandler(view); } } }
private void AddDragDropHandler(RecordSetView view) { view.DragDrop += (o, e) => { var data = (BrightIdeasSoftware.OLVDataObject)e.Data; foreach (var recordLine in data.ModelObjects.OfType <RecordLine>()) { if (recordLine is RecordLineStream1D) { view.CreatePlot((RecordLineStream1D)recordLine, textBoxPath.Text); } else if (recordLine is RecordLineStream2D) { view.CreatePlot((RecordLineStream2D)recordLine, textBoxPath.Text); } } }; }