AEMManager.Program.Application_ThreadExit C# (CSharp) Method

Application_ThreadExit() static private method

static private Application_ThreadExit ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        static void Application_ThreadExit(object sender, EventArgs e)
        {
            // automatically stop instances that are still running on exit
              try {
            if (Program.InstanceList != null) {
              foreach (AemInstance instance in Program.InstanceList) {
            Process process = instance.GetInstanceJavaProcess();
            if (process != null && !process.HasExited) {
              try {
                AemActions.StopInstance(instance);
                instance.NotifyIcon.Visible = false;
                instance.NotifyIcon.Dispose();
                instance.NotifyIcon = null;
              }
              catch (Exception ex) {
                mLog.Error("Error stopping instance '" + instance.Name + "'.", ex);
              }
            }
              }
            }
              }
              catch (Exception ex) {
            mLog.Error("Error checking for running instances or application shutdown.", ex);
              }
        }