/// <summary> /// Called when [stop internet connection watcher]. /// </summary> /// <returns>OnStopInternetConnectionWatcherResponse object.if successful return a "InternetConnetionWatcherStoped" Message if File watcher is already stoped or not created ergo return "InternetConnetionWatcherStopedBefore" message else return error</returns> public static OnStopInternetConnectionWatcherResponse OnStopInternetConnectionWatcher() { OnStopInternetConnectionWatcherResponse ROnStopInternetConnectionWatcherResponse = new OnStopInternetConnectionWatcherResponse(); try { if (miccw != null) { miccw.keepRunning = false; miccw = null; ROnStopInternetConnectionWatcherResponse.Description = "InternetConnetionWatcherStoped"; } else { ROnStopInternetConnectionWatcherResponse.Description = "InternetConnetionWatcherStopedBefore"; } } catch (Exception ex) { ROnStopInternetConnectionWatcherResponse.Errors.AddErrorToErrorList(MethodBase.GetCurrentMethod().ToString(), ex.Message); } return(ROnStopInternetConnectionWatcherResponse); }
/// <summary> /// Called when [start internet connection watcher]. /// </summary> /// <returns>OnStartInternetConnectionWatcherResponse object.if successful return a "InternetConnetionWatcherStarted" Message if File watcher is already running return "InternetConnetionWatcherStartedBefore" message else return error</returns> public static OnStartInternetConnectionWatcherResponse OnStartInternetConnectionWatcher() { OnStartInternetConnectionWatcherResponse ROnStartInternetConnectionWatcherResponse = new OnStartInternetConnectionWatcherResponse(); try { if (miccw == null) { miccw = new Internet_Connection_Control._m_Internet_Connection_Control_Watcher(); Thread InternetConnectionWatcherThread = new Thread(new ThreadStart(miccw.StartWatching)); InternetConnectionWatcherThread.Start(); ROnStartInternetConnectionWatcherResponse.Description = "InternetConnetionWatcherStarted"; } else { ROnStartInternetConnectionWatcherResponse.Description = "InternetConnetionWatcherStartedBefore"; } } catch (Exception ex) { ROnStartInternetConnectionWatcherResponse.Errors.AddErrorToErrorList(MethodBase.GetCurrentMethod().ToString(), ex.Message); } return(ROnStartInternetConnectionWatcherResponse); }