Optmizer 3.0.1.2

-sistemato errori
-cambiato icone
This commit is contained in:
Demetrio Cassarino
2026-01-13 16:29:46 +01:00
parent a79445f152
commit c3dff38c7f
19 changed files with 329 additions and 164 deletions
+4
View File
@@ -75,6 +75,10 @@
<Color x:Key="BeamWall_ElectricViolet_Color" R="143" G="0" B="255" A="255"/>
<SolidColorBrush x:Key="BeamWall_ElectricViolet" Color="{StaticResource BeamWall_ElectricViolet_Color}" />
<!--#FFA500-->
<Color x:Key="BeamWall_Orange_Color" R="255" G="165" B="0" A="255"/>
<SolidColorBrush x:Key="BeamWall_Orange" Color="{StaticResource BeamWall_Orange_Color}" />
<!--#endregion Colori Predefiniti-->
<!--#region Colori Nuova Grafica-->
@@ -153,7 +153,10 @@ Public Class BTLStructureVM
For Each FeatureParam In SelBTLPart.BTLFeatureVMList
bValue = False
EgtGetInfo(FeatureParam.nFeatureId, ConstBeam.STRATEGY & FeatureParam.nFeatureId & "_FORCED", bValue)
If bValue Then FeatureParam.SetbStrategy_Visibility(Visibility.Visible)
If bValue Then
SelBTLPart.SetStrategyModify_Visibility(Visibility.Visible)
FeatureParam.SetbStrategy_Visibility(Visibility.Visible)
End If
For Each StrategySetupParam In Map.refStrategyManagerVM.StrategySetupList
For Each StrategyFeatureParam In StrategySetupParam.StrategyFeatureList
For Each TopologyParam In StrategyFeatureParam.TopologyList
@@ -742,16 +742,18 @@ Public Class CALCPanelVM
End Sub)
ExecThread.Start()
End If
End Sub
Private Sub VerifyAllWithEngine(ProgramPage As ProjectType)
Map.refShowBeamPanelVM.ShowBuilding_IsEnabled = False
Dim QuestionList As New List(Of QuestionDTO)
If ProgramPage = ProjectType.PROJ Then
For PartIndex = 0 To Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1
If Not Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex).bDO Then Continue For
VerifyProjWithEngine(Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex))
Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex).SetIsRowEnabled(True)
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
Map.refMyStatusBarVM.SetLoadingProgress(Math.Min(PartIndex, 100))
Next
Map.refLeftPanelVM.SetCALCPanel_IsEnabled(True)
ElseIf ProgramPage = ProjectType.PROD Then
@@ -760,9 +762,14 @@ Public Class CALCPanelVM
If DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(PartIndex), MyMachGroupVM).nProduction_State >= ItemState.Assigned Then Return
VerifyProdWithEngine(Map.refMachGroupPanelVM.MachGroupVMList(PartIndex))
DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(PartIndex), MyMachGroupVM).SetIsRowEnabled(True)
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
Map.refMyStatusBarVM.SetLoadingProgress(Math.Min(PartIndex, 100))
Next
Map.refRawPartManagerVM.SetCALCPanel_IsEnabled(True)
End If
Map.refShowBeamPanelVM.ShowBuilding_IsEnabled = True
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
Map.refMyStatusBarVM.SetOutputMessage("Verifica Completata")
End Sub
Private Function CreateBarListToVerify(SelPage As Pages, ProjType As BWType, ByRef BarList As Bar()) As Boolean
@@ -1,10 +1,9 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.IO.Compression
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Imports MS.Internal
Imports Ionic.Zip
Public Class ConfigurationPageVM
Inherits VMBase
@@ -494,7 +493,7 @@ Public Class ConfigurationPageVM
#End Region ' Fields & Properties
#Region "Constructor"
#Region "CONSTRUCTOR"
Sub New()
' imposto riferimento in Map
@@ -699,25 +698,30 @@ Public Class ConfigurationPageVM
If bLoadingWindow Then LoadingWndHelper.UpdateLoadingWnd(ActiveIds.BACKUP, 2, EgtMsg(63024), 15, 100) ' Projects backup
' backup dei progetti correnti
Try
Using zip As New Ionic.Zip.ZipFile(sBackupFolder, Console.Out)
zip.AlternateEncodingUsage = ZipOption.Always
zip.AlternateEncoding = Text.Encoding.UTF8
zip.CompressionMethod = CompressionMethod.None
' aggiungo Db
zip.AddItem(sBackupZipPath, "")
' aggiungo cartella progetti
Dim sProjectFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\"
Dim sKey As String = ""
EgtGetKeyInfo(sKey)
sKey = sKey.Replace(" ", "")
Dim sUserFolder As String = ""
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
sUserFolder = sKey.Substring(3, 6)
sProjectFolder &= sUserFolder
End If
zip.AddItem(sProjectFolder, sUserFolder)
' salvo lo zip
zip.Save()
Using zipStream As FileStream = New FileStream(sBackupFolder, FileMode.Create)
Using archive As ZipArchive = New ZipArchive(zipStream, ZipArchiveMode.Create)
Dim dbEntry As ZipArchiveEntry = archive.CreateEntry(Path.GetFileName(sBackupZipPath), CompressionLevel.NoCompression)
Using entryStream = dbEntry.Open()
Using fileStream = File.OpenRead(sBackupZipPath)
fileStream.CopyTo(entryStream)
End Using
End Using
Dim sProjectFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\"
Dim sKey As String = ""
EgtGetKeyInfo(sKey)
sKey = sKey.Replace(" ", "")
Dim sUserFolder As String = ""
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
sUserFolder = sKey.Substring(3, 6)
sProjectFolder &= sUserFolder
End If
If Directory.Exists(sProjectFolder) Then
AddDirectoryToZip(archive, sProjectFolder, sUserFolder)
End If
End Using
End Using
Catch ex As Exception
MessageBox.Show(EgtMsg(62103), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
@@ -750,6 +754,21 @@ Public Class ConfigurationPageVM
End Using
End Sub
Private Sub AddDirectoryToZip(archive As ZipArchive, folderPath As String, entryRoot As String)
Dim files As String() = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories)
For Each file As String In files
Dim relativePath As String = entryRoot & "\" & file.Substring(folderPath.Length).TrimStart("\"c)
Dim entry As ZipArchiveEntry = archive.CreateEntry(relativePath, CompressionLevel.NoCompression)
Using entryStream = entry.Open()
Using fileStream = System.IO.File.OpenRead(file)
fileStream.CopyTo(entryStream)
End Using
End Using
Next
End Sub
#End Region ' Backup
#Region "Restore"
@@ -862,10 +881,8 @@ Public Class ConfigurationPageVM
Dim bOk As Boolean = True
' apro file zip
Try
Using zip As New Ionic.Zip.ZipFile(sRestorePath, Console.Out)
' estraggo file da zip
zip.ExtractAll(sRestoreDir)
End Using
If Directory.Exists(sRestoreDir) Then Directory.Delete(sRestoreDir, True)
ZipFile.ExtractToDirectory(sRestorePath, sRestoreDir)
Catch ex1 As Exception
EgtOutLog("Error! Impossible importing Recovery file " & sRestorePath & "!")
EgtOutLog("Exception in zip: " & ex1.ToString())
@@ -90,6 +90,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Printing" />
@@ -982,9 +983,6 @@
<PackageReference Include="BouncyCastle">
<Version>1.8.5</Version>
</PackageReference>
<PackageReference Include="DotNetZip">
<Version>1.16.0</Version>
</PackageReference>
<PackageReference Include="EgwMultiEngineManager.Core">
<Version>2.7.12.2</Version>
</PackageReference>
@@ -286,9 +286,11 @@ Public Class ForcedStrategyPanelVM
m_SelStrategy.SetbIsStrategyModify(False)
EgtRemoveInfo(m_CurrentFeature.nFeatureId, ConstBeam.STRATEGY)
EgtRemoveInfo(m_CurrentFeature.nFeatureId, ConstBeam.STRATEGY & m_CurrentFeature.nFeatureId & "_FORCED")
Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(Visibility.Collapsed)
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.SetbStrategy_Visibility(Visibility.Collapsed)
Else
m_SelStrategy.SetbIsStrategyModify(True)
Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(Visibility.Visible)
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.SetbStrategy_Visibility(Visibility.Visible)
EgtSetInfo(m_CurrentFeature.nFeatureId, ConstBeam.STRATEGY, SelStrategy.sStrategyId)
EgtSetInfo(m_CurrentFeature.nFeatureId, ConstBeam.STRATEGY & m_CurrentFeature.nFeatureId & "_FORCED", SelStrategy.bIsStrategyModify)
@@ -132,7 +132,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="12"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="↓"
@@ -144,24 +144,21 @@
</Border>
<Grid Grid.Column="2"
Style="{StaticResource FeatureInPartInRawPartList_Grid}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Ellipse Visibility="{Binding CALC_ROT_Visibility}"
Style="{StaticResource CALC_ROT_Ellipse}"/>
<TextBlock Visibility="{Binding CALC_ROT_Visibility}"
Style="{StaticResource CALC_ROT_TextBlock}"/>
<TextBlock Grid.Row="1"
Text="{Binding CALC_ERR_Letter}"
Foreground="{Binding CALC_ERR_Foreground}"
Style="{StaticResource CALC_ERR_TextBlock}"/>
</Grid>
<Ellipse Grid.Column="3"
Visibility="{Binding StrategyModify_Visibility}"
Style="{StaticResource Strategy_Ellipse}"/>
<TextBlock Grid.Column="3"
Visibility="{Binding StrategyModify_Visibility}"
Style="{StaticResource StrategyModify_TextBlock}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
@@ -171,7 +168,7 @@
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=Tag.bDOALL, RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:BTLPartListV}}}"
VerticalAlignment="Center"/>
Style="{StaticResource PParameters_CheckBox}"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
@@ -465,26 +462,27 @@
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="12"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Width="{Binding ActualHeight, RelativeSource={RelativeSource self}}"
Background="{Binding Calc_Background}"/>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Ellipse Visibility="{Binding CALC_ROT_Visibility}"
Style="{StaticResource FeatureInPartInRawPartList_Ellipse}"/>
<TextBlock Grid.Row="1"
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Visibility="{Binding CALC_ROT_Visibility}"
Style="{StaticResource CALC_ROTFeature_TextBlock}"/>
<TextBlock Grid.Column="1"
Text="{Binding CALC_ERR_Letter}"
Foreground="{Binding CALC_ERR_Foreground}"
Style="{StaticResource FeatureInPartInRawPartList_TextBlock}"/>
Style="{StaticResource CALC_ERR_Letter_TextBlock}"/>
</Grid>
<Ellipse Grid.Column="2"
Visibility="{Binding bStrategy_Visibility}"
Style="{StaticResource Strategy_Ellipse}"/>
<TextBlock Grid.Column="2"
Visibility="{Binding bStrategy_Visibility}"
Style="{StaticResource bStrategy_TextBlock}"/>
</Grid>
<CheckBox Grid.Column="2"
IsChecked="{Binding bDO, UpdateSourceTrigger=PropertyChanged}"
@@ -523,7 +521,7 @@
Style="{StaticResource BTLPartList_StackPanel}">
<TextBlock Text="STATUS:"
Style="{StaticResource Status_TextBlock}"/>
<TextBlock Text="{Binding Tag.SelBTLPart.sCALC_MSG, RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:BTLPartListV}}}"
Visibility="{Binding Tag.SelBTLPart.CALC_MSG_Visibility, RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:BTLPartListV}}}"
Style="{StaticResource SelBTLPart_TextBlock}"/>
@@ -108,7 +108,7 @@
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<!--Minimo-->
<DataGridTextColumn x:Key="colMIN" Binding="{Binding sMin}" SortMemberPath="dMin">
<DataGridTextColumn x:Key="colMIN" Binding="{Binding sMin, Mode=OneWay}" SortMemberPath="dMin">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Min_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
@@ -116,7 +116,7 @@
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!--Massimo-->
<DataGridTextColumn x:Key="colMAX" Binding="{Binding sMax}" SortMemberPath="dMax">
<DataGridTextColumn x:Key="colMAX" Binding="{Binding sMax, Mode=OneWay}" SortMemberPath="dMax">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.Max_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
@@ -144,7 +144,7 @@ Public Class PParameterListVM
Public Sub Ok()
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.ResetCalcFeature()
Map.refProjectVM.BTLStructureVM.SelBTLPart.ResetCalcPart()
Map.refProjectVM.UpdatePart()
If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then Map.refProjectVM.UpdatePart()
Map.refForcedStrategyPanelVM.ForcedStrategy()
Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible)
Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed)
+93 -48
View File
@@ -1,10 +1,11 @@
Imports System.IO
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.IO.Compression
Imports System.Windows.Threading
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
Imports System.Collections.ObjectModel
Public Class MainMenuVM
Inherits VMBase
@@ -566,7 +567,6 @@ Public Class MainMenuVM
Dim ProjFileMList As List(Of ProjFileM)
If SelPage = Pages.OPTIMIZERPAGE And Not IsNothing(ProjectManagerVM.CurrProd) Then
ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProjectManagerVM.CurrProd.nProdId)
'Map.refProjManagerVM.SetCurrProj(ProjFileMList(0).nProjId)
Map.refProdManagerVM.SetCurrProj(ProjFileMList(0).nProjId)
End If
Dim sExportFileName = ProjectManagerVM.CurrProd.nProdId.ToString("0000") & " - " & ProjectManagerVM.CurrProj.sBTLFileName & " - ProjectExport"
@@ -575,52 +575,49 @@ Public Class MainMenuVM
Dim sZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip"
If File.Exists(sZipToCreate) Then File.Delete(sZipToCreate)
Try
Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out)
' aggiungo progetto esportato
If File.Exists(sExpZipToCreate) Then
zip.AddItem(sExpZipToCreate, "")
End If
' aggiungo Prod e Proj associati
Dim ProdId As Integer
Select Case Map.refMainMenuVM.SelPage
Case Pages.VIEW
ProdId = ProjectManagerVM.CurrProj.nProdId
Case Pages.MACHINING, Pages.OPTIMIZERPAGE
ProdId = ProjectManagerVM.CurrProd.nProdId
End Select
If ProdId = 0 Then
zip.AddItem(ProjectManagerVM.CurrProj.sProjDirPath, "Projs\" & ProjectManagerVM.CurrProj.nProjId.ToString("0000"))
Else
ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProdId)
' se piu' di uno
If IsNothing(ProjFileMList) Then
Return
ElseIf ProjFileMList.Count > 0 Then
Dim ProjFileVMList As New List(Of ProjectFileVM)
For Each Project In ProjFileMList
ProjFileVMList.Add(New ProjFileVM(Project))
Next
'For Each ProjFileVMItem In ProjFileVMList
' zip.AddItem(ProjFileVMItem.sProjDirPath, "Projs\" & ProjFileVMItem.nProjId.ToString("0000"))
'Next
zip.AddItem(ProjFileVMList(0).sProdDirPath, "Prods\" & ProjFileVMList(0).nProdId.ToString("0000"))
Using zipStream As FileStream = New FileStream(sZipToCreate, FileMode.Create)
Using archive As ZipArchive = New ZipArchive(zipStream, ZipArchiveMode.Create)
If File.Exists(sExpZipToCreate) Then
AddFileToZip(archive, sExpZipToCreate, "")
End If
End If
' aggiungo cartella macchina del progetto
Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName
If Directory.Exists(sMachineDir) Then
zip.AddItem(sMachineDir, sMachineName)
End If
' aggiungo file log
If File.Exists(Map.refMainWindowVM.MainWindowM.sLogFile) Then
zip.AddItem(Map.refMainWindowVM.MainWindowM.sLogFile, "")
End If
' aggiungo file parametri P e Q
If File.Exists(BTLIniFile.m_sBTLIniFile) Then
zip.AddItem(BTLIniFile.m_sBTLIniFile, "")
End If
' salvo lo zip
zip.Save()
Dim ProdId As Integer
Select Case Map.refMainMenuVM.SelPage
Case Pages.VIEW
ProdId = ProjectManagerVM.CurrProj.nProdId
Case Pages.MACHINING, Pages.OPTIMIZERPAGE
ProdId = ProjectManagerVM.CurrProd.nProdId
End Select
If ProdId = 0 Then
AddDirectoryToZip(archive, ProjectManagerVM.CurrProd.sProdDirPath, "Projs\" & ProjectManagerVM.CurrProj.nProjId.ToString("0000"))
Else
ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProdId)
If IsNothing(ProjFileMList) Then
Return
ElseIf ProjFileMList.Count > 0 Then
Dim ProjFileVMList As New List(Of ProjectFileVM)
For Each Project In ProjFileMList
ProjFileVMList.Add(New ProjFileVM(Project))
Next
For Each ProjFileVMItem In ProjFileVMList
AddDirectoryToZip(archive, ProjFileVMItem.sProdDirPath, "Prods\" & ProjFileVMItem.nProdId.ToString("0000"))
Next
End If
End If
Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName
If Directory.Exists(sMachineDir) Then
AddDirectoryToZip(archive, sMachineDir, sMachineName)
End If
If File.Exists(Map.refMainWindowVM.MainWindowM.sLogFile) Then
AddFileToZip(archive, Map.refMainWindowVM.MainWindowM.sLogFile, "")
End If
If File.Exists(BTLIniFile.m_sBTLIniFile) Then
AddFileToZip(archive, BTLIniFile.m_sBTLIniFile, "")
End If
End Using
End Using
Catch ex1 As Exception
EgtOutLog("Exception in zip: " & ex1.ToString())
@@ -638,6 +635,27 @@ Public Class MainMenuVM
SendFeedbackWindow.Files.Add(Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip")
End If
SendFeedbackWindow.ShowDialog()
'Dim mailmessage As New System.Net.Mail.MailMessage With {
' .Subject = "EgtBEAMWALL Feedback - " & sKey,
' .IsBodyHtml = True,
' .Body = ""
'}
'mailmessage.To.Add(New System.Net.Mail.MailAddress(sAddressArray(0)))
'For index As Integer = 1 To sAddressArray.Length() - 1
' mailmessage.CC.Add(sAddressArray(index))
'Next
'If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then
' mailmessage.Attachments.Add(New System.Net.Mail.Attachment(Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip"))
'End If
'Dim filename As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\mymessage.eml"
'If Not IsNothing(filename) Then
' Configuration.SaveEml(mailmessage, filename)
' Process.Start(filename)
'Else
' MessageBox.Show("Errore creazione file .eml")
'End If
Catch ex As Exception
EgtOutLog("Feedback exception: " & ex.ToString)
bEx = True
@@ -649,6 +667,33 @@ Public Class MainMenuVM
End If
End Sub
Private Sub AddFileToZip(archive As ZipArchive, filePath As String, entryRoot As String)
Dim entryName As String = If(String.IsNullOrEmpty(entryRoot), Path.GetFileName(filePath), entryRoot.TrimEnd("\"c) & "\" & Path.GetFileName(filePath))
Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim entry As ZipArchiveEntry = archive.CreateEntry(entryName, CompressionLevel.NoCompression)
Using entryStream = entry.Open()
fs.CopyTo(entryStream)
End Using
End Using
End Sub
Private Sub AddDirectoryToZip(archive As ZipArchive, folderPath As String, entryRoot As String)
Dim files As String() = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories)
For Each file As String In files
Dim relativePath As String = file.Substring(folderPath.Length).TrimStart("\"c)
Dim entryName As String = entryRoot.TrimEnd("\"c) & "\" & relativePath
Dim entry As ZipArchiveEntry = archive.CreateEntry(entryName, CompressionLevel.NoCompression)
Using entryStream As Stream = entry.Open()
Using fileStream As FileStream = System.IO.File.OpenRead(file)
fileStream.CopyTo(entryStream)
End Using
End Using
Next
End Sub
#End Region ' SendFeedbackCommand
#End Region ' COMMANDS
@@ -67,5 +67,5 @@ Imports System.Windows
' Revision
'
<Assembly: AssemblyVersion("3.1.0.1")>
<Assembly: AssemblyFileVersion("3.1.0.1")>
<Assembly: AssemblyVersion("3.1.0.2")>
<Assembly: AssemblyFileVersion("3.1.0.2")>
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.IO.Compression
Imports System.Windows.Threading
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.DataLayer.DatabaseModels
@@ -1141,10 +1142,12 @@ Public Class ProdManagerVM
Map.refMyStatusBarVM.RefreshMachName()
' Aggiungo a ButtonBuildingList i BTL
Map.refSceneBuildingVM.ButtonBuildingList.Clear()
For Each ItemProd As Integer In ProjectManagerVM.CurrProd.nProjIdList
Dim TempProj As ProjFileM = DbControllers.m_ProjController.FindByProjIdConv(ItemProd)
Map.refSceneBuildingVM.ButtonBuildingList.Add(New ButtonBuildingItem(ItemProd, m_nListProjAsseBase(ItemProd), TempProj.sBTLFileName))
Next
If m_nListProjAsseBase.Count > 0 Then
For Each ItemProd As Integer In ProjectManagerVM.CurrProd.nProjIdList
Dim TempProj As ProjFileM = DbControllers.m_ProjController.FindByProjIdConv(ItemProd)
Map.refSceneBuildingVM.ButtonBuildingList.Add(New ButtonBuildingItem(ItemProd, m_nListProjAsseBase(ItemProd), TempProj.sBTLFileName))
Next
End If
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
Return True
End Function
@@ -1440,7 +1443,6 @@ Public Class ProdManagerVM
Public Sub ImportBTL(Optional sFile As String = "", Optional bWithDlg As Boolean = True)
If Not CreateNewProd() Then
Dim sErrMsg As String = "Errore! Creazione del progetto fallita!"
MessageBox.Show(sErrMsg)
EgtOutLog(sErrMsg)
End If
Return
@@ -1512,14 +1514,21 @@ Public Class ProdManagerVM
File.Delete(sZipToCreate)
End If
Try
Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out)
' impacchetto tutta la cartella del progetto
Dim sProjectDirPath As String = If(CurrProd.nProdId > 0, CurrProd.sProdDirPath, CurrProd.sProjDirPath)
For Each sFile As String In Directory.GetFiles(sProjectDirPath)
zip.AddItem(sFile, "")
Next
' salvo lo zip
zip.Save()
Using zipStream As New FileStream(sZipToCreate, FileMode.Create)
Using archive As New ZipArchive(zipStream, ZipArchiveMode.Create)
Dim sProjectDirPath As String = If(CurrProd.nProdId > 0, CurrProd.sProdDirPath, CurrProd.sProjDirPath)
For Each sFile As String In Directory.GetFiles(sProjectDirPath)
Dim entryName As String = Path.GetFileName(sFile)
Dim entry As ZipArchiveEntry = archive.CreateEntry(entryName, CompressionLevel.NoCompression)
Using entryStream As Stream = entry.Open()
Using fileStream As FileStream = File.OpenRead(sFile)
fileStream.CopyTo(entryStream)
End Using
End Using
Next
End Using
End Using
Catch ex1 As Exception
EgtOutLog("Exception in zip: " & ex1.ToString())
@@ -1568,10 +1577,8 @@ Public Class ProdManagerVM
Directory.CreateDirectory(sProjectimportDir)
Try
Using zip As New Ionic.Zip.ZipFile(ImportDlg.FileName, Console.Out)
' estraggo file da zip
zip.ExtractAll(sProjectimportDir)
End Using
If Directory.Exists(sProjectimportDir) Then Directory.Delete(sProjectimportDir, True)
ZipFile.ExtractToDirectory(ImportDlg.FileName, sProjectimportDir)
Catch ex1 As Exception
EgtOutLog("Exception in zip: " & ex1.ToString())
MessageBox.Show("Impossibile importare file", "Errore")
+1 -1
View File
@@ -688,7 +688,7 @@ Public Class ProjectVM
Next
Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(Visibility.Collapsed)
End If
UpdatePart()
If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then UpdatePart()
Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible)
Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed)
Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER)
@@ -19,6 +19,7 @@
Style="{StaticResource BTLDataWnd_Image}"/>
</ToggleButton>
<ToggleButton IsChecked="{Binding ShowBuilding_IsChecked}"
IsEnabled="{Binding ShowBuilding_IsEnabled}"
ToolTip="{Binding ShowBuilding_ToolTip}"
Style="{StaticResource ToolBar_ToggleButton}">
<Image Source="/Resources/ShowBeamPanel/ShowBuilding.png"
@@ -16,10 +16,10 @@ Public Class ShowBeamPanelVM
m_bShowAll = value
If m_bShowAll Then
m_ShowSolid_IsEnabled = False
m_ShowBuilding_IsEnabled = Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.BTLStructureM.nAsseBaseId <> GDB_ID.NULL
'm_ShowBuilding_IsEnabled = Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.BTLStructureM.nAsseBaseId <> GDB_ID.NULL
Else
m_ShowSolid_IsEnabled = True
m_ShowBuilding_IsEnabled = False
'm_ShowBuilding_IsEnabled = False
End If
UpdatePartBtnIsEnabled()
NotifyPropertyChanged(NameOf(ShowSolid_IsEnabled))
@@ -97,13 +97,14 @@ Public Class ShowBeamPanelVM
NotifyPropertyChanged(NameOf(ShowSolid_IsEnabled))
End Sub
Private m_ShowBuilding_IsEnabled As Boolean
Private m_ShowBuilding_IsEnabled As Boolean = True
Public Property ShowBuilding_IsEnabled As Boolean
Get
Return m_ShowBuilding_IsEnabled
End Get
Set(value As Boolean)
m_ShowBuilding_IsEnabled = value
NotifyPropertyChanged(NameOf(ShowBuilding_IsEnabled))
End Set
End Property
@@ -485,7 +485,7 @@ Public Class JsonDefaultStrategyParameter
DirectCast(StrategyParameter, StringStrategyParameter).SetbStringVisibility(Visibility.Visible)
End If
Case Else
EgtOutLog("Tipo: " & m_sType & " non presente")
If Not IsNothing(m_sType) Then EgtOutLog("Tipo: " & m_sType & " non presente")
Return Nothing
End Select
StrategyParameter.sName = m_sName
+53 -1
View File
@@ -1,4 +1,9 @@
Imports EgtBEAMWALL.Core
Imports System.IO
Imports System.Net.Mail
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Text
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports MigraDoc.DocumentObjectModel
Imports MigraDoc.Rendering
@@ -97,4 +102,51 @@ Module Configuration
EgtZoom(ZM.ALL, True)
End Sub
Public Sub SaveEml(message As MailMessage, filename As String)
Dim boundary As String = "====BOUNDARY_" & Guid.NewGuid().ToString() & "===="
Dim sb As New StringBuilder()
' Intestazioni principali
sb.AppendLine("To: " & String.Join(";", message.To.Select(Function(t) t.Address)))
If message.CC.Count > 0 Then
sb.AppendLine("Cc: " & String.Join(";", message.CC.Select(Function(t) t.Address)))
End If
sb.AppendLine("Subject: " & message.Subject)
sb.AppendLine("X-Unsent: 1")
sb.AppendLine("MIME-Version: 1.0")
sb.AppendLine("Content-Type: multipart/mixed; boundary=""" & boundary & """")
sb.AppendLine()
' Corpo HTML
sb.AppendLine("--" & boundary)
sb.AppendLine("Content-Type: text/html; charset=utf-8")
sb.AppendLine("Content-Transfer-Encoding: quoted-printable")
sb.AppendLine()
sb.AppendLine(message.Body)
sb.AppendLine()
' Allegati
For Each att As Attachment In message.Attachments
Dim ms As New MemoryStream()
att.ContentStream.Position = 0
att.ContentStream.CopyTo(ms)
Dim bytes = ms.ToArray()
Dim base64 = Convert.ToBase64String(bytes, Base64FormattingOptions.InsertLineBreaks)
sb.AppendLine("--" & boundary)
sb.AppendLine("Content-Type: " & att.ContentType.MediaType & "; name=""" & att.Name & """")
sb.AppendLine("Content-Disposition: attachment; filename=""" & att.Name & """")
sb.AppendLine("Content-Transfer-Encoding: base64")
sb.AppendLine()
sb.AppendLine(base64)
sb.AppendLine()
Next
' Fine MIME
sb.AppendLine("--" & boundary & "--")
' Salvataggio file
File.WriteAllText(filename, sb.ToString(), Encoding.UTF8)
End Sub
End Module
+48 -11
View File
@@ -152,7 +152,7 @@
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="2,-6,1,-3"/>
<Setter Property="Margin" Value="-1,-6,1,-3"/>
</Style>
<Style x:Key="PasswordMsg_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ForegroundCorduroy_TextBlock}">
@@ -161,6 +161,8 @@
<Setter Property="Margin" Value="0,0,0,5"/>
</Style>
<!--#region FeatureInPartInRawPartList-->
<Style x:Key="FeatureInPartInRawPartList_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ForegroundCorduroy_TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="Bold"/>
@@ -168,6 +170,12 @@
<Setter Property="Margin" Value="-2,-6,0,-2"/>
</Style>
<Style x:Key="CALC_ERR_Letter_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ForegroundCorduroy_TextBlock}">
<Setter Property="Margin" Value="0,-4,0.5,0"/>
</Style>
<!--#endregion FeatureInPartInRawPartList-->
<Style x:Key="MoveDir_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ForegroundCorduroy_TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Top"/>
@@ -324,6 +332,43 @@
<!--#endregion ParamStrategy-->
<!--#region StrategyModify-->
<Style x:Key="StrategyModify_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Text" Value="&#9999;"/>
<Setter Property="Foreground" Value="{StaticResource BeamWall_Corduroy}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Margin" Value="-2,0,0,0"/>
</Style>
<Style x:Key="bStrategy_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource StrategyModify_TextBlock}">
<Setter Property="FontSize" Value="8"/>
<Setter Property="Margin" Value="-20,0,0,0"/>
</Style>
<!--#endregion StrategyModify-->
<!--#region CALC_ROT-->
<Style x:Key="CALC_ROT_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Text" Value="&#11119;"/>
<Setter Property="Foreground" Value="{StaticResource BeamWall_Blue}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="1,-4,0,0"/>
</Style>
<Style x:Key="CALC_ROTFeature_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource CALC_ROT_TextBlock}">
<Setter Property="FontSize" Value="10.5"/>
<Setter Property="Margin" Value="-6,-2,1,0"/>
</Style>
<!--#endregion CALC_ROT-->
<Style x:Key="Prod_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
@@ -352,10 +397,10 @@
</Style>
<Style x:Key="RawPartList_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="{StaticResource BeamWall_Aqua}"/>
<Setter Property="Foreground" Value="{StaticResource BeamWall_Orange}"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Margin" Value="0,-6,0,-2"/>
</Style>
@@ -2450,14 +2495,6 @@
<Setter Property="Fill" Value="{StaticResource BeamWall_Red}"/>
</Style>
<Style x:Key="Strategy_Ellipse" TargetType="{x:Type Ellipse}" BasedOn="{StaticResource FeatureInPartInRawPartList_Ellipse}">
<Setter Property="Fill" Value="{StaticResource BeamWall_ElectricViolet}"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Width" Value="7"/>
<Setter Property="Height" Value="7"/>
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
<!--#endregion FeatureInPartInRawPartList-->
<!--#endregion Ellipse-->
@@ -226,31 +226,24 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- SectionXMaterial -->
<DataGridComboBoxColumn x:Key="colSECTXMAT"
DisplayMemberPath="sSectionXMaterial"
<DataGridTemplateColumn x:Key="colSECTXMAT"
SortMemberPath="SectionXMaterialDisplayOrder">
<DataGridComboBoxColumn.HeaderTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.SectionXMaterial_Msg,RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:WarehouseWndV}}}"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type OPTIMIZER:WarehouseWndV}}, Path=DataContext.SectionXMaterialList}"
SelectedItem="{Binding SectXMat, UpdateSourceTrigger=PropertyChanged}"
Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
DisplayMemberPath="sSectionXMaterial"
Style="{StaticResource Optmizer_ComboBox}"/>
</DataTemplate>
</DataGridComboBoxColumn.HeaderTemplate>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource Optmizer_ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type OPTIMIZER:WarehouseWndV}}, Path=DataContext.SectionXMaterialList}"/>
<Setter Property="SelectedItem" Value="{Binding SectXMat, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
<Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource Optmizer_ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type OPTIMIZER:WarehouseWndV}}, Path=DataContext.SectionXMaterialList}"/>
<Setter Property="SelectedItem" Value="{Binding SectXMat, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
<Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- W -->
<DataGridTextColumn x:Key="colW" Binding="{Binding dW}">
<DataGridTextColumn.HeaderTemplate>