Exemple #1
0
        public override void Run(ICommandLineArgument[] args)
        {
            HeuristicLab.MainForm.WindowsForms.MainForm mainForm = null;

            if (Settings.Default.MainFormType == OptimizerMainFormTypes.DockingMainForm)
            {
                mainForm = new OptimizerDockingMainForm(typeof(IOptimizerUserInterfaceItemProvider));
            }
            else if (Settings.Default.MainFormType == OptimizerMainFormTypes.MultipleDocumentMainForm)
            {
                mainForm = new OptimizerMultipleDocumentMainForm(typeof(IOptimizerUserInterfaceItemProvider));
            }
            else if (Settings.Default.MainFormType == OptimizerMainFormTypes.SingleDocumentMainForm)
            {
                mainForm = new OptimizerSingleDocumentMainForm(typeof(IOptimizerUserInterfaceItemProvider));
            }

            if (mainForm != null)
            {
                ClientInformation.InitializeAsync();
                UserInformation.InitializeAsync();

                mainForm.ShowContentInViewHost = true;
                var filesToOpen = args.OfType <OpenArgument>().Select(x => x.Value);
                mainForm.Load += (sender, eventArgs) => FileManager.OpenFiles(filesToOpen);
                Application.Run(mainForm);
            }
            else
            {
                MessageBox.Show("Error loading setting for the MainForm Type. Please check your configuration file!", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }