#region License Information /* HeuristicLab * Copyright (C) 2002-2012 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 HeuristicLab.Core.Views; using HeuristicLab.MainForm; using HeuristicLab.PluginInfrastructure; namespace HeuristicLab.Clients.OKB.RunCreation.Views { [View("OKBRun View")] [Content(typeof(OKBRun), true)] public sealed partial class OKBRunView : ItemView { public new OKBRun Content { get { return (OKBRun)base.Content; } set { base.Content = value; } } public OKBRunView() { InitializeComponent(); } protected override void DeregisterContentEvents() { Content.StoredChanged -= new System.EventHandler(Content_StoredChanged); base.DeregisterContentEvents(); } protected override void RegisterContentEvents() { base.RegisterContentEvents(); Content.StoredChanged += new System.EventHandler(Content_StoredChanged); } protected override void OnContentChanged() { base.OnContentChanged(); viewHost.Content = Content == null ? null : Content.WrappedRun; } protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); storeButton.Enabled = (Content != null) && !ReadOnly && !Locked && !Content.Stored; } #region Content Events private void Content_StoredChanged(object sender, System.EventArgs e) { storeButton.Enabled = !Content.Stored; } #endregion #region Control Events private void storeButton_Click(object sender, System.EventArgs e) { try { Content.Store(); } catch (Exception ex) { ErrorHandling.ShowErrorDialog(this, "Store failed.", ex); } } #endregion } }