- Timestamp:
- 10/15/13 16:11:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemListView.cs
r9755 r10042 146 146 try { 147 147 return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 148 } 149 catch (Exception ex) { 148 } catch (Exception ex) { 150 149 ErrorHandling.ShowErrorDialog(this, ex); 151 150 } … … 267 266 protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) { 268 267 if (itemsListView.SelectedItems.Count == 1) { 269 Titem = itemsListView.SelectedItems[0].Tag as T;268 var item = itemsListView.SelectedItems[0].Tag as T; 270 269 if (item != null) { 271 IContentView view = MainFormManager.MainForm.ShowContent(item); 272 if (view != null) { 273 view.ReadOnly = ReadOnly; 274 view.Locked = Locked; 270 ViewHost outmostViewHost = null; 271 for (var control = Parent; control != null; control = control.Parent) { 272 var vh = control as ViewHost; 273 if (vh != null) outmostViewHost = vh; 274 } 275 if (outmostViewHost != null) { 276 var oldCrumbs = outmostViewHost.Breadcrumbs; 277 var newCrumbs = BuildBreadcrumbTrail(); 278 outmostViewHost.Content = null; 279 var viewType = MainFormManager.GetDefaultViewType(item.GetType()); 280 outmostViewHost.ViewType = viewType; 281 outmostViewHost.Content = item; 282 outmostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item })); 283 outmostViewHost.ActiveView.ReadOnly = ReadOnly; 284 outmostViewHost.ActiveView.Locked = Locked; 275 285 } 276 286 } … … 506 516 } 507 517 } 518 protected virtual IEnumerable<IContent> BuildBreadcrumbTrail() { 519 var l = new LinkedList<IContent>(); 520 for (var control = (Control)this; control != null; control = control.Parent) { 521 var vh = control as ViewHost; 522 if (vh != null && vh.Content != null) 523 l.AddFirst(vh.Content); 524 } 525 return l; 526 } 508 527 #endregion 509 528 }
Note: See TracChangeset
for help on using the changeset viewer.