Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/28/13 17:50:31 (11 years ago)
Author:
jkarder
Message:

#2116:

  • added hotlinking functionality
  • added methods for outermost view host detection and manipulation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r10042 r10089  
    219219    #region ListView Events
    220220    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    221       removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
     221      removeButton.Enabled = Content != null && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
    222222      AdjustListViewColumnSizes();
    223       if (showDetailsCheckBox.Checked) {
    224         if (itemsListView.SelectedItems.Count == 1) {
    225           T item = (T)itemsListView.SelectedItems[0].Tag;
    226           detailsGroupBox.Enabled = true;
    227           viewHost.Content = item;
     223      if (itemsListView.SelectedItems.Count == 1) {
     224        var item = (T)itemsListView.SelectedItems[0].Tag;
     225        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     226        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     227        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
     228          var oldCrumbs = outermostViewHost.Breadcrumbs;
     229          var newCrumbs = BuildBreadcrumbTrail();
     230          mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     231          outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
    228232        } else {
    229           viewHost.Content = null;
    230           detailsGroupBox.Enabled = false;
     233          if (showDetailsCheckBox.Checked) {
     234            detailsGroupBox.Enabled = true;
     235            viewHost.Content = item;
     236          } else {
     237            viewHost.Content = null;
     238            detailsGroupBox.Enabled = false;
     239          }
    231240        }
    232241      }
     
    245254    protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) {
    246255      if (itemsListView.SelectedItems.Count == 1) {
    247         var item = itemsListView.SelectedItems[0].Tag as T;
    248         if (item != null) {
    249           ViewHost outmostViewHost = null;
    250           for (var control = Parent; control != null; control = control.Parent) {
    251             var vh = control as ViewHost;
    252             if (vh != null) outmostViewHost = vh;
    253           }
    254           if (outmostViewHost != null) {
    255             var oldCrumbs = outmostViewHost.Breadcrumbs;
    256             var newCrumbs = BuildBreadcrumbTrail();
    257             outmostViewHost.Content = null;
    258             var viewType = MainFormManager.GetDefaultViewType(item.GetType());
    259             outmostViewHost.ViewType = viewType;
    260             outmostViewHost.Content = item;
    261             outmostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
    262             outmostViewHost.ActiveView.ReadOnly = ReadOnly;
    263             outmostViewHost.ActiveView.Locked = Locked;
    264           }
    265         }
     256        var item = (T)itemsListView.SelectedItems[0].Tag;
     257        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     258        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     259        var oldCrumbs = outermostViewHost.Breadcrumbs;
     260        var newCrumbs = BuildBreadcrumbTrail();
     261        mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     262        outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
     263        outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     264        outermostViewHost.ActiveView.Locked = Locked;
    266265      }
    267266    }
Note: See TracChangeset for help on using the changeset viewer.