Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/09 11:08:34 (15 years ago)
Author:
swagner
Message:

Implemented first draft of MainForm support in HeuristicLab.Core/HeuristicLab.Core.Views and all other depending plugins (#770)

Location:
trunk/sources/HeuristicLab.Core/3.3
Files:
4 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Auxiliary.cs

    r1529 r2520  
    2323using System.Collections.Generic;
    2424using System.Text;
    25 using System.Windows.Forms;
    2625
    2726namespace HeuristicLab.Core {
     
    4645    }
    4746    #endregion
    48 
    49     #region Error Messages
    50     /// <summary>
    51     /// Shows an error message box with a given error <paramref name="message"/> and an OK-Button.
    52     /// </summary>
    53     /// <param name="message">The error message to display.</param>
    54     public static void ShowErrorMessageBox(string message) {
    55       MessageBox.Show(message,
    56                       "Error",
    57                       MessageBoxButtons.OK,
    58                       MessageBoxIcon.Error);
    59     }
    60     /// <summary>
    61     /// Shows an error message box with a given exception <paramref name="ex"/> and an OK-Button.
    62     /// </summary>
    63     /// <param name="ex">The exception to display.</param>
    64     public static void ShowErrorMessageBox(Exception ex) {
    65       MessageBox.Show(BuildErrorMessage(ex),
    66                       "Error - " + ex.GetType().Name,
    67                       MessageBoxButtons.OK,
    68                       MessageBoxIcon.Error);
    69     }
    70     /// <summary>
    71     /// Builds an error message out of an exception and formats it accordingly.
    72     /// </summary>
    73     /// <param name="ex">The exception to format.</param>
    74     /// <returns>The formated message.</returns>
    75     private static string BuildErrorMessage(Exception ex) {
    76       StringBuilder sb = new StringBuilder();
    77       sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace);
    78 
    79       while (ex.InnerException != null) {
    80         ex = ex.InnerException;
    81         sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace);
    82       }
    83       return sb.ToString();
    84     }
    85     #endregion
    86 
    87     #region Constraint Violation Messages
    88     /// <summary>
    89     /// Shows a warning message box with an OK-Button, indicating that the given constraints were violated and so
    90     /// the operation could not be completed.
    91     /// </summary>
    92     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    93     public static void ShowConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {
    94       string message = BuildConstraintViolationMessage(violatedConstraints);
    95       MessageBox.Show("The following constraints are violated. The operation could not be completed.\n\n" + message,
    96                       "Constraint Violation",
    97                       MessageBoxButtons.OK,
    98                       MessageBoxIcon.Warning);
    99     }
    100     /// <summary>
    101     /// Shows a question message box with a yes-no option, where to choose whether to ignore
    102     /// the given violated constraints and to complete the operation or not.
    103     /// </summary>
    104     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    105     /// <returns>The result of the choice ("Yes" = 6, "No" = 7).</returns>
    106     public static DialogResult ShowIgnoreConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {
    107       string message = BuildConstraintViolationMessage(violatedConstraints);
    108       return MessageBox.Show("The following constraints are violated. Do you want to complete the operation anyhow?\n\n" + message,
    109                              "Constraint Violation",
    110                              MessageBoxButtons.YesNo,
    111                              MessageBoxIcon.Question);
    112     }
    113     /// <summary>
    114     /// Builds a message out of a given collection of violated constraints,
    115     /// including the constraints type and description.
    116     /// </summary>
    117     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    118     /// <returns>The message to display.</returns>
    119     private static string BuildConstraintViolationMessage(ICollection<IConstraint> violatedConstraints) {
    120       StringBuilder sb = new StringBuilder();
    121       foreach (IConstraint constraint in violatedConstraints) {
    122         sb.AppendLine(constraint.GetType().Name);
    123         sb.AppendLine(constraint.Description);
    124         sb.AppendLine();
    125       }
    126       return sb.ToString();
    127     }
    128     #endregion
    12947  }
    13048}
  • trunk/sources/HeuristicLab.Core/3.3/ConstrainedItemBase.cs

    r2474 r2520  
    116116
    117117    /// <summary>
    118     /// Creates an instance of <see cref="ConstrainedItemBaseView"/>
    119     /// to represent the current instance visually.
    120     /// </summary>
    121     /// <returns>The created view as <see cref="ConstrainedItemBaseView"/>.</returns>
    122     public override IView CreateView() {
    123       return new ConstrainedItemBaseView(this);
    124     }
    125 
    126     /// <summary>
    127118    /// Occurs when a constraint is added.
    128119    /// </summary>
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r2474 r2520  
    9595    </Reference>
    9696    <Reference Include="System.Data" />
    97     <Reference Include="System.Drawing" />
    98     <Reference Include="System.Windows.Forms" />
    9997    <Reference Include="System.Xml" />
    10098  </ItemGroup>
    10199  <ItemGroup>
    102100    <Compile Include="Auxiliary.cs" />
    103     <Compile Include="ChooseItemDialog.cs">
    104       <SubType>Form</SubType>
    105     </Compile>
    106     <Compile Include="ChooseItemDialog.Designer.cs">
    107       <DependentUpon>ChooseItemDialog.cs</DependentUpon>
    108     </Compile>
    109     <Compile Include="ChooseOperatorDialog.cs">
    110       <SubType>Form</SubType>
    111     </Compile>
    112     <Compile Include="ChooseOperatorDialog.Designer.cs">
    113       <DependentUpon>ChooseOperatorDialog.cs</DependentUpon>
    114     </Compile>
    115101    <Compile Include="ConstrainedItemBase.cs" />
    116     <Compile Include="ConstrainedItemBaseView.cs">
    117       <SubType>UserControl</SubType>
    118     </Compile>
    119     <Compile Include="ConstrainedItemBaseView.Designer.cs">
    120       <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon>
    121     </Compile>
    122102    <Compile Include="AtomicOperation.cs" />
    123103    <Compile Include="CompositeOperation.cs" />
    124     <Compile Include="ChooseTypeDialog.cs">
    125       <SubType>Form</SubType>
    126     </Compile>
    127     <Compile Include="ChooseTypeDialog.Designer.cs">
    128       <DependentUpon>ChooseTypeDialog.cs</DependentUpon>
    129     </Compile>
    130     <Compile Include="OperatorBaseDescriptionView.cs">
    131       <SubType>UserControl</SubType>
    132     </Compile>
    133     <Compile Include="OperatorBaseDescriptionView.Designer.cs">
    134       <DependentUpon>OperatorBaseDescriptionView.cs</DependentUpon>
    135     </Compile>
     104    <Compile Include="Interfaces\IEditable.cs" />
    136105    <Compile Include="Interfaces\IOperation.cs" />
    137106    <Compile Include="Interfaces\IOperatorLibrary.cs" />
    138107    <Compile Include="Interfaces\IVisualizationItem.cs" />
    139     <Compile Include="OperatorBaseVariablesView.cs">
    140       <SubType>UserControl</SubType>
    141     </Compile>
    142     <Compile Include="OperatorBaseVariablesView.Designer.cs">
    143       <DependentUpon>OperatorBaseVariablesView.cs</DependentUpon>
    144     </Compile>
    145     <Compile Include="OperatorBaseVariableInfosView.cs">
    146       <SubType>UserControl</SubType>
    147     </Compile>
    148     <Compile Include="OperatorBaseVariableInfosView.Designer.cs">
    149       <DependentUpon>OperatorBaseVariableInfosView.cs</DependentUpon>
    150     </Compile>
    151108    <Compile Include="Interfaces\IConstrainedItem.cs" />
    152109    <Compile Include="Interfaces\IConstraint.cs" />
    153110    <Compile Include="Interfaces\IItem.cs" />
    154111    <Compile Include="ItemBase.cs" />
    155     <Compile Include="ItemBaseView.cs">
    156       <SubType>UserControl</SubType>
    157     </Compile>
    158     <Compile Include="ItemBaseView.Designer.cs">
    159       <DependentUpon>ItemBaseView.cs</DependentUpon>
    160     </Compile>
    161112    <Compile Include="OperatorLibrary.cs" />
    162     <Compile Include="OperatorLibraryEditor.cs">
    163       <SubType>UserControl</SubType>
    164     </Compile>
    165     <Compile Include="OperatorLibraryEditor.Designer.cs">
    166       <DependentUpon>OperatorLibraryEditor.cs</DependentUpon>
    167     </Compile>
    168     <Compile Include="Properties\Resources.Designer.cs">
    169       <AutoGen>True</AutoGen>
    170       <DesignTime>True</DesignTime>
    171       <DependentUpon>Resources.resx</DependentUpon>
    172     </Compile>
    173     <Compile Include="EngineBaseEditor.cs">
    174       <SubType>UserControl</SubType>
    175     </Compile>
    176     <Compile Include="EngineBaseEditor.Designer.cs">
    177       <DependentUpon>EngineBaseEditor.cs</DependentUpon>
    178     </Compile>
    179113    <Compile Include="Interfaces\IOperatorGroup.cs" />
    180114    <Compile Include="Interfaces\IOperatorGraph.cs" />
     
    185119      <SubType>Code</SubType>
    186120    </Compile>
    187     <Compile Include="OperatorBaseView.cs">
    188       <SubType>UserControl</SubType>
    189     </Compile>
    190     <Compile Include="OperatorBaseView.Designer.cs">
    191       <DependentUpon>OperatorBaseView.cs</DependentUpon>
    192     </Compile>
    193     <Compile Include="OperatorGraphView.cs">
    194       <SubType>UserControl</SubType>
    195     </Compile>
    196     <Compile Include="OperatorGraphView.Designer.cs">
    197       <DependentUpon>OperatorGraphView.cs</DependentUpon>
    198     </Compile>
    199     <Compile Include="ScopeView.cs">
    200       <SubType>UserControl</SubType>
    201     </Compile>
    202     <Compile Include="ScopeView.Designer.cs">
    203       <DependentUpon>ScopeView.cs</DependentUpon>
    204     </Compile>
    205     <Compile Include="VariableInfoView.cs">
    206       <SubType>UserControl</SubType>
    207     </Compile>
    208     <Compile Include="VariableInfoView.Designer.cs">
    209       <DependentUpon>VariableInfoView.cs</DependentUpon>
    210     </Compile>
    211     <Compile Include="VariableView.cs">
    212       <SubType>UserControl</SubType>
    213     </Compile>
    214     <Compile Include="VariableView.Designer.cs">
    215       <DependentUpon>VariableView.cs</DependentUpon>
    216     </Compile>
    217     <Compile Include="ViewBase.cs">
    218       <SubType>UserControl</SubType>
    219     </Compile>
    220     <Compile Include="ViewBase.Designer.cs">
    221       <DependentUpon>ViewBase.cs</DependentUpon>
    222     </Compile>
    223     <Compile Include="Interfaces\IViewable.cs" />
    224     <Compile Include="Interfaces\IView.cs" />
    225     <Compile Include="EditorBase.cs">
    226       <SubType>UserControl</SubType>
    227     </Compile>
    228     <Compile Include="EditorBase.Designer.cs">
    229       <DependentUpon>EditorBase.cs</DependentUpon>
    230     </Compile>
    231     <Compile Include="Interfaces\IEditable.cs" />
    232     <Compile Include="Interfaces\IEditor.cs" />
    233121    <Compile Include="OperatorBase.cs" />
    234122    <Compile Include="Interfaces\IRandom.cs" />
     
    246134    <Compile Include="VariableInfo.cs" />
    247135    <Compile Include="VariableKind.cs" />
    248     <Compile Include="VariablesScopeView.cs">
    249       <SubType>UserControl</SubType>
    250     </Compile>
    251     <Compile Include="VariablesScopeView.Designer.cs">
    252       <DependentUpon>VariablesScopeView.cs</DependentUpon>
    253     </Compile>
    254136  </ItemGroup>
    255137  <ItemGroup>
     
    270152      <Name>HeuristicLab.PluginInfrastructure</Name>
    271153    </ProjectReference>
    272   </ItemGroup>
    273   <ItemGroup>
    274     <EmbeddedResource Include="ChooseItemDialog.resx">
    275       <DependentUpon>ChooseItemDialog.cs</DependentUpon>
    276       <SubType>Designer</SubType>
    277     </EmbeddedResource>
    278     <EmbeddedResource Include="ChooseOperatorDialog.resx">
    279       <DependentUpon>ChooseOperatorDialog.cs</DependentUpon>
    280       <SubType>Designer</SubType>
    281     </EmbeddedResource>
    282     <EmbeddedResource Include="ConstrainedItemBaseView.resx">
    283       <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon>
    284       <SubType>Designer</SubType>
    285     </EmbeddedResource>
    286     <EmbeddedResource Include="ChooseTypeDialog.resx">
    287       <DependentUpon>ChooseTypeDialog.cs</DependentUpon>
    288       <SubType>Designer</SubType>
    289     </EmbeddedResource>
    290     <EmbeddedResource Include="OperatorBaseDescriptionView.resx">
    291       <DependentUpon>OperatorBaseDescriptionView.cs</DependentUpon>
    292       <SubType>Designer</SubType>
    293     </EmbeddedResource>
    294     <EmbeddedResource Include="OperatorBaseVariablesView.resx">
    295       <DependentUpon>OperatorBaseVariablesView.cs</DependentUpon>
    296       <SubType>Designer</SubType>
    297     </EmbeddedResource>
    298     <EmbeddedResource Include="OperatorBaseVariableInfosView.resx">
    299       <DependentUpon>OperatorBaseVariableInfosView.cs</DependentUpon>
    300       <SubType>Designer</SubType>
    301     </EmbeddedResource>
    302     <EmbeddedResource Include="EditorBase.resx">
    303       <SubType>Designer</SubType>
    304       <DependentUpon>EditorBase.cs</DependentUpon>
    305     </EmbeddedResource>
    306     <EmbeddedResource Include="ItemBaseView.resx">
    307       <DependentUpon>ItemBaseView.cs</DependentUpon>
    308       <SubType>Designer</SubType>
    309     </EmbeddedResource>
    310     <EmbeddedResource Include="OperatorBaseView.resx">
    311       <DependentUpon>OperatorBaseView.cs</DependentUpon>
    312       <SubType>Designer</SubType>
    313     </EmbeddedResource>
    314     <EmbeddedResource Include="OperatorGraphView.resx">
    315       <DependentUpon>OperatorGraphView.cs</DependentUpon>
    316       <SubType>Designer</SubType>
    317     </EmbeddedResource>
    318     <EmbeddedResource Include="OperatorLibraryEditor.resx">
    319       <DependentUpon>OperatorLibraryEditor.cs</DependentUpon>
    320       <SubType>Designer</SubType>
    321     </EmbeddedResource>
    322     <EmbeddedResource Include="Properties\Resources.resx">
    323       <SubType>Designer</SubType>
    324       <Generator>ResXFileCodeGenerator</Generator>
    325       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    326     </EmbeddedResource>
    327     <EmbeddedResource Include="ScopeView.resx">
    328       <DependentUpon>ScopeView.cs</DependentUpon>
    329       <SubType>Designer</SubType>
    330     </EmbeddedResource>
    331     <EmbeddedResource Include="EngineBaseEditor.resx">
    332       <DependentUpon>EngineBaseEditor.cs</DependentUpon>
    333       <SubType>Designer</SubType>
    334     </EmbeddedResource>
    335     <EmbeddedResource Include="VariableInfoView.resx">
    336       <DependentUpon>VariableInfoView.cs</DependentUpon>
    337       <SubType>Designer</SubType>
    338     </EmbeddedResource>
    339     <EmbeddedResource Include="VariablesScopeView.resx">
    340       <DependentUpon>VariablesScopeView.cs</DependentUpon>
    341       <SubType>Designer</SubType>
    342     </EmbeddedResource>
    343     <EmbeddedResource Include="VariableView.resx">
    344       <DependentUpon>VariableView.cs</DependentUpon>
    345       <SubType>Designer</SubType>
    346     </EmbeddedResource>
    347   </ItemGroup>
    348   <ItemGroup>
    349     <Content Include="Resources\CombinedOperator.bmp" />
    350     <Content Include="Resources\HeuristicLab.ico" />
    351     <Content Include="Resources\Operator.bmp" />
    352     <Content Include="Resources\ProgrammableOperator.bmp" />
    353154  </ItemGroup>
    354155  <ItemGroup>
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLabCorePlugin.cs

    r2474 r2520  
    2323using System.Collections.Generic;
    2424using System.Text;
    25 using System.Windows.Forms;
    2625using HeuristicLab.PluginInfrastructure;
    2726
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IItem.cs

    r776 r2520  
    2828  /// Interface to represent (almost) every HeuristicLab object (an object, an operator,...).
    2929  /// </summary>
    30   public interface IItem : IStorable, IViewable {
     30  public interface IItem : IStorable {
    3131    /// <summary>
    3232    /// Fires a new <c>Changed</c> event.
  • trunk/sources/HeuristicLab.Core/3.3/ItemBase.cs

    r1853 r2520  
    3333  public abstract class ItemBase : StorableBase, IItem {
    3434    /// <summary>
    35     /// Creates a new instance of <see cref="ItemBaseView"/> for
    36     /// visual representation of the current instance.
    37     /// </summary>
    38     /// <returns>The created instance as <see cref="ItemBaseView"/>.</returns>
    39     public virtual IView CreateView() {
    40       return new ItemBaseView(this);
    41     }
    42 
    43     /// <summary>
    4435    /// Gets the string representation of the current instance.
    4536    /// </summary>
  • trunk/sources/HeuristicLab.Core/3.3/OperatorBase.cs

    r2474 r2520  
    146146    }
    147147
    148     /// <summary>
    149     /// Creates a new instance of <see cref="OperatorBaseView"/> to represent the current operator
    150     /// visually.
    151     /// </summary>
    152     /// <returns>The created view as <see cref="OperatorBaseView"/>.</returns>
    153     public override IView CreateView() {
    154       return new OperatorBaseView(this);
    155     }
    156 
    157148    #region SubOperator Methods
    158149    /// <inheritdoc cref="HeuristicLab.Core.IOperator.AddSubOperator(HeuristicLab.Core.IOperator)"/>
  • trunk/sources/HeuristicLab.Core/3.3/OperatorGraph.cs

    r2474 r2520  
    6363    public OperatorGraph() {
    6464      myOperators = new Dictionary<Guid, IOperator>();
    65     }
    66 
    67     /// <summary>
    68     /// Creates a new instance of <see cref="OperatorGraphView"/> to represent the current instance
    69     /// visually.
    70     /// </summary>
    71     /// <returns>The created view as <see cref="OperatorGraphView"/>.</returns>
    72     public override IView CreateView() {
    73       return new OperatorGraphView(this);
    7465    }
    7566
  • trunk/sources/HeuristicLab.Core/3.3/OperatorLibrary.cs

    r1823 r2520  
    3030  /// Represents a library of operators consisting of one <see cref="IOperatorGroup"/>.
    3131  /// </summary>
    32   public class OperatorLibrary : ItemBase, IOperatorLibrary, IEditable {
     32  public class OperatorLibrary : ItemBase, IOperatorLibrary {
    3333
    3434    [Storable]
     
    4949
    5050    /// <summary>
    51     /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance.
    52     /// </summary>
    53     /// <returns>The created view as <see cref="OperatorLibraryEditor"/>.</returns>
    54     public override IView CreateView() {
    55       return new OperatorLibraryEditor(this);
    56     }
    57     /// <summary>
    58     /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance.
    59     /// </summary>
    60     /// <returns>The created editor as <see cref="OperatorLibraryEditor"/>.</returns>
    61     public virtual IEditor CreateEditor() {
    62       return new OperatorLibraryEditor(this);
    63     }
    64 
    65     /// <summary>
    6651    /// Clones the current instance (deep clone).
    6752    /// </summary>
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r2474 r2520  
    102102    }
    103103
    104     /// <summary>
    105     /// Creates a new instance of <see cref="ScopeView"/> to represent the current instance visually.
    106     /// </summary>
    107     /// <returns>The created view as <see cref="ScopeView"/>.</returns>
    108     public override IView CreateView() {
    109       return new ScopeView(this);
    110     }
    111 
    112104    /// <inheritdoc/>
    113105    public IVariable GetVariable(string name) {
  • trunk/sources/HeuristicLab.Core/3.3/Variable.cs

    r2474 r2520  
    9191
    9292    /// <summary>
    93     /// Creates a new instance of <see cref="VariableView"/> to represent the current instance visually.
    94     /// </summary>
    95     /// <returns>The created view as <see cref="VariableView"/>.</returns>
    96     public override IView CreateView() {
    97       return new VariableView(this);
    98     }
    99 
    100     /// <summary>
    10193    /// Clones the current instance (deep clone).
    10294    /// </summary>
  • trunk/sources/HeuristicLab.Core/3.3/VariableInfo.cs

    r1823 r2520  
    132132
    133133    /// <summary>
    134     /// Creates a new instance of <see cref="VariableInfoView"/> to represent the current instance
    135     /// visually.
    136     /// </summary>
    137     /// <returns>The created view as <see cref="VariableInfoView"/>.</returns>
    138     public override IView CreateView() {
    139       return new VariableInfoView(this);
    140     }
    141 
    142     /// <summary>
    143134    /// Clones the current instance (deep clone).
    144135    /// </summary>
Note: See TracChangeset for help on using the changeset viewer.