6591de143a
-migliorato gestione popup
98 lines
4.8 KiB
VB.net
98 lines
4.8 KiB
VB.net
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports MigraDoc.DocumentObjectModel
|
|
Imports MigraDoc.Rendering
|
|
|
|
Module Configuration
|
|
|
|
''' <summary>
|
|
''' vista di tutti i pezzi
|
|
''' </summary>
|
|
''' <param name="bShowBuilding">booleano visualizza modalita' assemblato</param>
|
|
''' <param name="bShowSolid">booleano visualizza solido</param>
|
|
''' <param name="nSelPartId">Id pezzo</param>
|
|
''' <param name="bSolid">booleano controllo solido</param>
|
|
''' <param name="bSelPieces">booleano controllo se pezzo selezionato</param>
|
|
Friend Sub ShowAllPieces(bShowBuilding As Boolean, Optional bShowSolid As Boolean = False, Optional nSelPartId As Integer = 0, Optional bSolid As Boolean = False, Optional bSelPieces As Boolean = False)
|
|
If Map.refShowBeamPanelVM.bShowAll Then
|
|
' verifico se assemblato e lo annullo per salvataggio
|
|
bShowBuilding = Map.refShowBeamPanelVM.ShowBuilding_IsChecked
|
|
If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(False, False)
|
|
' se vista singolo pezzo
|
|
ElseIf Not Map.refShowBeamPanelVM.bShowAll AndAlso bSolid Then
|
|
bShowSolid = Map.refShowBeamPanelVM.ShowSolid_IsChecked
|
|
If bShowSolid Then Map.refProjectVM.BTLStructureVM.ShowSolid(GDB_ID.NULL, False, False)
|
|
' se pezzo selezionato lo segno e metto vista tutti
|
|
If bSelPieces Then
|
|
If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then nSelPartId = Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId
|
|
Map.refProjectVM.BTLStructureVM.ShowAll(False)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' tolgo eventuale indicazione solido rimasta da pezzo precedente
|
|
''' </summary>
|
|
''' <param name="nPartId">Id pezzo</param>
|
|
''' <param name="bShowSolid">booleano visualizzazione solido</param>
|
|
Friend Sub DeselectSolid(Optional nPartId As Integer = 0, Optional bShowSolid As Boolean = False)
|
|
If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then
|
|
' tolgo eventuale indicazione solido rimasta da pezzo precedente
|
|
Map.refShowBeamPanelVM.SetShowSolid(False)
|
|
If bShowSolid Then Map.refProjectVM.BTLStructureVM.ShowSolid(nPartId, False, False)
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub CreatePrintPDF(ActivePage As Integer, bPreview As Boolean)
|
|
LoadingWndHelper.OpenLoadingWnd(ActiveIds.CREATINGPDF, 1, "Creating PDF", "", 100)
|
|
Try
|
|
' creo documento MigraDoc
|
|
Dim document As Document = PDFHelper.CreateStatReport(ActivePage, bPreview)
|
|
Dim documentPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\MigraDoc.mdddl"
|
|
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, documentPath)
|
|
Dim renderer As New PdfDocumentRenderer(True) With {
|
|
.Document = document
|
|
}
|
|
renderer.RenderDocument()
|
|
' salvo il documento
|
|
Dim sFileName As String = ""
|
|
|
|
If (ActivePage = Pages.VIEW AndAlso Not bPreview) OrElse (ActivePage = Pages.ONLYPRODPAGE AndAlso Not bPreview) Then
|
|
sFileName = ProjectManagerVM.CurrProj.sProjDirPath & "\" & "Statistics.pdf"
|
|
ElseIf ActivePage = Pages.VIEW OrElse Pages.ONLYPRODPAGE AndAlso bPreview Then
|
|
sFileName = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics.pdf" ' Se la pagina e' 0 e' bPreview e' True creo PDF Visualization
|
|
ElseIf (ActivePage = Pages.MACHINING AndAlso Not bPreview) OrElse (ActivePage = Pages.ONLYPRODPAGE AndAlso Not bPreview) Then
|
|
sFileName = ProjectManagerVM.CurrProd.sProdDirPath & "\" & ProjectManagerVM.CurrProd.sProdId & " - " & "Statistics.pdf"
|
|
ElseIf ActivePage = Pages.MACHINING OrElse Pages.ONLYPRODPAGE AndAlso bPreview Then ' Se la pagina e' 1 e' bPreview e' True creo PDF Optimizer
|
|
sFileName = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics.pdf"
|
|
PrevSelect()
|
|
End If
|
|
|
|
' avvio il visualizzatore
|
|
renderer.PdfDocument.Save(sFileName)
|
|
' cancello file MigraDoc
|
|
System.IO.File.Delete(documentPath)
|
|
|
|
If bPreview Then
|
|
Else
|
|
Process.Start(sFileName)
|
|
End If
|
|
Catch ex As Exception
|
|
EgtOutLog("Error genereting pdf: " & ex.ToString())
|
|
End Try
|
|
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CREATINGPDF)
|
|
|
|
End Sub
|
|
|
|
Private Sub PrevSelect()
|
|
' ripristino selezione precedente
|
|
Dim nCurrMachGroupId As Integer = EgtGetCurrMachGroup()
|
|
If Not IsNothing(Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup) AndAlso nCurrMachGroupId <> Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.Id Then
|
|
EgtSetCurrMachGroup(Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup.Id)
|
|
End If
|
|
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
|
|
EgtZoom(ZM.ALL, True)
|
|
End Sub
|
|
|
|
End Module
|