예제 #1
0
        /// <summary>
        /// Called when [stop process watcher].
        /// </summary>
        /// <returns>OnStopProcessWatcherResponse object.if successful un init object mpmw of _m_Process_Manager_Watcher and then stop it and return "ProcessWatcherStoped" message if the process watcher is already stoped return "ProcessWatcherStopedBefore" message else return error</returns>
        public static OnStopProcessWatcherResponse OnStopProcessWatcher()
        {
            OnStopProcessWatcherResponse ROnStopProcessWatcherResponse = new OnStopProcessWatcherResponse();

            try
            {
                if (mpmw != null)
                {
                    mpmw.keepRunning = false;
                    mpmw             = null;
                    ROnStopProcessWatcherResponse.Description = "ProcessWatcherStoped";
                }
                else
                {
                    ROnStopProcessWatcherResponse.Description = "ProcessWatcherStopedBefore";
                }
            }
            catch (Exception ex)
            {
                ROnStopProcessWatcherResponse.Errors.AddErrorToErrorList(MethodBase.GetCurrentMethod().ToString(), ex.Message);
            }
            return(ROnStopProcessWatcherResponse);
        }
예제 #2
0
        /// <summary>
        /// Called when [start process watcher].
        /// </summary>
        /// <returns>OnStartProcessWatcherResponse object.if successful init object mpmw of _m_Process_Manager_Watcher and then start it and return "ProcessWatcherStarted" message if the process watcher is already running return "ProcessWatcherStartedBefore" message else return error</returns>
        public static OnStartProcessWatcherResponse OnStartProcessWatcher()
        {
            OnStartProcessWatcherResponse ROnStartProcessWatcherResponse = new OnStartProcessWatcherResponse();

            try
            {
                if (mpmw == null)
                {
                    mpmw = new  Process_Watcher._m_Process_Manager_Watcher();
                    Thread ProcessWatcherThread = new Thread(new ThreadStart(mpmw.StartWatching));
                    ProcessWatcherThread.Start();
                    ROnStartProcessWatcherResponse.Description = "ProcessWatcherStarted";
                }
                else
                {
                    ROnStartProcessWatcherResponse.Description = "ProcessWatcherStartedBefore";
                }
            }
            catch (Exception ex)
            {
                ROnStartProcessWatcherResponse.Errors.AddErrorToErrorList(MethodBase.GetCurrentMethod().ToString(), ex.Message);
            }
            return(ROnStartProcessWatcherResponse);
        }