Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2233


Ignore:
Timestamp:
08/04/09 16:52:49 (15 years ago)
Author:
mkommend
Message:

implemented first version of MainFormBase and DockingMainForm (ticket #716)

Location:
trunk/sources
Files:
15 added
3 edited
3 copied

Legend:

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

    r2229 r2233  
    2828using System.Windows.Forms;
    2929using WeifenLuo.WinFormsUI.Docking;
    30 using HeuristicLab.Core;
    3130
    32 namespace HeuristicLab.AdvancedOptimizationFrontend {
     31namespace HeuristicLab.MainForm {
    3332  /// <summary>
    3433  /// Displays the used view.
    3534  /// </summary>
    36   public partial class ViewForm : DockContent {
    37     private IView myView;
    38     /// <summary>
    39     /// Gets the view that is displayed.
    40     /// </summary>
    41     public IView View {
    42       get { return myView; }
    43     }
    44 
    45     /// <summary>
    46     /// Initializes a new instance of <see cref="ViewForm"/>.
    47     /// </summary>
    48     public ViewForm() {
     35  public partial class DockForm : DockContent {
     36    public DockForm(IView view) {
    4937      InitializeComponent();
    50     }
    51     /// <summary>
    52     /// Initializes a new instance of <see cref="ViewForm"/> with the given <paramref name="view"/>
    53     /// to display.
    54     /// </summary>
    55     /// <param name="view">The view that should be displayed.</param>
    56     public ViewForm(IView view)
    57       : this() {
    58       myView = view;
     38      this.view = view;
    5939      if (View != null) {
    6040        Control control = (Control)View;
     
    7151        viewPanel.Controls.Add(errorLabel);
    7252      }
     53    }
     54
     55    private IView view;
     56    public IView View {
     57      get { return view; }
    7358    }
    7459
  • trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLab.MainForm.csproj

    r2231 r2233  
    3333    <WarningLevel>4</WarningLevel>
    3434  </PropertyGroup>
     35  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     36    <DebugSymbols>true</DebugSymbols>
     37    <OutputPath>bin\x64\Debug\</OutputPath>
     38    <DefineConstants>DEBUG;TRACE</DefineConstants>
     39    <DebugType>full</DebugType>
     40    <PlatformTarget>x64</PlatformTarget>
     41    <ErrorReport>prompt</ErrorReport>
     42  </PropertyGroup>
     43  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
     44    <OutputPath>bin\x64\Release\</OutputPath>
     45    <DefineConstants>TRACE</DefineConstants>
     46    <Optimize>true</Optimize>
     47    <DebugType>pdbonly</DebugType>
     48    <PlatformTarget>x64</PlatformTarget>
     49    <ErrorReport>prompt</ErrorReport>
     50  </PropertyGroup>
     51  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     52    <DebugSymbols>true</DebugSymbols>
     53    <OutputPath>bin\x86\Debug\</OutputPath>
     54    <DefineConstants>DEBUG;TRACE</DefineConstants>
     55    <DebugType>full</DebugType>
     56    <PlatformTarget>x86</PlatformTarget>
     57    <ErrorReport>prompt</ErrorReport>
     58  </PropertyGroup>
     59  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     60    <OutputPath>bin\x86\Release\</OutputPath>
     61    <DefineConstants>TRACE</DefineConstants>
     62    <Optimize>true</Optimize>
     63    <DebugType>pdbonly</DebugType>
     64    <PlatformTarget>x86</PlatformTarget>
     65    <ErrorReport>prompt</ErrorReport>
     66  </PropertyGroup>
    3567  <ItemGroup>
    3668    <Reference Include="System" />
     
    3870      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    3971    </Reference>
     72    <Reference Include="System.Drawing" />
     73    <Reference Include="System.Windows.Forms" />
    4074    <Reference Include="System.Xml.Linq">
    4175      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     
    4882  </ItemGroup>
    4983  <ItemGroup>
     84    <Compile Include="DockingMainForm.cs">
     85      <SubType>Form</SubType>
     86    </Compile>
     87    <Compile Include="DockingMainForm.Designer.cs">
     88      <DependentUpon>DockingMainForm.cs</DependentUpon>
     89    </Compile>
     90    <Compile Include="MainFormBase.cs">
     91      <SubType>Form</SubType>
     92    </Compile>
     93    <Compile Include="MainFormBase.Designer.cs">
     94      <DependentUpon>MainFormBase.cs</DependentUpon>
     95    </Compile>
     96    <Compile Include="HeuristicLabMainFormPlugin.cs" />
     97    <Compile Include="Interfaces\IAction.cs" />
     98    <Compile Include="Interfaces\IMainForm.cs" />
     99    <Compile Include="Interfaces\IMenuItem.cs" />
     100    <Compile Include="Interfaces\IModel.cs" />
     101    <Compile Include="Interfaces\IToolStripItem.cs" />
     102    <Compile Include="Interfaces\IUserInterfaceItem.cs" />
     103    <Compile Include="Interfaces\IView.cs" />
    50104    <Compile Include="Properties\AssemblyInfo.cs" />
     105    <Compile Include="ViewBase.cs">
     106      <SubType>UserControl</SubType>
     107    </Compile>
     108    <Compile Include="ViewBase.Designer.cs">
     109      <DependentUpon>ViewBase.cs</DependentUpon>
     110    </Compile>
     111    <Compile Include="DockForm.cs">
     112      <SubType>Form</SubType>
     113    </Compile>
     114    <Compile Include="DockForm.Designer.cs">
     115      <DependentUpon>DockForm.cs</DependentUpon>
     116    </Compile>
    51117  </ItemGroup>
    52118  <ItemGroup>
     
    55121      <Name>HeuristicLab.PluginInfrastructure</Name>
    56122    </ProjectReference>
     123    <ProjectReference Include="..\..\WinFormsUI\WinFormsUI.csproj">
     124      <Project>{C75532C4-765B-418E-B09B-46D36B2ABDB1}</Project>
     125      <Name>WinFormsUI</Name>
     126    </ProjectReference>
    57127  </ItemGroup>
    58128  <ItemGroup>
    59129    <None Include="HeuristicLab.snk" />
    60130    <None Include="Properties\AssemblyInfo.frame" />
     131  </ItemGroup>
     132  <ItemGroup>
     133    <EmbeddedResource Include="MainFormBase.resx">
     134      <DependentUpon>MainFormBase.cs</DependentUpon>
     135    </EmbeddedResource>
     136    <EmbeddedResource Include="DockForm.resx">
     137      <DependentUpon>DockForm.cs</DependentUpon>
     138      <SubType>Designer</SubType>
     139    </EmbeddedResource>
    61140  </ItemGroup>
    62141  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLabMainFormPlugin.cs

    r2231 r2233  
    2828  [ClassInfo(Name = "HeuristicLab.MainForm-3.2")]
    2929  [PluginFile(Filename = "HeuristicLab.MainForm-3.2.dll", Filetype = PluginFileType.Assembly)]
     30  [PluginFile(Filename = "HeuristicLab.MainForm.Docking-3.2.dll", Filetype = PluginFileType.Assembly)]
     31  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
    3032  public class HeuristicLabMainFormPlugin : PluginBase {
    3133  }
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IView.cs

    r2229 r2233  
    2323using System.Collections.Generic;
    2424using System.Text;
    25 using HeuristicLab.PluginInfrastructure;
    2625
    27 namespace HeuristicLab.Core {
    28   /// <summary>
    29   /// An interface for all kinds visual representations of items (objects, operators...).
    30   /// </summary>
    31   public interface IView : IControl {
    32     /// <summary>
    33     /// Gets the current item instance.
    34     /// </summary>
    35     IItem Item { get; }
    36     /// <summary>
    37     /// Gets or sets the caption of the current instance.
    38     /// </summary>
     26namespace HeuristicLab.MainForm {
     27  public interface IView {
    3928    string Caption { get; set; }
    40 
    41     /// <summary>
    42     /// Occurs when the item was changed.
    43     /// </summary>
    44     event EventHandler ItemChanged;
    45     /// <summary>
    46     /// Occurs when the caption was changed.
    47     /// </summary>
    4829    event EventHandler CaptionChanged;
     30    IMainForm MainForm { get; set; }
    4931  }
    5032}
  • trunk/sources/HeuristicLab.MainForm/3.2/ViewBase.cs

    r2229 r2233  
    2929using System.Windows.Forms;
    3030
    31 namespace HeuristicLab.Core {
    32   /// <summary>
    33   /// Base class for all visual representations.
    34   /// </summary>
    35   public partial class ViewBase : UserControl, IView {
    36     private IItem myItem;
    37     /// <summary>
    38     /// Gets or sets the item to represent visually.
    39     /// </summary>
    40     /// <remarks>Calls <see cref="OnItemChanged"/>, <see cref="Refresh"/>,
    41     /// <see cref="RemoveItemEvents"/> (if the current item is not null) and
    42     /// <see cref="AddItemEvents"/> (if the new item is not null) in the setter.</remarks>
    43     public IItem Item {
    44       get { return myItem; }
    45       protected set {
    46         if (value != myItem) {
    47           if (myItem != null)
    48             RemoveItemEvents();
    49           myItem = value;
    50           if (myItem != null)
    51             AddItemEvents();
    52           OnItemChanged();
    53           Refresh();
    54         }
    55       }
     31namespace HeuristicLab.MainForm {
     32  public partial class ViewBase : UserControl {
     33    public ViewBase() {
     34      InitializeComponent();
    5635    }
     36
     37    public ViewBase(IMainForm mainForm)
     38      : this() {
     39      this.mainForm = mainForm;
     40    }
     41
    5742    private string myCaption;
    58     /// <summary>
    59     /// Gets or sets the caption of the current instance.
    60     /// </summary>
    61     /// <remarks>Call <see cref="OnCaptionChanged"/> in the setter if a new item is set.</remarks>
    6243    public string Caption {
    6344      get { return myCaption; }
     
    7051    }
    7152
    72     /// <summary>
    73     /// Initializes a new instance of <see cref="ViewBase"/> with the caption "View".
    74     /// </summary>
    75     public ViewBase() {
    76       InitializeComponent();
    77       Caption = "View";
    78     }
    79 
    80     /// <summary>
    81     /// Removes the eventhandlers from the current instance.
    82     /// </summary>
    83     protected virtual void RemoveItemEvents() { }
    84     /// <summary>
    85     /// Adds eventhandlers to the current instance.
    86     /// </summary>
    87     protected virtual void AddItemEvents() { }
    88 
    89     /// <summary>
    90     /// Refreshes the current view.
    91     /// </summary>
    92     /// <remarks>Creates a new <see cref="MethodInvoker"/> if an invoke is required
    93     /// (see <see cref="Control.InvokeRequired"/>.<br/>
    94     /// Otherwise calls <see cref="UpdateControls"/> and <see cref="Control.Refresh"/> of base class
    95     /// <see cref="System.Windows.Forms.UserControl"/>.</remarks>
    96     public override void Refresh() {
    97       if (InvokeRequired) {
    98         Invoke(new MethodInvoker(Refresh));
    99       } else {
    100         UpdateControls();
    101         base.Refresh();
    102       }
    103     }
    104     /// <summary>
    105     /// Updates the controls with the latest values of the model.
    106     /// </summary>
    107     protected virtual void UpdateControls() {
    108       if (Item == null)
    109         Caption = "View";
    110       else
    111         Caption = "View (" + Item.GetType().Name + ")";
    112      
    113     }
    114 
    115     /// <summary>
    116     /// Occurs when the current item was changed.
    117     /// </summary>
    118     public event EventHandler ItemChanged;
    119     /// <summary>
    120     /// Fires a new <c>ItemChanged</c> event.
    121     /// </summary>
    122     protected virtual void OnItemChanged() {
    123       if (ItemChanged != null)
    124         ItemChanged(this, new EventArgs());
    125     }
    126     /// <summary>
    127     /// Occurs when the current caption was changed.
    128     /// </summary>
    12953    public event EventHandler CaptionChanged;
    130     /// <summary>
    131     /// Fires a new <c>CaptionChanged</c> event.
    132     /// </summary>
    13354    protected virtual void OnCaptionChanged() {
    13455      if (CaptionChanged != null)
     
    13657    }
    13758
    138     /// <summary>
    139     /// Asynchron call of GUI updating.
    140     /// </summary>
    141     /// <param name="method">The delegate to invoke.</param>
    142     protected new void Invoke(Delegate method) {
    143       // enforce context switch to improve GUI response time
    144       System.Threading.Thread.Sleep(0);
     59    private IMainForm mainForm;
     60    public IMainForm MainForm {
     61      get { return this.mainForm; }
     62      set { this.mainForm = value; }
     63    }
    14564
    146       // prevent blocking of worker thread in Invoke, if the control is disposed
    147       IAsyncResult result = BeginInvoke(method);
    148       while ((!result.AsyncWaitHandle.WaitOne(100, false)) && (!IsDisposed)) { }
    149       if (!IsDisposed) EndInvoke(result);
    150     }
    151     /// <summary>
    152     /// Asynchron call of GUI updating.
    153     /// </summary>
    154     /// <param name="method">The delegate to invoke.</param>
    155     /// <param name="args">The invoke arguments.</param>
    156     protected new void Invoke(Delegate method, params object[] args) {
    157       // enforce context switch to improve GUI response time
    158       System.Threading.Thread.Sleep(0);
    159 
    160       // prevent blocking of worker thread in Invoke, if the control is disposed
    161       IAsyncResult result = BeginInvoke(method, args);
    162       while ((!result.AsyncWaitHandle.WaitOne(100, false)) && (!IsDisposed)) { }
    163       if (!IsDisposed) EndInvoke(result);
    164     }
    16565  }
    16666}
  • trunk/sources/HeuristicLab.sln

    r2223 r2233  
    245245EndProject
    246246Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.GP.Operators-3.3", "HeuristicLab.GP.Operators\3.3\HeuristicLab.GP.Operators-3.3.csproj", "{45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A}"
     247EndProject
     248Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MainForm", "HeuristicLab.MainForm\3.2\HeuristicLab.MainForm.csproj", "{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}"
    247249EndProject
    248250Global
     
    39483950    {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU
    39493951    {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU
     3952    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|Any CPU.ActiveCfg = Debug|Any CPU
     3953    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
     3954    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
     3955    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3956    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     3957    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|Any CPU.Build.0 = Debug|Any CPU
     3958    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|x64.ActiveCfg = Debug|x64
     3959    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|x64.Build.0 = Debug|x64
     3960    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|x86.ActiveCfg = Debug|x86
     3961    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|x86.Build.0 = Debug|x86
     3962    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Modeling Debug|Any CPU.ActiveCfg = Debug|Any CPU
     3963    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Modeling Debug|Any CPU.Build.0 = Debug|Any CPU
     3964    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Modeling Debug|x64.ActiveCfg = Debug|Any CPU
     3965    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Modeling Debug|x86.ActiveCfg = Debug|Any CPU
     3966    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|Any CPU.ActiveCfg = Release|Any CPU
     3967    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|Any CPU.Build.0 = Release|Any CPU
     3968    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|x64.ActiveCfg = Release|x64
     3969    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|x64.Build.0 = Release|x64
     3970    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|x86.ActiveCfg = Release|x86
     3971    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Release|x86.Build.0 = Release|x86
     3972    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.v3.2 Debug|Any CPU.ActiveCfg = Debug|Any CPU
     3973    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.v3.2 Debug|Any CPU.Build.0 = Debug|Any CPU
     3974    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.v3.2 Debug|x64.ActiveCfg = Debug|Any CPU
     3975    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.v3.2 Debug|x86.ActiveCfg = Debug|Any CPU
     3976    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|Any CPU.ActiveCfg = Debug|Any CPU
     3977    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|Any CPU.Build.0 = Debug|Any CPU
     3978    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU
     3979    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU
    39503980  EndGlobalSection
    39513981  GlobalSection(SolutionProperties) = preSolution
     
    40394069    {924B6BEA-9A99-40FE-9334-5C01E8D540EC} = {410732DB-725A-4824-896B-C298978343C0}
    40404070    {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A} = {410732DB-725A-4824-896B-C298978343C0}
     4071    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A} = {410732DB-725A-4824-896B-C298978343C0}
    40414072    {A9E282EA-180F-4233-B809-AEDF0787545C} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
    40424073    {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
Note: See TracChangeset for help on using the changeset viewer.