#region License Information /* HeuristicLab * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Windows.Forms; using HeuristicLab.Clients.Hive.ExperimentManager; using HeuristicLab.MainForm; namespace HeuristicLab.Clients.Hive.Views { [View("HiveJob View")] [Content(typeof(OptimizerHiveJob), true)] public partial class OptimizerHiveJobView : HiveJobView { public new OptimizerHiveJob Content { get { return (OptimizerHiveJob)base.Content; } set { if (base.Content != value) { base.Content = value; } } } public OptimizerHiveJobView() { InitializeComponent(); } protected override void Job_ItemChanged(object sender, EventArgs e) { if (Content != null && Content.Job != null && Content.ItemJob.Item != null) { runCollectionViewHost.Content = Content.ItemJob.Item.Runs; } else { runCollectionViewHost.Content = null; } } #region Content Events protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Paused; this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating; this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused); } #endregion #region Child Control Events private void restartButton_Click(object sender, EventArgs e) { Content.Restart(); } private void pauseButton_Click(object sender, EventArgs e) { Content.Pause(); } private void stopButton_Click(object sender, EventArgs e) { Content.Stop(); } #endregion } }