#region License Information
/* HeuristicLab
* Copyright (C) 2002-2008 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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using HeuristicLab.PluginInfrastructure;
using HeuristicLab.Core;
using System.IO;
namespace HeuristicLab.AdvancedOptimizationFrontend {
///
/// The main form of the application.
///
public partial class MainForm : Form, IControlManager {
#region Inner Types
private class Task {
public string filename;
public IStorable storable;
public IEditor editor;
private Task() { }
public Task(string filename, IStorable storable, IEditor editor) {
this.filename = filename;
this.storable = storable;
this.editor = editor;
}
}
#endregion
private object locker;
private int runningTasks;
///
/// Initializes a new instance of .
///
public MainForm() {
InitializeComponent();
locker = new object();
runningTasks = 0;
AvailableOperatorsForm form = new AvailableOperatorsForm();
form.Show(dockPanel);
// discover creatable items
var creatables = from x in ApplicationManager.Manager.GetTypes(typeof(IEditable))
orderby x.Name
select x;
foreach (Type type in creatables) {
if (!type.IsAbstract) {
ToolStripMenuItem item = new ToolStripMenuItem();
item.Tag = type;
item.Text = "&" + type.Name + "...";
item.Click += new EventHandler(newToolStripMenuItem_Click);
newToolStripMenuItem.DropDownItems.Add(item);
item = new ToolStripMenuItem();
item.Tag = type;
item.Text = "&" + type.Name + "...";
item.Click += new EventHandler(newToolStripMenuItem_Click);
newToolStripDropDownButton.DropDownItems.Add(item);
}
}
}
#region IControlManager Members
///
/// Displays the given .
///
/// Thrown when the given
/// is neither a view nor an editor.
/// The control to display.
public void ShowControl(object control) {
if (InvokeRequired) Invoke((Action