Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4943


Ignore:
Timestamp:
11/26/10 04:09:16 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB/HeuristicLab.Clients.OKB-3.3
Files:
4 added
5 edited

Legend:

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

    r4929 r4943  
    6969    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    7070      <HintPath>..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
     71    </Reference>
     72    <Reference Include="HeuristicLab.Optimization.Views-3.3">
     73      <HintPath>..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
    7174    </Reference>
    7275    <Reference Include="HeuristicLab.Optimizer-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    167170      <DependentUpon>AlgorithmParameterView.cs</DependentUpon>
    168171    </Compile>
     172    <Compile Include="Views\RunView.cs">
     173      <SubType>UserControl</SubType>
     174    </Compile>
     175    <Compile Include="Views\RunView.Designer.cs">
     176      <DependentUpon>RunView.cs</DependentUpon>
     177    </Compile>
     178    <Compile Include="Views\ExperimentView.cs">
     179      <SubType>UserControl</SubType>
     180    </Compile>
     181    <Compile Include="Views\ExperimentView.Designer.cs">
     182      <DependentUpon>ExperimentView.cs</DependentUpon>
     183    </Compile>
    169184    <Compile Include="Views\RunCollectionView.cs">
    170185      <SubType>UserControl</SubType>
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLabClientsOKBPlugin.cs.frame

    r4548 r4943  
    3838  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3939  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     40  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
    4041  [PluginDependency("HeuristicLab.Optimizer", "3.3")]
    4142  [PluginDependency("HeuristicLab.Persistence", "3.3")]
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs

    r4929 r4943  
    2222using System;
    2323using System.Collections.Generic;
     24using System.IO;
    2425using System.Linq;
    2526using HeuristicLab.Clients.Common;
     
    2930using HeuristicLab.Data;
    3031using HeuristicLab.Optimization;
     32using HeuristicLab.Persistence.Default.Xml;
    3133using HeuristicLab.PluginInfrastructure;
    3234
     
    246248      }
    247249    }
     250    #endregion
     251
     252    #region Problem Methods
     253    public Guid[] GetProblemUsers(long problemId) {
     254      try {
     255        return CallAdminService<Guid[]>(s => s.GetProblemUsers(problemId));
     256      }
     257      catch (Exception ex) {
     258        ErrorHandling.ShowErrorDialog("Refresh authorized problem users failed.", ex);
     259        return null;
     260      }
     261    }
     262    public bool UpdateProblemUsers(long problemId, Guid[] users) {
     263      try {
     264        CallAdminService(s => s.UpdateProblemUsers(problemId, users));
     265        return true;
     266      }
     267      catch (Exception ex) {
     268        ErrorHandling.ShowErrorDialog("Update authorized problem users failed.", ex);
     269        return false;
     270      }
     271    }
     272    public ProblemData GetProblemData(long problemId) {
     273      try {
     274        return CallAdminService<ProblemData>(s => s.GetProblemData(problemId));
     275      }
     276      catch (Exception ex) {
     277        ErrorHandling.ShowErrorDialog("Refresh problem data failed.", ex);
     278        return null;
     279      }
     280    }
     281    public bool UpdateProblemData(ProblemData problemData) {
     282      try {
     283        CallAdminService(s => s.UpdateProblemData(problemData));
     284        return true;
     285      }
     286      catch (Exception ex) {
     287        ErrorHandling.ShowErrorDialog("Update problem data failed.", ex);
     288        return false;
     289      }
     290    }
     291    #endregion
     292
     293    #region AlgorithmParameter Methods
     294    public AlgorithmParameter GetAlgorithmParameter(long id) {
     295      try {
     296        return CallAdminService<AlgorithmParameter>(s => s.GetAlgorithmParameter(id));
     297      }
     298      catch (Exception ex) {
     299        ErrorHandling.ShowErrorDialog("Refresh algorithm parameter failed.", ex);
     300        return null;
     301      }
     302    }
    248303    public ItemCollection<AlgorithmParameter> GetAlgorithmParameters(long algorithmId) {
    249304      try {
     
    257312      }
    258313    }
     314    #endregion
     315
     316    #region ProblemParameter Methods
     317    public ProblemParameter GetProblemParameter(long id) {
     318      try {
     319        return CallAdminService<ProblemParameter>(s => s.GetProblemParameter(id));
     320      }
     321      catch (Exception ex) {
     322        ErrorHandling.ShowErrorDialog("Refresh problem parameter failed.", ex);
     323        return null;
     324      }
     325    }
     326    public ItemCollection<ProblemParameter> GetProblemParameters(long problemId) {
     327      try {
     328        ItemCollection<ProblemParameter> parameters = new ItemCollection<ProblemParameter>();
     329        parameters.AddRange(CallAdminService<ProblemParameter[]>(s => s.GetProblemParameters(problemId)).OrderBy(x => x.Name));
     330        return parameters;
     331      }
     332      catch (Exception ex) {
     333        ErrorHandling.ShowErrorDialog("Refresh problem parameters failed.", ex);
     334        return null;
     335      }
     336    }
     337    #endregion
     338
     339    #region Result Methods
     340    public Result GetResult(long id) {
     341      try {
     342        return CallAdminService<Result>(s => s.GetResult(id));
     343      }
     344      catch (Exception ex) {
     345        ErrorHandling.ShowErrorDialog("Refresh result failed.", ex);
     346        return null;
     347      }
     348    }
    259349    public ItemCollection<Result> GetResults(long algorithmId) {
    260350      try {
     
    270360    #endregion
    271361
    272     #region Problem Methods
    273     public Guid[] GetProblemUsers(long problemId) {
    274       try {
    275         return CallAdminService<Guid[]>(s => s.GetProblemUsers(problemId));
    276       }
    277       catch (Exception ex) {
    278         ErrorHandling.ShowErrorDialog("Refresh authorized problem users failed.", ex);
    279         return null;
    280       }
    281     }
    282     public bool UpdateProblemUsers(long problemId, Guid[] users) {
    283       try {
    284         CallAdminService(s => s.UpdateProblemUsers(problemId, users));
    285         return true;
    286       }
    287       catch (Exception ex) {
    288         ErrorHandling.ShowErrorDialog("Update authorized problem users failed.", ex);
    289         return false;
    290       }
    291     }
    292     public ProblemData GetProblemData(long problemId) {
    293       try {
    294         return CallAdminService<ProblemData>(s => s.GetProblemData(problemId));
    295       }
    296       catch (Exception ex) {
    297         ErrorHandling.ShowErrorDialog("Refresh problem data failed.", ex);
    298         return null;
    299       }
    300     }
    301     public bool UpdateProblemData(ProblemData problemData) {
    302       try {
    303         CallAdminService(s => s.UpdateProblemData(problemData));
    304         return true;
    305       }
    306       catch (Exception ex) {
    307         ErrorHandling.ShowErrorDialog("Update problem data failed.", ex);
    308         return false;
    309       }
    310     }
    311     public ItemCollection<ProblemParameter> GetProblemParameters(long problemId) {
    312       try {
    313         ItemCollection<ProblemParameter> parameters = new ItemCollection<ProblemParameter>();
    314         parameters.AddRange(CallAdminService<ProblemParameter[]>(s => s.GetProblemParameters(problemId)).OrderBy(x => x.Name));
    315         return parameters;
    316       }
    317       catch (Exception ex) {
    318         ErrorHandling.ShowErrorDialog("Refresh problem parameters failed.", ex);
     362    #region Experiment Methods
     363    public ItemCollection<Experiment> GetExperiments(long algorithmId, long problemId) {
     364      try {
     365        ItemCollection<Experiment> experiments = new ItemCollection<Experiment>();
     366        experiments.AddRange(CallAdminService<Experiment[]>(s => s.GetExperiments(algorithmId, problemId)));
     367        return experiments;
     368      }
     369      catch (Exception ex) {
     370        ErrorHandling.ShowErrorDialog("Refresh experiments failed.", ex);
    319371        return null;
    320372      }
     
    323375
    324376    #region Run Methods
     377    public ItemCollection<Run> GetRuns(long experimentId) {
     378      try {
     379        ItemCollection<Run> runs = new ItemCollection<Run>();
     380        runs.AddRange(CallAdminService<Run[]>(s => s.GetRuns(experimentId)).OrderByDescending(x => x.FinishedDate));
     381        return runs;
     382      }
     383      catch (Exception ex) {
     384        ErrorHandling.ShowErrorDialog("Refresh runs failed.", ex);
     385        return null;
     386      }
     387    }
    325388    public bool AddRun(long algorithmId, long problemId, IAlgorithm algorithm) {
    326389      try {
     
    402465      } else {
    403466        AlgorithmParameterBlobValue value = new AlgorithmParameterBlobValue();
    404         value.Value = null;
     467        try {
     468          using (MemoryStream stream = new MemoryStream()) {
     469            XmlGenerator.Serialize(item, stream);
     470            stream.Close();
     471            value.Value = stream.ToArray();
     472          }
     473        }
     474        catch (Exception ex) {
     475          ErrorHandling.ShowErrorDialog(ex);
     476        }
    405477        return value;
    406478      }
     
    451523      } else {
    452524        ProblemParameterBlobValue value = new ProblemParameterBlobValue();
    453         value.Value = null;
     525        try {
     526          using (MemoryStream stream = new MemoryStream()) {
     527            XmlGenerator.Serialize(item, stream);
     528            stream.Close();
     529            value.Value = stream.ToArray();
     530          }
     531        }
     532        catch (Exception ex) {
     533          ErrorHandling.ShowErrorDialog(ex);
     534        }
    454535        return value;
    455536      }
     
    497578      } else {
    498579        ResultBlobValue value = new ResultBlobValue();
    499         value.Value = null;
     580        try {
     581          using (MemoryStream stream = new MemoryStream()) {
     582            XmlGenerator.Serialize(item, stream);
     583            stream.Close();
     584            value.Value = stream.ToArray();
     585          }
     586        }
     587        catch (Exception ex) {
     588          ErrorHandling.ShowErrorDialog(ex);
     589        }
    500590        return value;
    501591      }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs

    r4929 r4943  
    133133
    134134    private void refreshExperimentsButton_Click(object sender, EventArgs e) {
    135       experimentCollectionView.Content = null; // TODO
     135      experimentCollectionView.Content = OKBClient.Instance.GetExperiments(Content.Id, 0);
    136136    }
    137137  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.cs

    r4558 r4943  
    4747      OKBClient.Instance.Refreshing += new EventHandler(OKBClient_Refreshing);
    4848      OKBClient.Instance.Refreshed += new EventHandler(OKBClient_Refreshed);
    49       // TODO: do not forget to deregister events
    5049      PopulateComboBoxes();
    5150    }
     
    119118    protected override void OnClosed(FormClosedEventArgs e) {
    120119      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
     120      OKBClient.Instance.Refreshing -= new EventHandler(OKBClient_Refreshing);
     121      OKBClient.Instance.Refreshed -= new EventHandler(OKBClient_Refreshed);
    121122      base.OnClosed(e);
    122123    }
Note: See TracChangeset for help on using the changeset viewer.