Ejemplo n.º 1
0
        //=================================== ALL OF THE GLOBAL FUNCTIONS WILL BE BELOW HERE ===================================\\

        /// <summary>
        /// Exit the application and kill all running items
        /// </summary>
        internal static void exitApp(bool exitEnvironment = false)
        {
            //Delete the contents of the "Results" folder
            if (System.IO.Directory.Exists(@"C:\Allevate\Face-Searcher\Results"))
            {
                System.IO.Directory.Delete(@"C:\Allevate\Face-Searcher\Results", true);
                System.IO.Directory.CreateDirectory(@"C:\Allevate\Face-Searcher\Results");
            }
            //Kill the monitor thread
            if (camMonitorThread != null)
            {
                camMonitorThread.Abort();
            }
            //Kil the AureusEdge program
            AureusEdge.FreeAureus(mp_aureus, msg);
            //If anything else needs to be done before exit. Do it here
            try
            {
                if (CF != null)
                {
                    CF.Dispose();
                }
                if (DT != null)
                {
                    DT.Dispose();
                }
                if (ES != null)
                {
                    ES.Dispose();
                }
                if (LP != null)
                {
                    LP.Dispose();
                }
                if (NF != null)
                {
                    NF.Dispose();
                }
                if (DA != null)
                {
                    DA.Dispose();
                }
                if (IL != null)
                {
                    IL.Dispose();
                }

                Application.Exit();
                try
                {
                    Environment.Exit(0);
                }catch
                {
                    Environment.Exit(1);
                }
                //if (exitEnvironment)
                //{
                //    Environment.Exit(0);
                //}
            }
            catch
            {
                //Do Nothing
            }
        }