-Sistemato visualizzazione preview pdf immagine e tasto chiudi preview
This commit is contained in:
@@ -110,7 +110,7 @@ Partial Public Class PdfViewer
|
||||
.HorizontalAlignment = HorizontalAlignment.Center,
|
||||
.Margin = New Thickness(5, 20, 5, 20),
|
||||
.SnapsToDevicePixels = True,
|
||||
.Stretch = Stretch.None
|
||||
.Stretch = Stretch.UniformToFill
|
||||
}
|
||||
items.Add(image)
|
||||
End Using
|
||||
@@ -129,8 +129,8 @@ Partial Public Class PdfViewer
|
||||
Await page.RenderToStreamAsync(stream)
|
||||
image.BeginInit()
|
||||
image.CreateOptions = BitmapCreateOptions.PreservePixelFormat
|
||||
image.DecodePixelWidth = 980
|
||||
image.DecodePixelHeight = 860
|
||||
image.DecodePixelWidth = page.Size.Width
|
||||
image.DecodePixelHeight = page.Size.Height
|
||||
image.CacheOption = BitmapCacheOption.OnLoad
|
||||
image.StreamSource = stream.AsStream()
|
||||
image.UriSource = Nothing
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
Style="{StaticResource PDFPanel_Button}">
|
||||
<Image Source="/Resources/PDFEditor/PrintPDF.png" Stretch="Uniform"/>
|
||||
</Button>
|
||||
<!--<Button ToolTip="Close PDF Viewer"
|
||||
<Button ToolTip="Close PDF Viewer"
|
||||
Command="{Binding ClosePreview_Command}"
|
||||
Style="{StaticResource Close_Button}">
|
||||
<Image Source="/Resources/PDFEditor/Delete.png" Stretch="Uniform"/>
|
||||
</Button>-->
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<ScrollViewer Grid.Row="1"
|
||||
@@ -132,7 +132,7 @@
|
||||
Grid.RowSpan="2"
|
||||
Style="{StaticResource GroupBox_PDFPreview}">
|
||||
<!--<WebBrowser EgtBEAMWALL:WebBrowserUtility.BindableSource="{Binding WebAddress}"/>-->
|
||||
<EgtBEAMWALL:PdfViewer PdfPath="{Binding WebAddress, Mode=TwoWay}"/>
|
||||
<EgtBEAMWALL:PdfViewer PdfPath="{Binding WebAddress, Mode=TwoWay}" Visibility="{Binding PdfViewer_Visibility}"/>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports EgtBEAMWALL.Core
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtUILib
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
|
||||
Public Class PDFEditorVM
|
||||
Inherits VMBase
|
||||
@@ -34,6 +35,17 @@ Public Class PDFEditorVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_PdfViewer_Visibility As Visibility
|
||||
Public Property PdfViewer_Visibility As Visibility
|
||||
Get
|
||||
Return m_PdfViewer_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_PdfViewer_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(PdfViewer_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdCreatePDFPreviewVis As ICommand
|
||||
Private m_cmdCreatePDFPreviewOtt As ICommand
|
||||
@@ -51,6 +63,7 @@ Public Class PDFEditorVM
|
||||
m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART_TOT)) ' Part Totals
|
||||
m_ExpanderList.Add(New ExpanderPDF(ListTypes.PART)) ' Part List
|
||||
m_WebAddress = "" ' Pagina vuota
|
||||
m_PdfViewer_Visibility = Visibility.Hidden
|
||||
Map.SetRefPDFEditorVM(Me)
|
||||
End Sub
|
||||
|
||||
@@ -73,9 +86,11 @@ Public Class PDFEditorVM
|
||||
''' Funzione per la visualizzazione della preview del PDF della sezione visualizzatore
|
||||
''' </summary>
|
||||
Public Sub CreatePreviewVis()
|
||||
m_PdfViewer_Visibility = Visibility.Visible
|
||||
Map.refStatisticsVM.CreatePrintPDF(PDFPage.VIEW, True)
|
||||
WebAddress = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Visualization.pdf"
|
||||
NotifyPropertyChanged(NameOf(WebAddress))
|
||||
NotifyPropertyChanged(NameOf(PdfViewer_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CreatePreviewVis
|
||||
@@ -95,34 +110,45 @@ Public Class PDFEditorVM
|
||||
''' Funzione per la visualizzazione della preview del PDF della sezione ottimizzatore
|
||||
''' </summary>
|
||||
Public Sub CreatePreviewOtt()
|
||||
m_PdfViewer_Visibility = Visibility.Visible
|
||||
Map.refStatisticsVM.CreatePrintPDF(PDFPage.MACHING, True)
|
||||
WebAddress = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Optimizer.pdf"
|
||||
NotifyPropertyChanged(NameOf(WebAddress))
|
||||
NotifyPropertyChanged(NameOf(PdfViewer_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CreatePreviewOt
|
||||
|
||||
#Region "ClosePreview"
|
||||
|
||||
Public ReadOnly Property ClosePreview_Command As ICommand
|
||||
Get
|
||||
If m_cmdClosePreview Is Nothing Then
|
||||
m_cmdClosePreview = New Command(AddressOf ClosePreview)
|
||||
End If
|
||||
Return m_cmdClosePreview
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Funzione per la chiusura della preview
|
||||
''' </summary>
|
||||
Public Sub ClosePreview()
|
||||
Try
|
||||
File.Delete(Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Visualization.pdf")
|
||||
File.Delete(Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics - Optimizer.pdf")
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Cancellazione dei file pdf fallita")
|
||||
End Try
|
||||
|
||||
m_PdfViewer_Visibility = Visibility.Hidden
|
||||
WebAddress = ""
|
||||
NotifyPropertyChanged(NameOf(WebAddress))
|
||||
NotifyPropertyChanged(NameOf(PdfViewer_Visibility))
|
||||
End Sub
|
||||
|
||||
#End Region ' CreatePreviewVis
|
||||
|
||||
'#Region "ClosePreview"
|
||||
|
||||
' Public ReadOnly Property ClosePreview_Command As ICommand
|
||||
' Get
|
||||
' If m_cmdClosePreview Is Nothing Then
|
||||
' m_cmdClosePreview = New Command(AddressOf ClosePreview)
|
||||
' End If
|
||||
' Return m_cmdClosePreview
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
' ''' <summary>
|
||||
' ''' Funzione per la chiusura della preview
|
||||
' ''' </summary>
|
||||
' Public Sub ClosePreview()
|
||||
' m_WebAddress = ""
|
||||
' NotifyPropertyChanged(NameOf(WebAddress))
|
||||
' End Sub
|
||||
|
||||
'#End Region ' CreatePreviewVis
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user