Example #1
0
        /// <summary>
        /// Saves any changes made when the form is closed.
        /// </summary>
        /// <param name="sender">Automatically generated by Visual Studio.</param>
        /// <param name="e">Automatically generated by Visual Studio.</param>
        private void LoginScreen_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!(PlotController.getCurrentPlotProcess() == null))
            {
                //Kills any persistent Processes.
                try
                {
                    //PlotController.getCurrentPlotProcess().Kill();
                    //PlotController.getCurrentPlotProcess().WaitForExit();
                    //PlotController.getCurrentPlotProcess().Dispose();
                }
                catch (Exception exp) {
                    Console.WriteLine(exp.StackTrace);
                }
            }

            foreach (var process in Process.GetProcessesByName("MPAiVowelRunner"))
            {
                if (process == null)
                {
                    process.Kill();
                    process.WaitForExit();
                    process.Dispose();
                }
            }
            foreach (var process in Process.GetProcessesByName("MPAiPlotRunner"))
            {
                if (process == null)
                {
                    process.Kill();
                    process.WaitForExit();
                    process.Dispose();
                }
            }

            UserManagement.WriteSettings();
            DirectoryManagement.WritePaths();
        }