void airServer_UserReceiveFilesProgress(AirFileExchange.Air.SendFile sendFile, AirServer.IPEndPointHolder remotePoint, long receivedCurrent, long currentSize, long receivedTotal, long totalSize, object state, out bool cancel) { UserIcon userIcon = (UserIcon)state; cancel = isClosed || userIcon.IsCanceled; if (Dispatcher.Thread != Thread.CurrentThread) { Dispatcher.BeginInvoke(new AirServer.UserReceiveFilesProgress(airServer_UserReceiveFilesProgress), new object[] { sendFile, remotePoint, receivedCurrent, currentSize, receivedTotal, totalSize, state, cancel }); return; } userIcon.ProgressValue = 10000 * receivedTotal / totalSize; }
void airServer_UserReceiveFilesComplete(AirFileExchange.Air.SendFiles sendFiles, AirServer.IPEndPointHolder remotePoint, object state, Exception e) { if (Dispatcher.Thread != Thread.CurrentThread) { Dispatcher.BeginInvoke(new AirServer.UserReceiveFilesComplete(airServer_UserReceiveFilesComplete), new object[] { sendFiles, remotePoint, state, e }); return; } UserIcon userIcon = (UserIcon)state; userIcon.ProgressValue = 0; userIcon.LastStatus = e == null ? UserIcon.OperationStatus.Success : UserIcon.OperationStatus.Failed; }