public void UpdateStatusString(FileSendStatus status) { switch (status) { case FileSendStatus.PREPARED: statusFile = "In preparazione per l'invio..."; break; case FileSendStatus.READY: statusFile = "Pronto per l'invio"; break; case FileSendStatus.CONFERMED: statusFile = "Confermato"; break; case FileSendStatus.REJECTED: statusFile = "Annullato"; break; case FileSendStatus.RESENT: statusFile = "Da rinviare"; break; case FileSendStatus.INPROGRESS: statusFile = "Invio in corso..."; break; case FileSendStatus.END: statusFile = "Fine invio"; break; } }
/// <summary> /// CHeck if the send file status is the same as the one received as argument /// </summary> /// <param name="ipUser">Destination Ip</param> /// <param name="pathFile">Path file</param> /// <param name="status">Status to update</param> /// <returns>Return true if the status is the same, false otherwise</returns> public bool CheckSendStatusFile(string ipUser, string pathFile, FileSendStatus status) { lock (FileToSend) { if (FileToSend.ContainsKey(ipUser) && FileToSend[ipUser].ContainsKey(pathFile) && (FileToSend[ipUser][pathFile] == status)) { return(true); } return(false); } }
/// <summary> /// Update send file status /// </summary> /// <param name="ipUser">Destination ip</param> /// <param name="pathFile">Path file</param> /// <param name="status">Status to update</param> /// <returns>True if the status is update, false otherwise</returns> public bool UpdateSendStatusFileForUser(string ipUser, string pathFile, FileSendStatus status) { lock (FileToSend) { Dictionary <string, FileSendStatus> currentDictionary; FileToSend.TryGetValue(ipUser, out currentDictionary); if (currentDictionary.ContainsKey(pathFile)) { FileToSend.AddOrUpdate(ipUser, (key) => currentDictionary, (key, oldValue) => { oldValue[pathFile] = status; return(oldValue); }); return(true); } return(false); } }