Пример #1
0
        private void _openFromCacheToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_cache == null)
            {
                UI.Helper.ShowInformation(this, "This feature is only available when a Document Cache is used");
                return;
            }

            using (var dlg = new UI.InputDialog())
            {
                dlg.Text       = "Document ID";
                dlg.ValueTitle = "Enter the ID of a document previously saved into the cache";

                // If the document is already in the cache, show its ID for easy re-loading
                LEADDocument document = _documentViewer.Document;
                if (document != null && DocumentFactory.GetDocumentCacheInfo(_cache, document.DocumentId) != null)
                {
                    dlg.ValueDescription1 = "The current document ID is:";
                    dlg.Value             = document.DocumentId;
                }
                else
                {
                    dlg.Value = string.Empty;
                }
                dlg.AllowEmptyValue = false;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    LoadDocumentFromCache(dlg.Value);
                }
            }
        }
Пример #2
0
 private void _gotoPageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dlg = new UI.InputDialog())
     {
         dlg.Text       = "Go To Page";
         dlg.ValueTitle = null;
         var pageCount = _documentViewer.PageCount;
         dlg.ValueDescription1 = string.Format("This document has {0} pages. Select the page number to go to", pageCount);
         dlg.UseIntValues      = true;
         dlg.MinIntValue       = 1;
         dlg.MaxIntValue       = pageCount;
         dlg.IntValue          = _documentViewer.View.ImageViewer.GetLargestVisibleItemIndex(ImageViewerItemPart.Item) + 1;
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             try
             {
                 _documentViewer.Commands.Run(DocumentViewerCommands.PageGoto, dlg.IntValue);
             }
             catch (Exception ex)
             {
                 UI.Helper.ShowError(this, ex);
             }
         }
     }
 }
Пример #3
0
 private void _userNameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dlg = new UI.InputDialog())
     {
         dlg.Text              = "User Name";
         dlg.ValueTitle        = null;
         dlg.ValueDescription1 = "Enter user name for modifying annotations in the document";
         dlg.Value             = _documentViewer.UserName;
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             _documentViewer.UserName = dlg.Value;
         }
     }
 }