Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4549


Ignore:
Timestamp:
10/04/10 04:17:26 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB/HeuristicLab.Clients.OKB-3.3
Files:
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/AdministratorMenuItem.cs

    r4548 r4549  
    3737
    3838    public override void Execute() {
    39       MainFormManager.MainForm.ShowContent(OKB.Instance);
     39      MainFormManager.MainForm.ShowContent(OKBClient.Instance);
    4040    }
    4141  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj

    r4548 r4549  
    7777  <ItemGroup>
    7878    <Compile Include="AdministratorMenuItem.cs" />
    79     <Compile Include="OKB.cs" />
     79    <Compile Include="OKBClient.cs" />
    8080    <Compile Include="OKBExperiment.cs" />
    8181    <Compile Include="HeuristicLabClientsOKBPlugin.cs" />
     
    204204    <None Include="HeuristicLabClientsOKBPlugin.cs.frame" />
    205205  </ItemGroup>
     206  <ItemGroup>
     207    <EmbeddedResource Include="Views\OKBExperimentView.resx">
     208      <DependentUpon>OKBExperimentView.cs</DependentUpon>
     209    </EmbeddedResource>
     210  </ItemGroup>
    206211  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    207212  <PropertyGroup>
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs

    r4548 r4549  
    3030
    3131namespace HeuristicLab.Clients.OKB {
    32   [Item("OKB", "OKB front-end.")]
    33   public sealed class OKB : IContent {
    34     private static OKB instance;
    35     public static OKB Instance {
     32  [Item("OKBClient", "Client for accessing the OKB.")]
     33  public sealed class OKBClient : IContent {
     34    private static OKBClient instance;
     35    public static OKBClient Instance {
    3636      get {
    37         if (instance == null) instance = new OKB();
     37        if (instance == null) instance = new OKBClient();
    3838        return instance;
    3939      }
     
    7171    #endregion
    7272
    73     private OKB() { }
     73    private OKBClient() {
     74      platforms = new ItemCollection<Platform>();
     75      platforms.ItemsRemoved += new CollectionItemsChangedEventHandler<Platform>(platforms_ItemsRemoved);
     76      dataTypes = new ItemCollection<DataType>();
     77      dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved);
     78      algorithmClasses = new ItemCollection<AlgorithmClass>();
     79      algorithmClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<AlgorithmClass>(algorithmClasses_ItemsRemoved);
     80      algorithms = new ItemCollection<Algorithm>();
     81      algorithms.ItemsRemoved += new CollectionItemsChangedEventHandler<Algorithm>(algorithms_ItemsRemoved);
     82      problemClasses = new ItemCollection<ProblemClass>();
     83      problemClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<ProblemClass>(problemClasses_ItemsRemoved);
     84      problems = new ItemCollection<Problem>();
     85      problems.ItemsRemoved += new CollectionItemsChangedEventHandler<Problem>(problems_ItemsRemoved);
     86    }
    7487
    7588    #region Refresh
    7689    public void Refresh() {
    7790      OnRefreshing();
    78       if (platforms == null) {
    79         platforms = new ItemCollection<Platform>();
    80         platforms.ItemsRemoved += new CollectionItemsChangedEventHandler<Platform>(platforms_ItemsRemoved);
    81       }
     91
    8292      platforms.Clear();
    83       if (dataTypes == null) {
    84         dataTypes = new ItemCollection<DataType>();
    85         dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved);
    86       }
    8793      dataTypes.Clear();
    88       if (algorithmClasses == null) {
    89         algorithmClasses = new ItemCollection<AlgorithmClass>();
    90         algorithmClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<AlgorithmClass>(algorithmClasses_ItemsRemoved);
    91       }
    9294      algorithmClasses.Clear();
    93       if (algorithms == null) {
    94         algorithms = new ItemCollection<Algorithm>();
    95         algorithms.ItemsRemoved += new CollectionItemsChangedEventHandler<Algorithm>(algorithms_ItemsRemoved);
    96       }
    9795      algorithms.Clear();
    98       if (problemClasses == null) {
    99         problemClasses = new ItemCollection<ProblemClass>();
    100         problemClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<ProblemClass>(problemClasses_ItemsRemoved);
    101       }
    10296      problemClasses.Clear();
    103       if (problems == null) {
    104         problems = new ItemCollection<Problem>();
    105         problems.ItemsRemoved += new CollectionItemsChangedEventHandler<Problem>(problems_ItemsRemoved);
    106       }
    10797      problems.Clear();
    10898
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs

    r4548 r4549  
    2020#endregion
    2121
     22using System;
     23using System.Drawing;
     24using System.IO;
     25using HeuristicLab.Common;
    2226using HeuristicLab.Core;
    2327using HeuristicLab.Optimization;
    24 using HeuristicLab.Common;
    25 using System.Drawing;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Persistence.Default.Xml;
    2630
    2731namespace HeuristicLab.Clients.OKB {
     32  [Item("OKB Experiment", "...")]
    2833  [Creatable("OKB")]
    29   [Item("OKB Experiment", "...")]
     34  [StorableClass]
    3035  public sealed class OKBExperiment : NamedItem, IOptimizer, IStorableContent {
    3136    public string Filename { get; set; }
     
    3338    public override Image ItemImage {
    3439      get {
    35         if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared;
    36         else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStarted;
    37         else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePaused;
    38         else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped;
     40        if (Algorithm != null) return Algorithm.ItemImage;
    3941        else return HeuristicLab.Common.Resources.VS2008ImageLibrary.Event;
    4042      }
    4143    }
    4244
    43     public override bool CanChangeName {
    44       get { return false; }
    45     }
    46     public override bool CanChangeDescription {
    47       get { return false; }
    48     }
    49 
     45    [Storable]
     46    private long AlgorithmId { get; set; }
     47    [Storable]
    5048    private IAlgorithm algorithm;
    5149    private IAlgorithm Algorithm {
    5250      get { return algorithm; }
    53       set { algorithm = value; }
    54     }
     51      set {
     52        DeregisterAlgorithmEvents();
     53        algorithm = value;
     54        RegisterAlgorithmEvents();
     55        algorithm.Problem = Problem;
     56        OnChanged();
     57      }
     58    }
     59    private long ProblemId { get; set; }
    5560    private IProblem problem;
    56     private IProblem Problem {
     61    public IProblem Problem {
    5762      get { return problem; }
    58       set { problem = value; }
    59     }
    60 
    61     public void LoadAlgorithm(long algorithmId) {
    62 
    63     }
    64     public void LoadProblem(long problemId) {
    65 
    66     }
    67 
    68 
    69 
    70     #region IOptimizer Members
    71 
     63      private set {
     64        problem = value;
     65        if (Algorithm != null) Algorithm.Problem = problem;
     66        OnChanged();
     67      }
     68    }
     69
     70    public IKeyedItemCollection<string, IParameter> Parameters {
     71      get {
     72        if (Algorithm != null) return Algorithm.Parameters;
     73        else return null;
     74      }
     75    }
     76    public ResultCollection Results {
     77      get {
     78        if (Algorithm != null) return Algorithm.Results;
     79        else return null;
     80      }
     81    }
     82    public RunCollection Runs {
     83      get {
     84        if (Algorithm != null) return Algorithm.Runs;
     85        else return null;
     86      }
     87    }
     88    public ExecutionState ExecutionState {
     89      get {
     90        if (Algorithm != null) return Algorithm.ExecutionState;
     91        else return ExecutionState.Stopped;
     92      }
     93    }
     94    public TimeSpan ExecutionTime {
     95      get {
     96        if (Algorithm != null) return Algorithm.ExecutionTime;
     97        else return TimeSpan.Zero;
     98      }
     99    }
     100
     101    public OKBExperiment()
     102      : base() {
     103      name = ItemName;
     104      description = ItemDescription;
     105    }
     106    [StorableConstructor]
     107    private OKBExperiment(bool deserializing) : base(deserializing) { }
     108
     109    public void LoadAlgorithm(long id) {
     110      AlgorithmId = id;
     111      AlgorithmData algorithmData = OKBClient.Instance.GetAlgorithmData(id);
     112
     113      using (MemoryStream stream = new MemoryStream(algorithmData.Data)) {
     114        Algorithm = XmlParser.Deserialize<IAlgorithm>(stream);
     115      }
     116    }
     117    public void LoadProblem(long id) {
     118      ProblemId = id;
     119      ProblemData problemData = OKBClient.Instance.GetProblemData(id);
     120
     121      using (MemoryStream stream = new MemoryStream(problemData.Data)) {
     122        Problem = XmlParser.Deserialize<IProblem>(stream);
     123      }
     124    }
     125
     126    public void Pause() {
     127      Algorithm.Pause();
     128    }
    72129    public void Prepare(bool clearRuns) {
    73       throw new System.NotImplementedException();
    74     }
    75 
    76     public RunCollection Runs {
    77       get { throw new System.NotImplementedException(); }
    78     }
    79 
    80     #endregion
    81 
    82     #region IExecutable Members
    83 
    84     public event System.EventHandler<EventArgs<System.Exception>> ExceptionOccurred;
    85 
    86     public ExecutionState ExecutionState {
    87       get { throw new System.NotImplementedException(); }
    88     }
    89 
    90     public event System.EventHandler ExecutionStateChanged;
    91 
    92     public System.TimeSpan ExecutionTime {
    93       get { throw new System.NotImplementedException(); }
    94     }
    95 
    96     public event System.EventHandler ExecutionTimeChanged;
    97 
    98     public void Pause() {
    99       throw new System.NotImplementedException();
    100     }
    101 
    102     public event System.EventHandler Paused;
    103 
     130      if (Algorithm != null) Algorithm.Prepare(clearRuns);
     131    }
    104132    public void Prepare() {
    105       throw new System.NotImplementedException();
    106     }
    107 
    108     public event System.EventHandler Prepared;
    109 
     133      Algorithm.Prepare();
     134    }
    110135    public void Start() {
    111       throw new System.NotImplementedException();
    112     }
    113 
    114     public event System.EventHandler Started;
    115 
     136      Algorithm.Start();
     137    }
    116138    public void Stop() {
    117       throw new System.NotImplementedException();
    118     }
    119 
    120     public event System.EventHandler Stopped;
    121 
     139      Algorithm.Stop();
     140    }
     141
     142    #region Events
     143    public event EventHandler Changed;
     144    private void OnChanged() {
     145      EventHandler handler = Changed;
     146      if (handler != null) handler(this, EventArgs.Empty);
     147    }
     148    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
     149    private void OnExceptionOccurred(Exception exception) {
     150      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
     151      if (handler != null) handler(this, new EventArgs<Exception>(exception));
     152    }
     153    public event EventHandler ExecutionStateChanged;
     154    private void OnExecutionStateChanged() {
     155      EventHandler handler = ExecutionStateChanged;
     156      if (handler != null) handler(this, EventArgs.Empty);
     157    }
     158    public event EventHandler ExecutionTimeChanged;
     159    private void OnExecutionTimeChanged() {
     160      EventHandler handler = ExecutionTimeChanged;
     161      if (handler != null) handler(this, EventArgs.Empty);
     162    }
     163    public event EventHandler Prepared;
     164    private void OnPrepared() {
     165      EventHandler handler = Prepared;
     166      if (handler != null) handler(this, EventArgs.Empty);
     167    }
     168    public event EventHandler Started;
     169    private void OnStarted() {
     170      EventHandler handler = Started;
     171      if (handler != null) handler(this, EventArgs.Empty);
     172    }
     173    public event EventHandler Paused;
     174    private void OnPaused() {
     175      EventHandler handler = Paused;
     176      if (handler != null) handler(this, EventArgs.Empty);
     177    }
     178    public event EventHandler Stopped;
     179    private void OnStopped() {
     180      EventHandler handler = Stopped;
     181      if (handler != null) handler(this, EventArgs.Empty);
     182    }
     183
     184    private void RegisterAlgorithmEvents() {
     185      if (Algorithm != null) {
     186        Algorithm.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Algorithm_ExceptionOccurred);
     187        Algorithm.ExecutionStateChanged += new EventHandler(Algorithm_ExecutionStateChanged);
     188        Algorithm.ExecutionTimeChanged += new EventHandler(Algorithm_ExecutionTimeChanged);
     189        Algorithm.ItemImageChanged += new EventHandler(Algorithm_ItemImageChanged);
     190        Algorithm.Paused += new EventHandler(Algorithm_Paused);
     191        Algorithm.Prepared += new EventHandler(Algorithm_Prepared);
     192        Algorithm.Started += new EventHandler(Algorithm_Started);
     193        Algorithm.Stopped += new EventHandler(Algorithm_Stopped);
     194      }
     195    }
     196    private void DeregisterAlgorithmEvents() {
     197      if (Algorithm != null) {
     198        Algorithm.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Algorithm_ExceptionOccurred);
     199        Algorithm.ExecutionStateChanged -= new EventHandler(Algorithm_ExecutionStateChanged);
     200        Algorithm.ExecutionTimeChanged -= new EventHandler(Algorithm_ExecutionTimeChanged);
     201        Algorithm.ItemImageChanged -= new EventHandler(Algorithm_ItemImageChanged);
     202        Algorithm.Paused -= new EventHandler(Algorithm_Paused);
     203        Algorithm.Prepared -= new EventHandler(Algorithm_Prepared);
     204        Algorithm.Started -= new EventHandler(Algorithm_Started);
     205        Algorithm.Stopped -= new EventHandler(Algorithm_Stopped);
     206      }
     207    }
     208    private void Algorithm_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     209      OnExceptionOccurred(e.Value);
     210    }
     211    private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) {
     212      OnExecutionStateChanged();
     213    }
     214    private void Algorithm_ExecutionTimeChanged(object sender, EventArgs e) {
     215      OnExecutionTimeChanged();
     216    }
     217    private void Algorithm_ItemImageChanged(object sender, EventArgs e) {
     218      OnItemImageChanged();
     219    }
     220    private void Algorithm_Paused(object sender, EventArgs e) {
     221      OnPaused();
     222    }
     223    private void Algorithm_Prepared(object sender, EventArgs e) {
     224      OnPrepared();
     225    }
     226    private void Algorithm_Started(object sender, EventArgs e) {
     227      OnStarted();
     228    }
     229    private void Algorithm_Stopped(object sender, EventArgs e) {
     230      OnStopped();
     231    }
    122232    #endregion
    123233  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/OKBItem.cs

    r4548 r4549  
    8686
    8787    public void Store() {
    88       if (OKB.Instance.Store(this))
     88      if (OKBClient.Instance.Store(this))
    8989        Modified = false;
    9090    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.cs

    r4548 r4549  
    2727namespace HeuristicLab.Clients.OKB {
    2828  [View("OKB Administrator")]
    29   [Content(typeof(OKB), true)]
     29  [Content(typeof(OKBClient), true)]
    3030  public sealed partial class AdministratorView : AsynchronousContentView {
    31     public new OKB Content {
    32       get { return (OKB)base.Content; }
     31    public new OKBClient Content {
     32      get { return (OKBClient)base.Content; }
    3333      set { base.Content = value; }
    3434    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.cs

    r4548 r4549  
    6060    protected override void OnInitialized(System.EventArgs e) {
    6161      base.OnInitialized(e);
    62       dataTypeComboBox.DataSource = OKB.Instance.DataTypes.ToList();
     62      dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.ToList();
    6363      dataTypeComboBox.SelectedIndex = -1;
    6464    }
     
    8080        noViewAvailableLabel.Visible = false;
    8181      } else {
    82         dataTypeComboBox.SelectedItem = OKB.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
     82        dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
    8383
    8484        using (MemoryStream stream = new MemoryStream(Content.Data)) {
     
    111111      switch (e.PropertyName) {
    112112        case "DataTypeId":
    113           dataTypeComboBox.SelectedItem = OKB.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
     113          dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
    114114          break;
    115115      }
     
    119119      BeginAsyncCall();
    120120      var call = new Action(delegate() {
    121         AlgorithmData data = OKB.Instance.GetAlgorithmData(AlgorithmId);
     121        AlgorithmData data = OKBClient.Instance.GetAlgorithmData(AlgorithmId);
    122122        Content = data;
    123123      });
     
    142142        }
    143143      }
    144       OKB.Instance.UpdateAlgorithmData(Content);
     144      OKBClient.Instance.UpdateAlgorithmData(Content);
    145145    }
    146146    private void newDataButton_Click(object sender, EventArgs e) {
     
    153153            if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId };
    154154            viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType();
    155             DataType dataType = OKB.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
     155            DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    156156            if (dataType == null) {
    157157              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    158               dataType.PlatformId = OKB.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
     158              dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    159159              dataType.Store();
    160               OKB.Instance.DataTypes.Add(dataType);
    161               dataTypeComboBox.DataSource = OKB.Instance.DataTypes.OrderBy(d => d.Name).ToList();
     160              OKBClient.Instance.DataTypes.Add(dataType);
     161              dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList();
    162162            }
    163163            dataTypeComboBox.SelectedItem = dataType;
     
    185185            viewHost.Content = algorithm;
    186186            noViewAvailableLabel.Visible = false;
    187             DataType dataType = OKB.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
     187            DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    188188            if (dataType == null) {
    189189              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    190               dataType.PlatformId = OKB.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
     190              dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    191191              dataType.Store();
    192               OKB.Instance.DataTypes.Add(dataType);
    193               dataTypeComboBox.DataSource = OKB.Instance.DataTypes.OrderBy(d => d.Name).ToList();
     192              OKBClient.Instance.DataTypes.Add(dataType);
     193              dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList();
    194194            }
    195195            dataTypeComboBox.SelectedItem = dataType;
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs

    r4548 r4549  
    4242    protected override void OnInitialized(System.EventArgs e) {
    4343      base.OnInitialized(e);
    44       platformComboBox.DataSource = OKB.Instance.Platforms.ToList();
    45       algorithmClassComboBox.DataSource = OKB.Instance.AlgorithmClasses.ToList();
     44      platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList();
     45      algorithmClassComboBox.DataSource = OKBClient.Instance.AlgorithmClasses.ToList();
    4646    }
    4747
     
    5353        algorithmDataView.AlgorithmId = 0;
    5454      } else {
    55         platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    56         algorithmClassComboBox.SelectedItem = OKB.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
     55        platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     56        algorithmClassComboBox.SelectedItem = OKBClient.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
    5757        algorithmDataView.AlgorithmId = Content.Id;
    5858      }
     
    7777          break;
    7878        case "PlatformId":
    79           platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     79          platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    8080          break;
    8181        case "AlgorithmClassId":
    82           algorithmClassComboBox.SelectedItem = OKB.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
     82          algorithmClassComboBox.SelectedItem = OKBClient.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
    8383          break;
    8484      }
     
    9999
    100100    private void refreshUsersButton_Click(object sender, System.EventArgs e) {
    101       Guid[] ids = OKB.Instance.GetAlgorithmUsers(Content.Id);
     101      Guid[] ids = OKBClient.Instance.GetAlgorithmUsers(Content.Id);
    102102      if (ids != null) {
    103         List<User> users = OKB.Instance.Users.ToList();
     103        List<User> users = OKBClient.Instance.Users.ToList();
    104104        usersListBox.DataSource = users;
    105105        usersListBox.DisplayMember = "Name";
     
    112112    }
    113113    private void storeUsersButton_Click(object sender, System.EventArgs e) {
    114       if (OKB.Instance.UpdateAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))
     114      if (OKBClient.Instance.UpdateAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))
    115115        storeUsersButton.Enabled = false;
    116116    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.cs

    r4548 r4549  
    4141    protected override void OnInitialized(System.EventArgs e) {
    4242      base.OnInitialized(e);
    43       platformComboBox.DataSource = OKB.Instance.Platforms.ToList();
     43      platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList();
    4444    }
    4545
     
    5757        nameTextBox.Text = Content.Name;
    5858        sqlNameComboBox.Text = Content.SqlName;
    59         platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     59        platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    6060        Caption = Content.Name;
    6161      }
     
    8080          break;
    8181        case "PlatformId":
    82           platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     82          platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    8383          break;
    8484      }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.Designer.cs

    r4548 r4549  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.algorithmLabel = new System.Windows.Forms.Label();
     48      this.problemLabel = new System.Windows.Forms.Label();
     49      this.algorithmComboBox = new System.Windows.Forms.ComboBox();
     50      this.problemComboBox = new System.Windows.Forms.ComboBox();
     51      this.refreshButton = new System.Windows.Forms.Button();
     52      this.startButton = new System.Windows.Forms.Button();
     53      this.pauseButton = new System.Windows.Forms.Button();
     54      this.stopButton = new System.Windows.Forms.Button();
     55      this.prepareButton = new System.Windows.Forms.Button();
     56      this.executionTimeLabel = new System.Windows.Forms.Label();
     57      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
     58      this.tabControl = new System.Windows.Forms.TabControl();
     59      this.problemTabPage = new System.Windows.Forms.TabPage();
     60      this.parametersTabPage = new System.Windows.Forms.TabPage();
     61      this.resultsTabPage = new System.Windows.Forms.TabPage();
     62      this.runsTabPage = new System.Windows.Forms.TabPage();
     63      this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     64      this.parametersViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     65      this.resultsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     66      this.runsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    4767      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     68      this.tabControl.SuspendLayout();
     69      this.problemTabPage.SuspendLayout();
     70      this.parametersTabPage.SuspendLayout();
     71      this.resultsTabPage.SuspendLayout();
     72      this.runsTabPage.SuspendLayout();
    4873      this.SuspendLayout();
    4974      //
     
    5277      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    5378      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    54       this.nameTextBox.Size = new System.Drawing.Size(463, 20);
     79      this.nameTextBox.Size = new System.Drawing.Size(638, 20);
    5580      //
    5681      // descriptionTextBox
    5782      //
    58       this.descriptionTextBox.Size = new System.Drawing.Size(463, 20);
     83      this.descriptionTextBox.Size = new System.Drawing.Size(638, 20);
     84      //
     85      // algorithmLabel
     86      //
     87      this.algorithmLabel.AutoSize = true;
     88      this.algorithmLabel.Location = new System.Drawing.Point(3, 111);
     89      this.algorithmLabel.Name = "algorithmLabel";
     90      this.algorithmLabel.Size = new System.Drawing.Size(53, 13);
     91      this.algorithmLabel.TabIndex = 5;
     92      this.algorithmLabel.Text = "&Algorithm:";
     93      //
     94      // problemLabel
     95      //
     96      this.problemLabel.AutoSize = true;
     97      this.problemLabel.Location = new System.Drawing.Point(3, 138);
     98      this.problemLabel.Name = "problemLabel";
     99      this.problemLabel.Size = new System.Drawing.Size(48, 13);
     100      this.problemLabel.TabIndex = 7;
     101      this.problemLabel.Text = "&Problem:";
     102      //
     103      // algorithmComboBox
     104      //
     105      this.algorithmComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     106                  | System.Windows.Forms.AnchorStyles.Right)));
     107      this.algorithmComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     108      this.algorithmComboBox.FormattingEnabled = true;
     109      this.algorithmComboBox.Location = new System.Drawing.Point(72, 108);
     110      this.algorithmComboBox.Name = "algorithmComboBox";
     111      this.algorithmComboBox.Size = new System.Drawing.Size(638, 21);
     112      this.algorithmComboBox.TabIndex = 6;
     113      this.algorithmComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmComboBox_SelectedValueChanged);
     114      //
     115      // problemComboBox
     116      //
     117      this.problemComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     118                  | System.Windows.Forms.AnchorStyles.Right)));
     119      this.problemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     120      this.problemComboBox.FormattingEnabled = true;
     121      this.problemComboBox.Location = new System.Drawing.Point(72, 135);
     122      this.problemComboBox.Name = "problemComboBox";
     123      this.problemComboBox.Size = new System.Drawing.Size(638, 21);
     124      this.problemComboBox.TabIndex = 8;
     125      this.problemComboBox.SelectedValueChanged += new System.EventHandler(this.problemComboBox_SelectedValueChanged);
     126      //
     127      // refreshButton
     128      //
     129      this.refreshButton.Location = new System.Drawing.Point(0, 79);
     130      this.refreshButton.Name = "refreshButton";
     131      this.refreshButton.Size = new System.Drawing.Size(75, 23);
     132      this.refreshButton.TabIndex = 4;
     133      this.refreshButton.Text = "&Refresh";
     134      this.refreshButton.UseVisualStyleBackColor = true;
     135      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     136      //
     137      // startButton
     138      //
     139      this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     140      this.startButton.Location = new System.Drawing.Point(81, 476);
     141      this.startButton.Name = "startButton";
     142      this.startButton.Size = new System.Drawing.Size(75, 23);
     143      this.startButton.TabIndex = 11;
     144      this.startButton.Text = "Start";
     145      this.startButton.UseVisualStyleBackColor = true;
     146      this.startButton.Click += new System.EventHandler(this.startButton_Click);
     147      //
     148      // pauseButton
     149      //
     150      this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     151      this.pauseButton.Location = new System.Drawing.Point(162, 476);
     152      this.pauseButton.Name = "pauseButton";
     153      this.pauseButton.Size = new System.Drawing.Size(75, 23);
     154      this.pauseButton.TabIndex = 12;
     155      this.pauseButton.Text = "Pause";
     156      this.pauseButton.UseVisualStyleBackColor = true;
     157      this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
     158      //
     159      // stopButton
     160      //
     161      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     162      this.stopButton.Location = new System.Drawing.Point(243, 476);
     163      this.stopButton.Name = "stopButton";
     164      this.stopButton.Size = new System.Drawing.Size(75, 23);
     165      this.stopButton.TabIndex = 13;
     166      this.stopButton.Text = "Stop";
     167      this.stopButton.UseVisualStyleBackColor = true;
     168      this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
     169      //
     170      // prepareButton
     171      //
     172      this.prepareButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     173      this.prepareButton.Location = new System.Drawing.Point(0, 476);
     174      this.prepareButton.Name = "prepareButton";
     175      this.prepareButton.Size = new System.Drawing.Size(75, 23);
     176      this.prepareButton.TabIndex = 10;
     177      this.prepareButton.Text = "Prepare";
     178      this.prepareButton.UseVisualStyleBackColor = true;
     179      this.prepareButton.Click += new System.EventHandler(this.prepareButton_Click);
     180      //
     181      // executionTimeLabel
     182      //
     183      this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     184      this.executionTimeLabel.AutoSize = true;
     185      this.executionTimeLabel.Location = new System.Drawing.Point(476, 482);
     186      this.executionTimeLabel.Name = "executionTimeLabel";
     187      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
     188      this.executionTimeLabel.TabIndex = 14;
     189      this.executionTimeLabel.Text = "&Execution Time:";
     190      //
     191      // executionTimeTextBox
     192      //
     193      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     194      this.executionTimeTextBox.Location = new System.Drawing.Point(565, 479);
     195      this.executionTimeTextBox.Name = "executionTimeTextBox";
     196      this.executionTimeTextBox.ReadOnly = true;
     197      this.executionTimeTextBox.Size = new System.Drawing.Size(145, 20);
     198      this.executionTimeTextBox.TabIndex = 15;
     199      //
     200      // tabControl
     201      //
     202      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     203                  | System.Windows.Forms.AnchorStyles.Left)
     204                  | System.Windows.Forms.AnchorStyles.Right)));
     205      this.tabControl.Controls.Add(this.problemTabPage);
     206      this.tabControl.Controls.Add(this.parametersTabPage);
     207      this.tabControl.Controls.Add(this.resultsTabPage);
     208      this.tabControl.Controls.Add(this.runsTabPage);
     209      this.tabControl.Location = new System.Drawing.Point(0, 162);
     210      this.tabControl.Name = "tabControl";
     211      this.tabControl.SelectedIndex = 0;
     212      this.tabControl.Size = new System.Drawing.Size(710, 308);
     213      this.tabControl.TabIndex = 9;
     214      //
     215      // problemTabPage
     216      //
     217      this.problemTabPage.Controls.Add(this.problemViewHost);
     218      this.problemTabPage.Location = new System.Drawing.Point(4, 22);
     219      this.problemTabPage.Name = "problemTabPage";
     220      this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
     221      this.problemTabPage.Size = new System.Drawing.Size(702, 282);
     222      this.problemTabPage.TabIndex = 0;
     223      this.problemTabPage.Text = "Problem";
     224      this.problemTabPage.UseVisualStyleBackColor = true;
     225      //
     226      // parametersTabPage
     227      //
     228      this.parametersTabPage.Controls.Add(this.parametersViewHost);
     229      this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
     230      this.parametersTabPage.Name = "parametersTabPage";
     231      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
     232      this.parametersTabPage.Size = new System.Drawing.Size(702, 282);
     233      this.parametersTabPage.TabIndex = 1;
     234      this.parametersTabPage.Text = "Parameters";
     235      this.parametersTabPage.UseVisualStyleBackColor = true;
     236      //
     237      // resultsTabPage
     238      //
     239      this.resultsTabPage.Controls.Add(this.resultsViewHost);
     240      this.resultsTabPage.Location = new System.Drawing.Point(4, 22);
     241      this.resultsTabPage.Name = "resultsTabPage";
     242      this.resultsTabPage.Size = new System.Drawing.Size(702, 282);
     243      this.resultsTabPage.TabIndex = 2;
     244      this.resultsTabPage.Text = "Results";
     245      this.resultsTabPage.UseVisualStyleBackColor = true;
     246      //
     247      // runsTabPage
     248      //
     249      this.runsTabPage.Controls.Add(this.runsViewHost);
     250      this.runsTabPage.Location = new System.Drawing.Point(4, 22);
     251      this.runsTabPage.Name = "runsTabPage";
     252      this.runsTabPage.Size = new System.Drawing.Size(702, 282);
     253      this.runsTabPage.TabIndex = 3;
     254      this.runsTabPage.Text = "Runs";
     255      this.runsTabPage.UseVisualStyleBackColor = true;
     256      //
     257      // problemViewHost
     258      //
     259      this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     260                  | System.Windows.Forms.AnchorStyles.Left)
     261                  | System.Windows.Forms.AnchorStyles.Right)));
     262      this.problemViewHost.Caption = "View";
     263      this.problemViewHost.Content = null;
     264      this.problemViewHost.Location = new System.Drawing.Point(6, 6);
     265      this.problemViewHost.Name = "problemViewHost";
     266      this.problemViewHost.ReadOnly = false;
     267      this.problemViewHost.Size = new System.Drawing.Size(690, 270);
     268      this.problemViewHost.TabIndex = 0;
     269      this.problemViewHost.ViewType = null;
     270      //
     271      // parametersViewHost
     272      //
     273      this.parametersViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     274                  | System.Windows.Forms.AnchorStyles.Left)
     275                  | System.Windows.Forms.AnchorStyles.Right)));
     276      this.parametersViewHost.Caption = "View";
     277      this.parametersViewHost.Content = null;
     278      this.parametersViewHost.Location = new System.Drawing.Point(6, 6);
     279      this.parametersViewHost.Name = "parametersViewHost";
     280      this.parametersViewHost.ReadOnly = false;
     281      this.parametersViewHost.Size = new System.Drawing.Size(690, 270);
     282      this.parametersViewHost.TabIndex = 1;
     283      this.parametersViewHost.ViewType = null;
     284      //
     285      // resultsViewHost
     286      //
     287      this.resultsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     288                  | System.Windows.Forms.AnchorStyles.Left)
     289                  | System.Windows.Forms.AnchorStyles.Right)));
     290      this.resultsViewHost.Caption = "View";
     291      this.resultsViewHost.Content = null;
     292      this.resultsViewHost.Location = new System.Drawing.Point(6, 6);
     293      this.resultsViewHost.Name = "resultsViewHost";
     294      this.resultsViewHost.ReadOnly = false;
     295      this.resultsViewHost.Size = new System.Drawing.Size(690, 270);
     296      this.resultsViewHost.TabIndex = 1;
     297      this.resultsViewHost.ViewType = null;
     298      //
     299      // runsViewHost
     300      //
     301      this.runsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     302                  | System.Windows.Forms.AnchorStyles.Left)
     303                  | System.Windows.Forms.AnchorStyles.Right)));
     304      this.runsViewHost.Caption = "View";
     305      this.runsViewHost.Content = null;
     306      this.runsViewHost.Location = new System.Drawing.Point(6, 6);
     307      this.runsViewHost.Name = "runsViewHost";
     308      this.runsViewHost.ReadOnly = false;
     309      this.runsViewHost.Size = new System.Drawing.Size(690, 270);
     310      this.runsViewHost.TabIndex = 1;
     311      this.runsViewHost.ViewType = null;
    59312      //
    60313      // OKBExperimentView
     
    62315      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    63316      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     317      this.Controls.Add(this.algorithmComboBox);
     318      this.Controls.Add(this.problemComboBox);
     319      this.Controls.Add(this.algorithmLabel);
     320      this.Controls.Add(this.problemLabel);
     321      this.Controls.Add(this.tabControl);
     322      this.Controls.Add(this.refreshButton);
     323      this.Controls.Add(this.prepareButton);
     324      this.Controls.Add(this.startButton);
     325      this.Controls.Add(this.executionTimeTextBox);
     326      this.Controls.Add(this.pauseButton);
     327      this.Controls.Add(this.stopButton);
     328      this.Controls.Add(this.executionTimeLabel);
    64329      this.Name = "OKBExperimentView";
    65       this.Size = new System.Drawing.Size(535, 388);
     330      this.Size = new System.Drawing.Size(710, 499);
     331      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
     332      this.Controls.SetChildIndex(this.stopButton, 0);
     333      this.Controls.SetChildIndex(this.pauseButton, 0);
     334      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
     335      this.Controls.SetChildIndex(this.startButton, 0);
     336      this.Controls.SetChildIndex(this.prepareButton, 0);
     337      this.Controls.SetChildIndex(this.refreshButton, 0);
     338      this.Controls.SetChildIndex(this.tabControl, 0);
     339      this.Controls.SetChildIndex(this.problemLabel, 0);
     340      this.Controls.SetChildIndex(this.algorithmLabel, 0);
     341      this.Controls.SetChildIndex(this.problemComboBox, 0);
     342      this.Controls.SetChildIndex(this.algorithmComboBox, 0);
     343      this.Controls.SetChildIndex(this.nameLabel, 0);
     344      this.Controls.SetChildIndex(this.descriptionLabel, 0);
     345      this.Controls.SetChildIndex(this.nameTextBox, 0);
     346      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    66347      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     348      this.tabControl.ResumeLayout(false);
     349      this.problemTabPage.ResumeLayout(false);
     350      this.parametersTabPage.ResumeLayout(false);
     351      this.resultsTabPage.ResumeLayout(false);
     352      this.runsTabPage.ResumeLayout(false);
    67353      this.ResumeLayout(false);
    68354      this.PerformLayout();
     
    72358    #endregion
    73359
     360    private System.Windows.Forms.Label algorithmLabel;
     361    private System.Windows.Forms.Label problemLabel;
     362    private System.Windows.Forms.ComboBox algorithmComboBox;
     363    private System.Windows.Forms.ComboBox problemComboBox;
     364    private System.Windows.Forms.Button refreshButton;
     365    private System.Windows.Forms.Button startButton;
     366    private System.Windows.Forms.Button pauseButton;
     367    private System.Windows.Forms.Button stopButton;
     368    private System.Windows.Forms.Button prepareButton;
     369    private System.Windows.Forms.Label executionTimeLabel;
     370    private System.Windows.Forms.TextBox executionTimeTextBox;
     371    private System.Windows.Forms.TabControl tabControl;
     372    private System.Windows.Forms.TabPage problemTabPage;
     373    private System.Windows.Forms.TabPage parametersTabPage;
     374    private MainForm.WindowsForms.ViewHost problemViewHost;
     375    private MainForm.WindowsForms.ViewHost parametersViewHost;
     376    private System.Windows.Forms.TabPage resultsTabPage;
     377    private MainForm.WindowsForms.ViewHost resultsViewHost;
     378    private System.Windows.Forms.TabPage runsTabPage;
     379    private MainForm.WindowsForms.ViewHost runsViewHost;
     380
    74381
    75382
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.cs

    r4548 r4549  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using System.Windows.Forms;
     25using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2327using HeuristicLab.Core.Views;
    2428using HeuristicLab.MainForm;
    2529using HeuristicLab.MainForm.WindowsForms;
     30using HeuristicLab.PluginInfrastructure;
    2631
    2732namespace HeuristicLab.Clients.OKB {
    2833  [View("OKBItem View")]
    2934  [Content(typeof(OKBExperiment), true)]
    30   public partial class OKBExperimentView : NamedItemView {
     35  public sealed partial class OKBExperimentView : NamedItemView {
    3136    public new OKBExperiment Content {
    3237      get { return (OKBExperiment)base.Content; }
     
    3843    }
    3944
     45    protected override void OnInitialized(System.EventArgs e) {
     46      base.OnInitialized(e);
     47      OKBClient.Instance.Refreshing += new EventHandler(OKBClient_Refreshing);
     48      OKBClient.Instance.Refreshed += new EventHandler(OKBClient_Refreshed);
     49      PopulateComboBoxes();
     50    }
     51
    4052    protected override void DeregisterContentEvents() {
    41       // ...
     53      Content.Changed -= new EventHandler(Content_Changed);
     54      Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
     55      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
     56      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
     57      Content.Prepared -= new EventHandler(Content_Prepared);
     58      Content.Started -= new EventHandler(Content_Started);
     59      Content.Paused -= new EventHandler(Content_Paused);
     60      Content.Stopped -= new EventHandler(Content_Stopped);
    4261      base.DeregisterContentEvents();
    4362    }
    4463    protected override void RegisterContentEvents() {
    4564      base.RegisterContentEvents();
    46       // ...
    47     }
    48 
     65      Content.Changed += new EventHandler(Content_Changed);
     66      Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
     67      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
     68      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
     69      Content.Prepared += new EventHandler(Content_Prepared);
     70      Content.Started += new EventHandler(Content_Started);
     71      Content.Paused += new EventHandler(Content_Paused);
     72      Content.Stopped += new EventHandler(Content_Stopped);
     73    }
     74
     75    protected override void OnContentChanged() {
     76      base.OnContentChanged();
     77      if (Content == null) {
     78        problemViewHost.Content = null;
     79        parametersViewHost.Content = null;
     80        resultsViewHost.Content = null;
     81        runsViewHost.Content = null;
     82        executionTimeTextBox.Text = "-";
     83      } else {
     84        problemViewHost.Content = Content.Problem;
     85        parametersViewHost.Content = Content.Parameters;
     86        resultsViewHost.Content = Content.Results;
     87        runsViewHost.Content = Content.Runs;
     88        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
     89      }
     90    }
    4991    protected override void SetEnabledStateOfControls() {
    5092      base.SetEnabledStateOfControls();
    51       // ...
    52     }
     93      executionTimeTextBox.Enabled = Content != null;
     94      SetEnabledStateOfExecutableButtons();
     95    }
     96
     97    private void PopulateComboBoxes() {
     98      Platform platform = OKBClient.Instance.Platforms.FirstOrDefault(x => x.Name == "HeuristicLab 3.3");
     99      if (platform != null) {
     100        algorithmComboBox.DataSource = OKBClient.Instance.Algorithms.Where(x => x.PlatformId == platform.Id).ToList();
     101        algorithmComboBox.DisplayMember = "Name";
     102        problemComboBox.DataSource = OKBClient.Instance.Problems.Where(x => x.PlatformId == platform.Id).ToList();
     103        problemComboBox.DisplayMember = "Name";
     104      }
     105    }
     106
     107    protected override void OnClosed(FormClosedEventArgs e) {
     108      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
     109      base.OnClosed(e);
     110    }
     111
     112    private void OKBClient_Refreshing(object sender, EventArgs e) {
     113      if (InvokeRequired) {
     114        Invoke(new EventHandler(OKBClient_Refreshing), sender, e);
     115      } else {
     116        Cursor = Cursors.AppStarting;
     117        Enabled = false;
     118      }
     119    }
     120    private void OKBClient_Refreshed(object sender, EventArgs e) {
     121      if (InvokeRequired) {
     122        Invoke(new EventHandler(OKBClient_Refreshed), sender, e);
     123      } else {
     124        PopulateComboBoxes();
     125        Enabled = true;
     126        Cursor = Cursors.Default;
     127      }
     128    }
     129
     130    #region Content Events
     131    private void Content_Changed(object sender, EventArgs e) {
     132      OnContentChanged();
     133      SetEnabledStateOfControls();
     134    }
     135    private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     136      if (InvokeRequired)
     137        Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e);
     138      else
     139        ErrorHandling.ShowErrorDialog(this, e.Value);
     140    }
     141    private void Content_ExecutionStateChanged(object sender, EventArgs e) {
     142      if (InvokeRequired)
     143        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
     144      else
     145        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = prepareButton.Enabled = false;
     146    }
     147    private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
     148      if (InvokeRequired)
     149        Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
     150      else
     151        executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString();
     152    }
     153    private void Content_Prepared(object sender, EventArgs e) {
     154      if (InvokeRequired)
     155        Invoke(new EventHandler(Content_Prepared), sender, e);
     156      else {
     157        ReadOnly = Locked = false;
     158        SetEnabledStateOfExecutableButtons();
     159      }
     160    }
     161    private void Content_Started(object sender, EventArgs e) {
     162      if (InvokeRequired)
     163        Invoke(new EventHandler(Content_Started), sender, e);
     164      else {
     165        ReadOnly = Locked = true;
     166        SetEnabledStateOfExecutableButtons();
     167      }
     168    }
     169    private void Content_Paused(object sender, EventArgs e) {
     170      if (InvokeRequired)
     171        Invoke(new EventHandler(Content_Paused), sender, e);
     172      else {
     173        ReadOnly = Locked = false;
     174        SetEnabledStateOfExecutableButtons();
     175      }
     176    }
     177    private void Content_Stopped(object sender, EventArgs e) {
     178      if (InvokeRequired)
     179        Invoke(new EventHandler(Content_Stopped), sender, e);
     180      else {
     181        ReadOnly = Locked = false;
     182        SetEnabledStateOfExecutableButtons();
     183      }
     184    }
     185    #endregion
     186
     187    #region Control Events
     188    private void refreshButton_Click(object sender, System.EventArgs e) {
     189      OKBClient.Instance.Refresh();
     190    }
     191    private void algorithmComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
     192      Algorithm algorithm = algorithmComboBox.SelectedValue as Algorithm;
     193      if ((algorithm != null) && (Content != null)) {
     194        Content.LoadAlgorithm(algorithm.Id);
     195      }
     196    }
     197    private void problemComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
     198      Problem problem = problemComboBox.SelectedValue as Problem;
     199      if ((problem != null) && (Content != null)) {
     200        Content.LoadProblem(problem.Id);
     201      }
     202    }
     203    private void prepareButton_Click(object sender, EventArgs e) {
     204      Content.Prepare(false);
     205    }
     206    private void startButton_Click(object sender, EventArgs e) {
     207      Content.Start();
     208    }
     209    private void pauseButton_Click(object sender, EventArgs e) {
     210      Content.Pause();
     211    }
     212    private void stopButton_Click(object sender, EventArgs e) {
     213      Content.Stop();
     214    }
     215    #endregion
     216
     217    #region Helpers
     218    private void SetEnabledStateOfExecutableButtons() {
     219      if (Content == null) {
     220        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = prepareButton.Enabled = false;
     221      } else {
     222        startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
     223        pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
     224        stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
     225        prepareButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     226      }
     227    }
     228    #endregion
    53229  }
    54230}
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/ProblemDataView.cs

    r4548 r4549  
    6060    protected override void OnInitialized(System.EventArgs e) {
    6161      base.OnInitialized(e);
    62       dataTypeComboBox.DataSource = OKB.Instance.DataTypes.ToList();
     62      dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.ToList();
    6363      dataTypeComboBox.SelectedIndex = -1;
    6464    }
     
    8080        noViewAvailableLabel.Visible = false;
    8181      } else {
    82         dataTypeComboBox.SelectedItem = OKB.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
     82        dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
    8383
    8484        using (MemoryStream stream = new MemoryStream(Content.Data)) {
     
    111111      switch (e.PropertyName) {
    112112        case "DataTypeId":
    113           dataTypeComboBox.SelectedItem = OKB.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
     113          dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
    114114          break;
    115115      }
     
    119119      BeginAsyncCall();
    120120      var call = new Action(delegate() {
    121         ProblemData data = OKB.Instance.GetProblemData(ProblemId);
     121        ProblemData data = OKBClient.Instance.GetProblemData(ProblemId);
    122122        Content = data;
    123123      });
     
    141141        }
    142142      }
    143       OKB.Instance.UpdateProblemData(Content);
     143      OKBClient.Instance.UpdateProblemData(Content);
    144144    }
    145145    private void newDataButton_Click(object sender, EventArgs e) {
     
    152152            if (Content == null) Content = new ProblemData { ProblemId = ProblemId };
    153153            viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType();
    154             DataType dataType = OKB.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
     154            DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    155155            if (dataType == null) {
    156156              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    157               dataType.PlatformId = OKB.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
     157              dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    158158              dataType.Store();
    159               OKB.Instance.DataTypes.Add(dataType);
    160               dataTypeComboBox.DataSource = OKB.Instance.DataTypes.OrderBy(d => d.Name).ToList();
     159              OKBClient.Instance.DataTypes.Add(dataType);
     160              dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList();
    161161            }
    162162            dataTypeComboBox.SelectedItem = dataType;
     
    184184            viewHost.Content = problem;
    185185            noViewAvailableLabel.Visible = false;
    186             DataType dataType = OKB.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
     186            DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    187187            if (dataType == null) {
    188188              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    189               dataType.PlatformId = OKB.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
     189              dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    190190              dataType.Store();
    191               OKB.Instance.DataTypes.Add(dataType);
    192               dataTypeComboBox.DataSource = OKB.Instance.DataTypes.OrderBy(d => d.Name).ToList();
     191              OKBClient.Instance.DataTypes.Add(dataType);
     192              dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList();
    193193            }
    194194            dataTypeComboBox.SelectedItem = dataType;
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/ProblemView.cs

    r4548 r4549  
    4242    protected override void OnInitialized(System.EventArgs e) {
    4343      base.OnInitialized(e);
    44       platformComboBox.DataSource = OKB.Instance.Platforms.ToList();
    45       problemClassComboBox.DataSource = OKB.Instance.ProblemClasses.ToList();
     44      platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList();
     45      problemClassComboBox.DataSource = OKBClient.Instance.ProblemClasses.ToList();
    4646    }
    4747
     
    5353        problemDataView.ProblemId = 0;
    5454      } else {
    55         platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    56         problemClassComboBox.SelectedItem = OKB.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);
     55        platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     56        problemClassComboBox.SelectedItem = OKBClient.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);
    5757        problemDataView.ProblemId = Content.Id;
    5858      }
     
    7777          break;
    7878        case "PlatformId":
    79           platformComboBox.SelectedItem = OKB.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     79          platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    8080          break;
    8181        case "ProblemClassId":
    82           problemClassComboBox.SelectedItem = OKB.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);
     82          problemClassComboBox.SelectedItem = OKBClient.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);
    8383          break;
    8484      }
     
    9999
    100100    private void refreshUsersButton_Click(object sender, System.EventArgs e) {
    101       Guid[] ids = OKB.Instance.GetProblemUsers(Content.Id);
     101      Guid[] ids = OKBClient.Instance.GetProblemUsers(Content.Id);
    102102      if (ids != null) {
    103         List<User> users = OKB.Instance.Users.ToList();
     103        List<User> users = OKBClient.Instance.Users.ToList();
    104104        usersListBox.DataSource = users;
    105105        usersListBox.DisplayMember = "Name";
     
    112112    }
    113113    private void storeUsersButton_Click(object sender, System.EventArgs e) {
    114       if (OKB.Instance.UpdateProblemUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))
     114      if (OKBClient.Instance.UpdateProblemUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))
    115115        storeUsersButton.Enabled = false;
    116116    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/app.config

    r4548 r4549  
    77                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    88                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
    9                     maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     9                    maxBufferPoolSize="524288" maxReceivedMessageSize="200000000"
    1010                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
    1111                    allowCookies="false">
    12                     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
     12                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="200000000"
    1313                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    1414                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
Note: See TracChangeset for help on using the changeset viewer.