private static void OutTransferFinished(object sender, OutTransferEventArgs args) { ActiveOutboundTransferProcess = null; OutboundTransferFinished?.Invoke(null, args); if (OutboundTransfersAllowed) { SendNextFile(); } else { OutboundTransfersAllowed = true; } }
/// <summary> /// Attempts to start the process of sending a file, returning the ID of the slot. If unsuccessful, returns -1 /// </summary> /// <param name="fStruct"></param> /// <param name="endPoint"></param> /// <returns></returns> private static bool SendFile(LocalFileStructure fStruct) { if (ActiveOutboundTransferProcess != null) { return(false); } ActiveOutboundTransferProcess = new OutBoundTransferProcess(fStruct, TargetEndPoint, MaxChunkSize, fStruct.FileID); ActiveOutboundTransferProcess.OutTransferFinished += OutTransferFinished; ActiveOutboundTransferProcess.OutTransferStarted += OutTransferStarted; ActiveOutboundTransferProcess.OutTransferProgress += OutTransferProgress; ActiveOutboundTransferProcess.Start(); return(true); }