Exemplo n.º 1
0
        public void StopProgram()
        {
            if (Stopping != null)
            {
                try
                {
                    Stopping();
                }
                catch
                {
                    // ignored
                }
            }
            ProgramBlock.IsRunning = false;
            //
            // cleanup and deallocation stuff here
            //
            ModuleIsChangingHandler = null;
            ModuleChangedHandler    = null;
            SystemStarted           = null;
            SystemStopping          = null;
            Stopping = null;
            //
            foreach (string apiCall in _registeredApi)
            {
                ProgramDynamicApi.UnRegister(apiCall);
            }
            _registeredApi.Clear();
            //
            ((IProgramEngine)this).Unload();

            if (_programThread == null)
            {
                return;
            }
            try
            {
                if (!_programThread.Join(1000))
                {
#if NETCOREAPP
                    // _programThread.Abort(); => System.PlatformNotSupportedException: Thread abort is not supported on this platform.
                    _programThread.Interrupt();
#else
                    _programThread.Abort();
#endif
                }
            }
            catch
            {
                // ignored
            }
            _programThread = null;
        }
Exemplo n.º 2
0
        public void StopProgram()
        {
            if (Stopping != null)
            {
                try
                {
                    Stopping();
                }
                catch
                {
                    // ignored
                }
            }
            ProgramBlock.IsRunning = false;
            //
            // cleanup and deallocation stuff here
            //
            ModuleIsChangingHandler = null;
            ModuleChangedHandler    = null;
            SystemStarted           = null;
            SystemStopping          = null;
            Stopping = null;
            //
            foreach (string apiCall in _registeredApi)
            {
                ProgramDynamicApi.UnRegister(apiCall);
            }
            _registeredApi.Clear();
            //
            ((IProgramEngine)this).Unload();

            if (_programThread == null)
            {
                return;
            }
            try
            {
                if (!_programThread.Join(1000))
                {
                    _programThread.Abort();
                }
            }
            catch
            {
                // ignored
            }
            _programThread = null;
        }
Exemplo n.º 3
0
        public void StopProgram()
        {
            if (this.Stopping != null)
            {
                try { Stopping(); } catch { }
            }
            programBlock.IsRunning = false;
            //
            //TODO: complete cleanup and deallocation stuff here
            //
            ModuleIsChangingHandler = null;
            ModuleChangedHandler    = null;
            SystemStarted           = null;
            SystemStopping          = null;
            Stopping = null;
            //
            foreach (string apiCall in registeredApi)
            {
                ProgramDynamicApi.UnRegister(apiCall);
            }
            registeredApi.Clear();
            //
            (this as IProgramEngine).Unload();

            if (programThread != null)
            {
                try
                {
                    if (!programThread.Join(1000))
                    {
                        programThread.Abort();
                    }
                } catch { }
                programThread = null;
            }
        }