Esempio n. 1
0
        void scu_ImageStoreCompleted(object sender, ImageStoreEventArgs e)
        {
            StorageScu scu  = sender as StorageScu;
            Random     rand = new Random();

            //Thread.Sleep(rand.Next(300, 1000));
            textBox1.BeginInvoke(new LogDelegate(Log), e.StorageInstance.SopInstanceUid);
        }
Esempio n. 2
0
 private static void ScuOnImageStorageCompleted(object sender, ImageStoreEventArgs eventArgs)
 {
     // We could do something here, but at the moment we're not. ClearCanvas already spams the log.
     //Log.GetLogger().Debug(eventArgs.StorageInstance.SendStatus);
 }
        private void OnImageSent(object sender, ImageStoreEventArgs ev)
        {
            var scu             = sender as ImageViewerStorageScu;
            var storageInstance = ev.StorageInstance;

            Progress.TotalImagesToSend = _scu.TotalSubOperations;

            if (storageInstance.SendStatus.Status == DicomState.Success)
            {
                Progress.SuccessSubOperations++;
                Progress.StatusDetails = string.Empty;
            }
            else if (storageInstance.SendStatus.Status == DicomState.Failure)
            {
                Progress.FailureSubOperations++;
                Progress.StatusDetails = storageInstance.ExtendedFailureDescription;
                if (String.IsNullOrEmpty(Progress.StatusDetails))
                {
                    Progress.StatusDetails = storageInstance.SendStatus.ToString();
                }

                if (_scu != null)
                {
                    _scu.FailureDescription = Progress.StatusDetails;
                }
            }
            else if (storageInstance.SendStatus.Status == DicomState.Warning)
            {
                Progress.WarningSubOperations++;
                Progress.StatusDetails = storageInstance.ExtendedFailureDescription;
                if (String.IsNullOrEmpty(Progress.StatusDetails))
                {
                    Progress.StatusDetails = storageInstance.SendStatus.ToString();
                }

                if (_scu != null)
                {
                    _scu.FailureDescription = Progress.StatusDetails;
                }
            }

            Proxy.UpdateProgress();

            if (PublishFiles != null &&
                PublishFiles.DeletionBehaviour != DeletionBehaviour.None)
            {
                bool deleteFile = false;
                if (storageInstance.SendStatus.Status != DicomState.Failure)
                {
                    deleteFile = true;
                }
                else if (PublishFiles.DeletionBehaviour == DeletionBehaviour.DeleteAlways)
                {
                    deleteFile = true;
                }

                if (deleteFile)
                {
                    try
                    {
                        FileUtils.Delete(storageInstance.Filename);
                    }
                    catch (Exception e)
                    {
                        Platform.Log(LogLevel.Warn, e,
                                     "Failed to delete file after storage: {0}",
                                     storageInstance.Filename);
                    }
                }
            }
        }