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.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs

    r10042 r10089  
    237237    #region ListView Events
    238238    private void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    239       removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
     239      removeButton.Enabled = Content != null && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
    240240      // for performance reason (multiple selection fires this handler for every selected item)
    241241      if (itemsListView.SelectedIndices.Count <= 1)
    242242        AdjustListViewColumnSizes();
    243       if (showDetailsCheckBox.Checked) {
    244         if (itemsListView.SelectedItems.Count == 1) {
    245           IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
    246           detailsGroupBox.Enabled = true;
    247           viewHost.Content = item;
     243      if (itemsListView.SelectedItems.Count == 1) {
     244        var item = (IRun)itemsListView.SelectedItems[0].Tag;
     245        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     246        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     247        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
     248          var oldCrumbs = outermostViewHost.Breadcrumbs;
     249          var newCrumbs = BuildBreadcrumbTrail();
     250          mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     251          outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
     252          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     253          outermostViewHost.ActiveView.Locked = Locked;
    248254        } else {
    249           viewHost.Content = null;
    250           detailsGroupBox.Enabled = false;
     255          if (showDetailsCheckBox.Checked) {
     256            detailsGroupBox.Enabled = true;
     257            viewHost.Content = item;
     258          } else {
     259            viewHost.Content = null;
     260            detailsGroupBox.Enabled = false;
     261          }
    251262        }
    252263      }
     
    266277    private void itemsListView_DoubleClick(object sender, EventArgs e) {
    267278      if (itemsListView.SelectedItems.Count == 1) {
    268         var item = itemsListView.SelectedItems[0].Tag as IRun;
    269         if (item != null) {
    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;
    285           }
    286         }
     279        var item = (IRun)itemsListView.SelectedItems[0].Tag;
     280        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     281        var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
     282        var oldCrumbs = outermostViewHost.Breadcrumbs;
     283        var newCrumbs = BuildBreadcrumbTrail();
     284        mainForm.ShowContentInSpecificViewHost(item, outermostViewHost);
     285        outermostViewHost.UpdateBreadcrumbTrail(oldCrumbs, newCrumbs.Concat(new[] { item }));
     286        outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     287        outermostViewHost.ActiveView.Locked = Locked;
    287288      }
    288289    }
Note: See TracChangeset for help on using the changeset viewer.