Changeset 2233
- Timestamp:
- 08/04/09 16:52:49 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 15 added
- 3 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.2/DockForm.cs
r2229 r2233 28 28 using System.Windows.Forms; 29 29 using WeifenLuo.WinFormsUI.Docking; 30 using HeuristicLab.Core;31 30 32 namespace HeuristicLab. AdvancedOptimizationFrontend{31 namespace HeuristicLab.MainForm { 33 32 /// <summary> 34 33 /// Displays the used view. 35 34 /// </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) { 49 37 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; 59 39 if (View != null) { 60 40 Control control = (Control)View; … … 71 51 viewPanel.Controls.Add(errorLabel); 72 52 } 53 } 54 55 private IView view; 56 public IView View { 57 get { return view; } 73 58 } 74 59 -
trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLab.MainForm.csproj
r2231 r2233 33 33 <WarningLevel>4</WarningLevel> 34 34 </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> 35 67 <ItemGroup> 36 68 <Reference Include="System" /> … … 38 70 <RequiredTargetFramework>3.5</RequiredTargetFramework> 39 71 </Reference> 72 <Reference Include="System.Drawing" /> 73 <Reference Include="System.Windows.Forms" /> 40 74 <Reference Include="System.Xml.Linq"> 41 75 <RequiredTargetFramework>3.5</RequiredTargetFramework> … … 48 82 </ItemGroup> 49 83 <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" /> 50 104 <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> 51 117 </ItemGroup> 52 118 <ItemGroup> … … 55 121 <Name>HeuristicLab.PluginInfrastructure</Name> 56 122 </ProjectReference> 123 <ProjectReference Include="..\..\WinFormsUI\WinFormsUI.csproj"> 124 <Project>{C75532C4-765B-418E-B09B-46D36B2ABDB1}</Project> 125 <Name>WinFormsUI</Name> 126 </ProjectReference> 57 127 </ItemGroup> 58 128 <ItemGroup> 59 129 <None Include="HeuristicLab.snk" /> 60 130 <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> 61 140 </ItemGroup> 62 141 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLabMainFormPlugin.cs
r2231 r2233 28 28 [ClassInfo(Name = "HeuristicLab.MainForm-3.2")] 29 29 [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")] 30 32 public class HeuristicLabMainFormPlugin : PluginBase { 31 33 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IView.cs
r2229 r2233 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using HeuristicLab.PluginInfrastructure;26 25 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> 26 namespace HeuristicLab.MainForm { 27 public interface IView { 39 28 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>48 29 event EventHandler CaptionChanged; 30 IMainForm MainForm { get; set; } 49 31 } 50 32 } -
trunk/sources/HeuristicLab.MainForm/3.2/ViewBase.cs
r2229 r2233 29 29 using System.Windows.Forms; 30 30 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 } 31 namespace HeuristicLab.MainForm { 32 public partial class ViewBase : UserControl { 33 public ViewBase() { 34 InitializeComponent(); 56 35 } 36 37 public ViewBase(IMainForm mainForm) 38 : this() { 39 this.mainForm = mainForm; 40 } 41 57 42 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>62 43 public string Caption { 63 44 get { return myCaption; } … … 70 51 } 71 52 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 required93 /// (see <see cref="Control.InvokeRequired"/>.<br/>94 /// Otherwise calls <see cref="UpdateControls"/> and <see cref="Control.Refresh"/> of base class95 /// <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 else111 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>129 53 public event EventHandler CaptionChanged; 130 /// <summary>131 /// Fires a new <c>CaptionChanged</c> event.132 /// </summary>133 54 protected virtual void OnCaptionChanged() { 134 55 if (CaptionChanged != null) … … 136 57 } 137 58 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 } 145 64 146 // prevent blocking of worker thread in Invoke, if the control is disposed147 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 time158 System.Threading.Thread.Sleep(0);159 160 // prevent blocking of worker thread in Invoke, if the control is disposed161 IAsyncResult result = BeginInvoke(method, args);162 while ((!result.AsyncWaitHandle.WaitOne(100, false)) && (!IsDisposed)) { }163 if (!IsDisposed) EndInvoke(result);164 }165 65 } 166 66 } -
trunk/sources/HeuristicLab.sln
r2223 r2233 245 245 EndProject 246 246 Project("{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}" 247 EndProject 248 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MainForm", "HeuristicLab.MainForm\3.2\HeuristicLab.MainForm.csproj", "{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}" 247 249 EndProject 248 250 Global … … 3948 3950 {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU 3949 3951 {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 3950 3980 EndGlobalSection 3951 3981 GlobalSection(SolutionProperties) = preSolution … … 4039 4069 {924B6BEA-9A99-40FE-9334-5C01E8D540EC} = {410732DB-725A-4824-896B-C298978343C0} 4040 4070 {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A} = {410732DB-725A-4824-896B-C298978343C0} 4071 {3BD61258-31DA-4B09-89C0-4F71FEF5F05A} = {410732DB-725A-4824-896B-C298978343C0} 4041 4072 {A9E282EA-180F-4233-B809-AEDF0787545C} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B} 4042 4073 {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
Note: See TracChangeset
for help on using the changeset viewer.