private void Revert(IEnumerable <IClipboardItem> items)
        {
            try
            {
                var itemList = items.ToList();
                foreach (var item in itemList.Where(item => item.IsSerialized()))
                {
                    var clipboard = KeyImageClipboard.GetKeyImageClipboard(Context.DesktopWindow);
                    var selectionDocumentInstanceUid = item.GetSelectionDocumentInstanceUid();
                    var context = clipboard.AvailableContexts.FirstOrDefault(c => c.DocumentInstanceUid == selectionDocumentInstanceUid);
                    if (context != null)
                    {
                        if (item.RevertKeyImage(context))
                        {
                            clipboard.CurrentContext = context;
                        }
                    }
                }

                if (itemList.Any(item => !item.IsSerialized()))
                {
                    Context.DesktopWindow.ShowMessageBox(SR.MessageUnableToRevertSomeKeyImages, MessageBoxActions.Ok);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.Report(ex, Context.DesktopWindow);
            }
        }
Exemplo n.º 2
0
        private bool TryUpdateExistingItem(IPresentationImage image)
        {
            var koDocument = image.FindParentKeyObjectDocument();

            if (koDocument != null)
            {
                var clipboard = KeyImageClipboard.GetKeyImageClipboard(ImageViewer);
                var context   = clipboard.AvailableContexts.FirstOrDefault(c => c.DocumentInstanceUid == koDocument.SopCommon.SopInstanceUid);
                if (context != null)
                {
                    if (image.UpdateKeyImage(context))
                    {
                        clipboard.CurrentContext = context;
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 3
0
 private void Revert(IEnumerable <IClipboardItem> items)
 {
     try
     {
         foreach (var item in items.ToList())
         {
             var clipboard = KeyImageClipboard.GetKeyImageClipboard(Context.DesktopWindow);
             var selectionDocumentInstanceUid = item.GetSelectionDocumentInstanceUid();
             var context = clipboard.AvailableContexts.FirstOrDefault(c => c.DocumentInstanceUid == selectionDocumentInstanceUid);
             if (context != null)
             {
                 if (item.RevertKeyImage(context))
                 {
                     clipboard.CurrentContext = context;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionHandler.Report(ex, Context.DesktopWindow);
     }
 }
        internal static void Launch(IDesktopWindow desktopWindow)
        {
            var info = KeyImageClipboard.GetKeyImageClipboard(desktopWindow);

            if (info == null)
            {
                throw new ArgumentException("There is no valid key image data available for the given window.", "desktopWindow");
            }

            KeyImageInformationEditorComponent component = new KeyImageInformationEditorComponent();

            component.Description       = info.Description;
            component.DocumentTitle     = info.DocumentTitle;
            component.SeriesDescription = info.SeriesDescription;

            ApplicationComponentExitCode exitCode = LaunchAsDialog(desktopWindow, component, SR.TitleEditKeyImageInformation);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                info.Description       = component.Description;
                info.DocumentTitle     = component.DocumentTitle;
                info.SeriesDescription = component.SeriesDescription;
            }
        }