public static void Start()
 {
     if (_studentMapping == null)
     {
         _studentMapping = new StudentMapping();
         _studentMapping._task = _studentMapping.processStudentMappingsAsync();
     }
 }
 public static void Stop()
 {
     if (_studentMapping != null)
     {
         if (_studentMapping._task.Status == TaskStatus.Running && !_studentMapping._task.Wait(TimeSpan.FromSeconds(100)))
             ErrorLog.Write("Failed to stop student mapping process");
         _studentMapping = null;
     }
 }
예제 #3
0
 protected override void OnStop()
 {
     try
     {
         Service.IsStopping = true;
         StudentMapping.Stop();
         //UploadedFileParser.Stop();
     }
     catch
     {
         //TODO: Log the error
     }
 }
예제 #4
0
        protected override void OnStart(string[] args)
        {
            Task.Run(() =>
            {
                try
                {
                    Service.IsStopping = false;

                    StudentMapping.Start();
                    //UploadedFileParser.Start();
                }
                catch (Exception ex)
                {
                    // stop the service
                    ErrorLog.Write(ex);
                    base.Stop();
                }
            });
        }