#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 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.Core;
using HeuristicLab.Core.Views;
using HeuristicLab.MainForm;
using System.ComponentModel;
namespace HeuristicLab.MPIEngine {
///
/// Engine for MPI
///
[View("MPIEngine View")]
[Content(typeof(MPIEngine), true)]
public partial class MPIEngineView : ItemView {
#region Basics
///
/// Gets or sets the current engine.
///
/// Uses property of base class .
public new MPIEngine Content {
get { return (MPIEngine)base.Content; }
set { base.Content = value; }
}
///
/// Initializes a new instance of .
///
public MPIEngineView() {
InitializeComponent();
}
///
/// Removes the event handlers from the underlying .
///
/// Calls of base class .
protected override void DeregisterContentEvents() {
if (Content != null) {
Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
}
base.DeregisterContentEvents();
}
///
/// Adds event handlers to the underlying .
///
/// Calls of base class .
protected override void RegisterContentEvents() {
base.RegisterContentEvents();
if (Content != null) {
Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
}
}
void Content_ExecutionTimeChanged(object sender, EventArgs e) {
if (InvokeRequired) {
Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
} else {
propertyGrid.Refresh();
}
}
void Content_ExecutionStateChanged(object sender, EventArgs e) {
if (InvokeRequired) {
Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
} else {
propertyGrid.Refresh();
}
}
///
/// Updates all controls with the latest data of the model.
///
/// Calls of base class .
protected override void OnContentChanged() {
this.propertyGrid.SelectedObject = Content;
base.OnContentChanged();
}
protected override void SetEnabledStateOfControls() {
base.SetEnabledStateOfControls();
}
#endregion
}
}