Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RefactorPluginInfrastructure-2522/HeuristicLab.Optimizer/3.3/Plugin.cs.frame @ 14534

Last change on this file since 14534 was 13389, checked in by gkronber, 9 years ago

#2522: removed Starter form and instead init plugin discovery and launch of application from Startup project (.exe)

File size: 3.6 KB
RevLine 
[2754]1#region License Information
2/* HeuristicLab
[12012]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[2754]4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
[8818]22using System.Linq;
[2931]23using System.Windows.Forms;
[8076]24using HeuristicLab.Clients.Access;
[6827]25using HeuristicLab.Optimizer.Properties;
[2754]26using HeuristicLab.PluginInfrastructure;
27
28namespace HeuristicLab.Optimizer {
[13321]29  [Plugin("HeuristicLab.Optimizer", "3.3.13.$WCREV$")]
[2754]30  [PluginFile("HeuristicLab.Optimizer-3.3.dll", PluginFileType.Assembly)]
[4387]31  [PluginDependency("HeuristicLab.Clients.Common", "3.3")]
[4650]32  [PluginDependency("HeuristicLab.Collections", "3.3")]
[3384]33  [PluginDependency("HeuristicLab.Common", "3.3")]
[3702]34  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
[2754]35  [PluginDependency("HeuristicLab.Core", "3.3")]
36  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
[7908]37  [PluginDependency("HeuristicLab.Data", "3.3")]
[7985]38  [PluginDependency("HeuristicLab.Data.Views", "3.3")]
[3437]39  [PluginDependency("HeuristicLab.MainForm", "3.3")]
40  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
[3759]41  [PluginDependency("HeuristicLab.Optimization", "3.3")]
[7908]42  [PluginDependency("HeuristicLab.Parameters", "3.3")]
[4650]43  [PluginDependency("HeuristicLab.Persistence", "3.3")]
[7841]44  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
[8076]45  [PluginDependency("HeuristicLab.Clients.Access", "3.3")]
[2754]46  public class HeuristicLabOptimizerPlugin : PluginBase {
47  }
[2931]48
[13321]49  [Application("Optimizer", "HeuristicLab Optimizer 3.3.13.$WCREV$")]
[2931]50  internal class HeuristicLabOptimizerApplication : ApplicationBase {
[8818]51    public override void Run(ICommandLineArgument[] args) {
[13389]52      Application.EnableVisualStyles();
53      Application.SetCompatibleTextRenderingDefault(false);
[8818]54      HeuristicLab.MainForm.WindowsForms.MainForm mainForm = null;
[6827]55
56      if (Settings.Default.MainFormType == OptimizerMainFormTypes.DockingMainForm) {
57        mainForm = new OptimizerDockingMainForm(typeof(IOptimizerUserInterfaceItemProvider));
58      } else if (Settings.Default.MainFormType == OptimizerMainFormTypes.MultipleDocumentMainForm) {
59        mainForm = new OptimizerMultipleDocumentMainForm(typeof(IOptimizerUserInterfaceItemProvider));
60      } else if (Settings.Default.MainFormType == OptimizerMainFormTypes.SingleDocumentMainForm) {
61        mainForm = new OptimizerSingleDocumentMainForm(typeof(IOptimizerUserInterfaceItemProvider));
62      }
63
64      if (mainForm != null) {
[8076]65        ClientInformation.InitializeAsync();
66        UserInformation.InitializeAsync();
67
[6827]68        mainForm.ShowContentInViewHost = true;
[8821]69        var filesToOpen = args.OfType<OpenArgument>().Select(x => x.Value);
[8818]70        mainForm.Load += (sender, eventArgs) => FileManager.OpenFiles(filesToOpen);
[6827]71        Application.Run(mainForm);
72      } else {
73        MessageBox.Show("Error loading setting for the MainForm Type. Please check your configuration file!", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
74      }
[2931]75    }
76  }
[2754]77}
Note: See TracBrowser for help on using the repository browser.