public MainForm(IList<IProcessManager> processManagers, VersionsManager phpVersions, WaitingForm waitingForm) { this.processManagers = processManagers; this.phpVersions = phpVersions; this.waitingForm = waitingForm; this.InitializeComponent(); this.InitializeMainMenu(); }
private static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var processManagers = new List<IProcessManager>(); var exePath = System.Reflection.Assembly.GetEntryAssembly().Location; var configPath = exePath.Substring(0, exePath.Length - 3) + "json"; var config = new ConfigLoader().Load(configPath); config.Services?.ForEach(service => { processManagers.Add(new ServiceManager(service.Name, service.Label)); }); config.Executables?.ForEach(exe => { List<ProcessManager> processes; if (exe.Multiple == null) { processes = new List<ProcessManager>() { new ProcessManager(exe.Path, exe.Args, exe.Label) }; } else { processes = exe.Multiple .Select(child => new ProcessManager(child.Path, child.Args, child.Label, exe.Label)) .ToList(); } processes.ForEach(process => processManagers.Add(process)); injectRunningProcesses(processes, processes[0].FileName); }); var phpVersions = new VersionsManager(config.PhpDir, processManagers); var waitingForm = new WaitingForm(); new MainForm(processManagers, phpVersions, waitingForm); Application.Run(); } catch (Exception ex) { MessageBox.Show("Something went wrong!\n" + ex.Message, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }