Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/07/10 11:38:19 (14 years ago)
Author:
mkommend
Message:

implemented showInViewHost and moved ViewHost from Core.Views to MainForm.WindowsForm (ticket #961)

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
Files:
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/DockForm.cs

    r2790 r3281  
    3737      InitializeComponent();
    3838      this.view = view;
    39       if (View != null) {
     39      if (view != null) {
    4040        if (view is UserControl) {
    4141          switch (((UserControl)view).Dock) {
     
    5353              break;
    5454          }
    55           Control control = (Control)View;
     55          Type viewType = view.GetType();
     56          Control control = (Control)view;
    5657          control.Dock = DockStyle.Fill;
    57           this.Size = control.Size;
    58           viewPanel.Controls.Add(control);
    59           View.CaptionChanged += new EventHandler(View_CaptionChanged);
     58          this.view.CaptionChanged += new EventHandler(View_CaptionChanged);
    6059          UpdateText();
     60
     61          ContentView contentView = view as ContentView;
     62          if (ViewAttribute.GetShowInViewHost(viewType) && contentView != null) {
     63            ViewHost viewHost = new ViewHost();
     64            viewHost.ViewType = viewType;
     65            viewHost.Content = contentView.Content;
     66            viewHost.Dock = DockStyle.Fill;
     67            viewPanel.Controls.Add(viewHost);
     68          } else
     69            viewPanel.Controls.Add(control);
    6170        }
    6271      } else {
     
    6978      }
    7079    }
    71 
    7280    private IView view;
    7381    public IView View {
    74       get { return view; }
     82      get { return this.view; }
    7583    }
    7684
     
    7987        Invoke(new MethodInvoker(UpdateText));
    8088      else
    81         this.Text = View.Caption;
     89        this.Text = this.View.Caption;
    8290    }
    8391
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/DocumentForm.Designer.cs

    r2790 r3281  
    3232    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    3333    protected override void Dispose(bool disposing) {
    34       if (View != null)
    35         View.CaptionChanged -= new System.EventHandler(View_CaptionChanged);
     34      if (view != null)
     35        view.CaptionChanged -= new System.EventHandler(View_CaptionChanged);
    3636      if (disposing && (components != null)) {
    3737        components.Dispose();
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/DocumentForm.cs

    r2790 r3281  
    3030namespace HeuristicLab.MainForm.WindowsForms {
    3131  internal partial class DocumentForm : Form {
    32     private IView myView;
    33     public IView View {
    34       get { return myView; }
    35     }
     32    private IView view;
    3633
    3734    public DocumentForm() {
     
    4037    public DocumentForm(IView view)
    4138      : this() {
    42       myView = view;
    43       if (View != null) {
    44         Control control = (Control)View;
     39      this.view = view;
     40      if (view != null) {
     41        Type viewType = view.GetType();
     42        Control control = (Control)view;
    4543        control.Dock = DockStyle.Fill;
    46         viewPanel.Controls.Add(control);
    47         View.CaptionChanged += new EventHandler(View_CaptionChanged);
     44        view.CaptionChanged += new EventHandler(View_CaptionChanged);
    4845        UpdateText();
     46
     47        ContentView contentView = view as ContentView;
     48        if (ViewAttribute.GetShowInViewHost(viewType) && contentView != null) {
     49          ViewHost viewHost = new ViewHost();
     50          viewHost.ViewType = viewType;
     51          viewHost.Content = contentView.Content;
     52          viewHost.Dock = DockStyle.Fill;
     53          viewPanel.Controls.Add(viewHost);
     54        } else
     55          viewPanel.Controls.Add(control);
    4956      } else {
    5057        Label errorLabel = new Label();
     
    6168        Invoke(new MethodInvoker(UpdateText));
    6269      else
    63         Text = View.Caption;
     70        Text = view.Caption;
    6471    }
    6572
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/HeuristicLab.MainForm.WindowsForms-3.2.csproj

    r3227 r3281  
    152152      <DependentUpon>ViewContextMenuStrip.cs</DependentUpon>
    153153    </Compile>
     154    <Compile Include="ViewHost.cs">
     155      <SubType>UserControl</SubType>
     156    </Compile>
     157    <Compile Include="ViewHost.Designer.cs">
     158      <DependentUpon>ViewHost.cs</DependentUpon>
     159    </Compile>
    154160  </ItemGroup>
    155161  <ItemGroup>
     
    158164  </ItemGroup>
    159165  <ItemGroup>
     166    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj">
     167      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
     168      <Name>HeuristicLab.Common.Resources-3.2</Name>
     169    </ProjectReference>
    160170    <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.WinFormsUI\2.3.1\WinFormsUI-2.3.1\WinFormsUI-2.3.1.csproj">
    161171      <Project>{1849A92E-DCFC-4E05-BB0A-D7B7A3DAFCFB}</Project>
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/HeuristicLabMainFormWindowsFormsPlugin.cs.frame

    r2790 r3281  
    2727namespace HeuristicLab.MainForm.WindowsForms {
    2828  [Plugin("HeuristicLab.MainForm.WindowsForms", "3.2.0.$WCREV$")]
    29   [PluginFile("HeuristicLab.MainForm.WindowsForms-3.2.dll", PluginFileType.Assembly)] 
     29  [PluginFile("HeuristicLab.MainForm.WindowsForms-3.2.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Common.Resources", "3.2")]
    3031  [PluginDependency("HeuristicLab.MainForm", "3.2")]
    3132  [PluginDependency("HeuristicLab.WinFormsUI", "2.3.1")]
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewHost.Designer.cs

    r3280 r3281  
    2020#endregion
    2121
    22 namespace HeuristicLab.Core.Views {
     22namespace HeuristicLab.MainForm.WindowsForms {
    2323  partial class ViewHost {
    2424    /// <summary>
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewHost.cs

    r3280 r3281  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common;
    2726using HeuristicLab.MainForm;
    28 using HeuristicLab.MainForm.WindowsForms;
    2927
    30 namespace HeuristicLab.Core.Views {
     28namespace HeuristicLab.MainForm.WindowsForms {
    3129  public sealed partial class ViewHost : UserControl {
    3230    private Type viewType;
     
    3735          if (value != null && !ViewCanShowContent(value, content))
    3836            throw new ArgumentException(string.Format("View \"{0}\" cannot display content \"{1}\".",
    39                                                       value.GetPrettyName(),
    40                                                       content.GetType().GetPrettyName()));
     37                                                      value, content.GetType()));
    4138          viewType = value;
    4239          UpdateView();
     
    110107      if (!ViewCanShowContent(viewType, content))
    111108        throw new InvalidOperationException(string.Format("View \"{0}\" cannot display content \"{1}\".",
    112                                                           viewType.GetPrettyName(),
    113                                                           Content.GetType().GetPrettyName()));
     109                                                          viewType, Content.GetType()));
    114110
    115111      UpdateActiveMenuItem();
Note: See TracChangeset for help on using the changeset viewer.