fix labels showing default values, clear up _view_only variable use

This commit is contained in:
Jonathan Jenne 2020-03-17 14:00:05 +01:00
parent e013fd4a25
commit d7bbd08a36
2 changed files with 25 additions and 29 deletions

View File

@ -25,7 +25,8 @@ Public Class DocumentViewer
Private _licenseManager As New GdPicture14.LicenseManager()
Private _logConfig As LogConfig
Private _logger As Logger
Private _view_only As Boolean = False
Private _hide_file_info_from_user As Boolean = False
' List of all created temp files when converting msg files
Private _TempFiles As New List(Of String)
@ -90,10 +91,6 @@ Public Class DocumentViewer
DoLoadFile(FilePath)
If _view_only Then
statusLabel.Text = FilePath
End If
UpdateMainUi()
End Sub
@ -141,12 +138,15 @@ Public Class DocumentViewer
RichEditControl1.Visible = True
RichEditControl1.Dock = DockStyle.Fill
Me.infoLabel.Text = "Type: " & "MSG Email File"
Case ".EML"
RichEditControl1.LoadDocument(FilePath, DevExpress.XtraRichEdit.DocumentFormat.Mht)
RichEditControl1.Visible = True
RichEditControl1.Dock = DockStyle.Fill
Me.infoLabel.Text = "Type: " & "EML Email File"
Case ".XLSX", ".XLS", "CSV"
Dim oFormat As DevExpress.Spreadsheet.DocumentFormat = Undefined
@ -164,13 +164,22 @@ Public Class DocumentViewer
SpreadsheetControl1.Visible = True
SpreadsheetControl1.Dock = DockStyle.Fill
Me.infoLabel.Text = "Type: " & "Excel/CSV File"
Case Else
_logger.Info("Displaying file {0}", FilePath)
mainToolStrip.Visible = True
GdViewer.DisplayFromFile(FilePath)
Me.infoLabel.Text = "Type: " & GetDocumentTypeLabel()
End Select
If _hide_file_info_from_user Then
statusLabel.Text = String.Empty
Else
statusLabel.Text = "Path: " & FilePath
End If
Catch ex As Exception
_logger.Error(ex)
End Try
@ -207,14 +216,21 @@ Public Class DocumentViewer
Return result
End Function
Public Sub RightOnlyView(ValueRight As Boolean)
If ValueRight Then
''' <summary>
''' Configures the viewer to hide the file path to the end-user.
''' </summary>
''' <param name="ViewOnly">
''' True means that all file info should be hidden from the end-user
''' False means the end user may see the filepath or other info about the file
''' </param>
Public Sub RightOnlyView(ViewOnly As Boolean)
If ViewOnly Then
btnPrint.Visible = False
Else
btnPrint.Visible = True
End If
_view_only = ValueRight
_hide_file_info_from_user = Not ViewOnly
End Sub
Private Sub UpdateMainUi()
Exit Sub
@ -483,24 +499,6 @@ Public Class DocumentViewer
btnLastPage.Enabled = True
End If
cbZoom.Text = String.Format(CultureInfo.InvariantCulture, "{0:#0.##%}", GdViewer.Zoom)
Dim widthInches, heightInches As Double
If GdViewer.GetDocumentType = DocumentType.DocumentTypePDF Then
widthInches = GdViewer.PdfGetPageWidth / 72
heightInches = GdViewer.PdfGetPageHeight / 72
Else
widthInches = GdViewer.PageWidth / GdViewer.HorizontalResolution
heightInches = GdViewer.PageHeight / GdViewer.VerticalResolution
End If
Me.infoLabel.Text = "Type: " + GetDocumentTypeLabel() + " - " +
"Pagesize (zoll): " + Trim(Str(Math.Round(widthInches, 2))) + " × " + Trim(Str(Math.Round(heightInches, 2))) + " - " +
"Pagesize (pixel): " + Trim(Str(GdViewer.PageWidth)) + " × " + Trim(Str(GdViewer.PageHeight)) + " - " +
"Horizontal resolution: " + Trim(Str(Math.Round(GdViewer.HorizontalResolution, 2))) + " DPI - " +
"Vertical resolution: " + Trim(Str(Math.Round(GdViewer.VerticalResolution, 2))) + " DPI"
End Sub
Private Sub btnFitWidth_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFitWidth.Click

View File

@ -482,9 +482,7 @@ Public Class ImportZUGFeRDFiles
' PropertyMap items with `IsGrouped = False` are handled normally
Dim oDefaultProperties As Dictionary(Of String, XmlItemProperty) = oArgs.PropertyMap.
Where(Function(Item As KeyValuePair(Of String, XmlItemProperty))
Return Item.Value.IsGrouped = False
End Function).
Where(Function(Item) Item.Value.IsGrouped = True).
ToDictionary(Function(Item) Item.Key,
Function(Item) Item.Value)