/// <summary> /// Delete a standard mail /// </summary /// <param name="Elem">The mail to delete</param> /// <returns>True if deleted successfully, otherwise, False</returns> public static bool DeleteStandardMail(string Elem) { SpooledObject objToDel = QueueStandard.GiveSpooledObject(Elem); bool flagIsDeleted = false; switch (objToDel.State) { case StateSpooledObject.queued: { QueueStandard.Remove(Elem); File.Delete(Elem); ActiveQLibrary.Form.ManageForm.RemoveElemStandardQueue(Elem); flagIsDeleted = true; } break; case StateSpooledObject.dispacher: { if (_processer.Dispacher.Delete(Elem) == true) { QueueStandard.Remove(Elem); File.Delete(Elem); ActiveQLibrary.Form.ManageForm.RemoveElemStandardQueue(Elem); flagIsDeleted = true; } else { flagIsDeleted = false; } } break; case StateSpooledObject.sent: { flagIsDeleted = false; } break; } return(flagIsDeleted); }
/// <summary> /// Function used in the thread standard. /// </summary> private void FctThreadProcesserStandard() { IsRunningStandard = true; while (IsRunningStandard == true) { try { Global.Log.WriteEvent(LogType.debug, string.Format("[PROCESSER:STD] Scanning standard queue...")); // check if the queue is empty if (QueueStandard.IsEmpty() == false) { // give all the elements in the queue and dispach it ArrayList queuedObject = QueueStandard.GiveSpooledObject(StateSpooledObject.queued); foreach (SpooledObject Object in queuedObject) { QueueStandard.ModifyState(Object.Name, StateSpooledObject.dispacher); _dispacher.AddToDispacher(Object); } } Global.Log.WriteEvent(LogType.debug, string.Format("[PROCESSER:STD] Next scan in {0} seconds", (float)_tempoThread / 1000)); Thread.Sleep(_tempoThread); } catch (ThreadAbortException) { } catch (Exception ex) { Global.Log.WriteError("[PROCESSER:STD] " + ex.Message); Global.Log.WriteError("[PROCESSER:STD] " + ex.StackTrace); } } }