Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2094


Ignore:
Timestamp:
06/25/09 12:46:44 (15 years ago)
Author:
gkronber
Message:

Fixed updating of executer and dispatcher views and renamed ServerForm to ServerView. #676 (Cockpit for the CEDMA Server to control algorithm settings)

Location:
trunk/sources/HeuristicLab.CEDMA.Server/3.3
Files:
9 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs

    r2088 r2094  
    4141    private IStore store;
    4242    private DataSet dataset;
    43 
     43    internal event EventHandler Changed;
    4444    public IEnumerable<string> AllowedTargetVariables {
    4545      get {
     
    6868        if (datasetEntities.Count() == 0) return null;
    6969        dataset = new DataSet(store, datasetEntities.ElementAt(0));
     70        OnChanged();
    7071      }
    7172      int targetVariable = SelectTargetVariable(dataset.Problem.AllowedTargetVariables.ToArray());
     
    108109    }
    109110
     111    private void OnChanged() {
     112      if (Changed != null) Changed(this, new EventArgs());
     113    }
     114
    110115    #region IViewable Members
    111116
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.cs

    r2088 r2094  
    1212  public partial class DispatcherView : ViewBase {
    1313    private DispatcherBase dispatcher;
    14     public DispatcherView(DispatcherBase dispatcher) {
     14    public DispatcherView(DispatcherBase dispatcher) : base() {
    1515      this.dispatcher = dispatcher;
    1616      InitializeComponent();
    17 
    1817      UpdateControls();
     18      dispatcher.Changed += (sender, args) => UpdateControls();
    1919    }
    2020
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs

    r2088 r2094  
    4242namespace HeuristicLab.CEDMA.Server {
    4343  public abstract class ExecuterBase : IExecuter {
     44    internal event EventHandler Changed;
     45
    4446    private IDispatcher dispatcher;
    4547    protected IDispatcher Dispatcher {
     
    5456        if (value < 0) throw new ArgumentException("Only positive values are allowed for MaxActiveJobs");
    5557        maxActiveJobs = value;
     58        OnChanged();
    5659      }
    5760    }
     
    130133    public abstract string[] GetJobs();
    131134
     135    protected internal void OnChanged() {
     136      if (Changed != null) Changed(this, new EventArgs());
     137    }
    132138
    133139    #region IViewable Members
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterView.Designer.cs

    r2088 r2094  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.components = new System.ComponentModel.Container();
    27       this.refreshTimer = new System.Windows.Forms.Timer(this.components);
    2826      this.jobsList = new System.Windows.Forms.ListBox();
    2927      this.maxJobsLabel = new System.Windows.Forms.Label();
     
    3129      ((System.ComponentModel.ISupportInitialize)(this.maxActiveJobs)).BeginInit();
    3230      this.SuspendLayout();
    33       //
    34       // refreshTimer
    35       //
    36       this.refreshTimer.Interval = 1000;
    37       this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick);
    3831      //
    3932      // jobsList
     
    8679    #endregion
    8780
    88     private System.Windows.Forms.Timer refreshTimer;
    8981    private System.Windows.Forms.ListBox jobsList;
    9082    private System.Windows.Forms.Label maxJobsLabel;
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterView.cs

    r2088 r2094  
    1212  public partial class ExecuterView : ViewBase {
    1313    private ExecuterBase executer;
    14     public ExecuterView(ExecuterBase executer) {
     14    public ExecuterView(ExecuterBase executer)
     15      : base() {
    1516      this.executer = executer;
    1617      InitializeComponent();
    17       refreshTimer.Enabled = true;
     18      maxActiveJobs.Value = executer.MaxActiveJobs;
     19      executer.Changed += (sender, args) => UpdateControls();
    1820    }
    1921
    20     private void refreshTimer_Tick(object sender, EventArgs e) {
    21       jobsList.DataSource = executer.GetJobs();
     22    protected override void UpdateControls() {
     23      if (InvokeRequired) Invoke((Action)UpdateControls);
     24      else {
     25        base.UpdateControls();
     26        maxActiveJobs.Value = executer.MaxActiveJobs;
     27        jobsList.DataSource = executer.GetJobs();
     28        jobsList.Refresh();
     29      }
    2230    }
    2331
    24     private void maxActiveJobsUpDown_ValueChanged(object sender, EventArgs e) {
     32    private void maxActiveJobs_ValueChanged(object sender, EventArgs e) {
    2533      executer.MaxActiveJobs = Convert.ToInt32(maxActiveJobs.Value);
    2634    }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterView.resx

    r2088 r2094  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="refreshTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121     <value>17, 17</value>
    122   </metadata>
    123120</root>
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs

    r2073 r2094  
    6161
    6262    protected override void StartJobs() {
    63       Dictionary<WaitHandle, AsyncGridResult> asyncResults = new Dictionary<WaitHandle,AsyncGridResult>();
     63      Dictionary<WaitHandle, AsyncGridResult> asyncResults = new Dictionary<WaitHandle, AsyncGridResult>();
    6464      while (true) {
    6565        try {
     
    8080                activeAlgorithms.Add(asyncResult, algorithm);
    8181              }
     82              OnChanged();
    8283            }
    8384          }
     
    9596              asyncResults.Remove(readyHandle);
    9697            }
     98            OnChanged();
    9799            try {
    98100              IEngine finishedEngine = jobManager.EndExecuteEngine(finishedResult);
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/HeuristicLab.CEDMA.Server-3.3.csproj

    r2088 r2094  
    112112    <Compile Include="HeuristicLabCedmaServerPlugin.cs" />
    113113    <Compile Include="Properties\AssemblyInfo.cs" />
    114     <Compile Include="ServerForm.cs">
     114    <Compile Include="ServerView.cs">
    115115      <SubType>UserControl</SubType>
    116116    </Compile>
    117     <Compile Include="ServerForm.designer.cs">
    118       <DependentUpon>ServerForm.cs</DependentUpon>
     117    <Compile Include="ServerView.designer.cs">
     118      <DependentUpon>ServerView.cs</DependentUpon>
    119119    </Compile>
    120120    <Compile Include="SimpleDispatcher.cs" />
     
    177177      <DependentUpon>ExecuterView.cs</DependentUpon>
    178178    </EmbeddedResource>
    179     <EmbeddedResource Include="ServerForm.resx">
    180       <DependentUpon>ServerForm.cs</DependentUpon>
    181       <SubType>Designer</SubType>
     179    <EmbeddedResource Include="ServerView.resx">
     180      <DependentUpon>ServerView.cs</DependentUpon>
    182181    </EmbeddedResource>
    183182  </ItemGroup>
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs

    r2088 r2094  
    108108
    109109    public IView CreateView() {
    110       return new ServerForm(this);
     110      return new ServerView(this);
    111111    }
    112112
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerView.cs

    r2089 r2094  
    4141
    4242namespace HeuristicLab.CEDMA.Server {
    43   public partial class ServerForm : ViewBase {
     43  public partial class ServerView : ViewBase {
    4444    private Server server;
    4545
    46     public ServerForm(Server server) {
     46    public ServerView(Server server) : base() {
    4747      this.server = server;
    4848      InitializeComponent();
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerView.designer.cs

    r2089 r2094  
    2121
    2222namespace HeuristicLab.CEDMA.Server {
    23   partial class ServerForm {
     23  partial class ServerView {
    2424    /// <summary>
    2525    /// Required designer variable.
Note: See TracChangeset for help on using the changeset viewer.