da0bcbac69
- tolta perdita fuoco da edit quando si passa sopra finestra grafica - sostituito Ionic.zip con DotNetZip - in feedback ora solo file con il nome del progetto oltre a macchina e log.
1290 lines
46 KiB
VB.net
1290 lines
46 KiB
VB.net
Imports System.Drawing.Text
|
|
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class OptionWindowVM
|
|
Inherits VMBase
|
|
|
|
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
|
|
Get
|
|
Return OptionModule.m_LanguageList
|
|
End Get
|
|
End Property
|
|
|
|
'Private m_GeomTypeList As ObservableCollection(Of SceneSelModeOpt) = New ObservableCollection(Of SceneSelModeOpt)({SceneSelModeOpt.PARTCURVES, SceneSelModeOpt.PARTSURFACES, SceneSelModeOpt.PARTCURVESANDSURFACES})
|
|
'Public ReadOnly Property GeomTypeList As ObservableCollection(Of SceneSelModeOpt)
|
|
' Get
|
|
' Return m_GeomTypeList
|
|
' End Get
|
|
'End Property
|
|
|
|
Private m_UnitMeasureList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6545)})
|
|
Public ReadOnly Property UnitMeasureList As List(Of String)
|
|
Get
|
|
Return m_UnitMeasureList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_FontList As New ObservableCollection(Of String)
|
|
Public ReadOnly Property FontList As ObservableCollection(Of String)
|
|
Get
|
|
Dim sNfeDir As String = String.Empty
|
|
GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
|
|
Dim EgtFontList As String() = Directory.GetFiles(sNfeDir)
|
|
For i = 0 To EgtFontList.Count - 1
|
|
m_FontList.Add(Path.GetFileName(EgtFontList(i)))
|
|
Next
|
|
Dim fonts As New InstalledFontCollection
|
|
For i = 0 To fonts.Families.Count - 1
|
|
m_FontList.Add(fonts.Families(i).Name)
|
|
Next
|
|
Return m_FontList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_ScaleDXFList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)})
|
|
Public ReadOnly Property ScaleDXFList As List(Of String)
|
|
Get
|
|
Return m_ScaleDXFList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_ScaleSTLList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)})
|
|
Public ReadOnly Property ScaleSTLList As List(Of String)
|
|
Get
|
|
Return m_ScaleSTLList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_ScaleImageList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)})
|
|
Public ReadOnly Property ScaleImageList As List(Of String)
|
|
Get
|
|
Return m_ScaleImageList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SelectedLanguage As Language
|
|
Get
|
|
Return OptionModule.m_SelectedLanguage
|
|
End Get
|
|
Set(value As Language)
|
|
If value IsNot OptionModule.m_SelectedLanguage Then
|
|
OptionModule.m_SelectedLanguage = value
|
|
WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
'Public Property SelectedMillingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomMilling
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMMILLING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomMilling = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
'Public Property SelectedDrillingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomDrilling
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMDRILLING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomDrilling = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
'Public Property SelectedSawingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomSawing
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMSAWING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomSawing = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
'Public Property SelectedPocketingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomPocketing
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMPOCKETING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomPocketing = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
'Public Property SelectedMortisingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomMortising
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMMORTISING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomMortising = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
'Public Property SelectedChiselingGeomType As SceneSelModeOpt
|
|
' Get
|
|
' Return OptionModule.m_SelGeomChiseling
|
|
' End Get
|
|
' Set(value As SceneSelModeOpt)
|
|
' If WritePrivateProfileString(S_MACH, K_SELGEOMCHISELING, CInt(value).ToString()) Then
|
|
' OptionModule.m_SelGeomChiseling = value
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
Public Property GeometryTolerance As String
|
|
Get
|
|
Return LenToString(OptionModule.m_dGeometryTolerance, 5)
|
|
End Get
|
|
Set(value As String)
|
|
Dim dVal As Double = 0
|
|
If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
OptionModule.m_dGeometryTolerance = dVal
|
|
Map.refSceneHostVM.MainController.SetSurfTmTolerance(OptionModule.m_dGeometryTolerance)
|
|
WriteMainPrivateProfileString(S_GEOMDB, K_SURFTMTOLER, DoubleToString(OptionModule.m_dGeometryTolerance, 5))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property TopSceneBackground As Brush
|
|
Get
|
|
Return New SolidColorBrush(Color.FromArgb(CByte(255),
|
|
CByte(OptionModule.m_TopSceneBackground.R),
|
|
CByte(OptionModule.m_TopSceneBackground.G),
|
|
CByte(OptionModule.m_TopSceneBackground.B)))
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BotSceneBackground As Brush
|
|
Get
|
|
Return New SolidColorBrush(Color.FromArgb(CByte(255),
|
|
CByte(OptionModule.m_BotSceneBackground.R),
|
|
CByte(OptionModule.m_BotSceneBackground.G),
|
|
CByte(OptionModule.m_BotSceneBackground.B)))
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property GridColor As Brush
|
|
Get
|
|
Return New SolidColorBrush(Color.FromArgb(CByte(255),
|
|
CByte(OptionModule.m_GridColor.R),
|
|
CByte(OptionModule.m_GridColor.G),
|
|
CByte(OptionModule.m_GridColor.B)))
|
|
End Get
|
|
End Property
|
|
|
|
' lista oggetti che gestiscono colori e trasparenze delle catogorie
|
|
Private m_LayerColorList As New ObservableCollection(Of LayerColor)({New LayerColor(LayerColor.LayerType.PRINTPART),
|
|
New LayerColor(LayerColor.LayerType.RIBS),
|
|
New LayerColor(LayerColor.LayerType.SHELLNUMBERS),
|
|
New LayerColor(LayerColor.LayerType.AUXSOLIDS),
|
|
New LayerColor(LayerColor.LayerType.MACHSTART),
|
|
New LayerColor(LayerColor.LayerType.OTHERS)})
|
|
Public ReadOnly Property LayerColorList As ObservableCollection(Of LayerColor)
|
|
Get
|
|
Return m_LayerColorList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property ThickLine As Boolean
|
|
Get
|
|
Return OptionModule.m_bThickLine
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_bThickLine = value
|
|
WriteMainPrivateProfileString(S_SCENE, K_LINEWIDTH, If(value, "2", "1"))
|
|
EgtSetLineAttribs(If(value, 2, 1))
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SmoothTriMesh As Boolean
|
|
Get
|
|
Return OptionModule.m_bSmoothTriMesh
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_bSmoothTriMesh = value
|
|
WriteMainPrivateProfileString(S_SCENE, K_SHOWTRIAADV, If(value, "1", "0"))
|
|
EgtSetShowTriaAdv(value)
|
|
End Set
|
|
End Property
|
|
|
|
'Public Property SelectedTextFont As String
|
|
' Get
|
|
' Return m_FontList(m_FontList.IndexOf(OptionModule.m_sFontText))
|
|
' End Get
|
|
' Set(value As String)
|
|
' OptionModule.m_sFontText = value
|
|
' Dim sNfeDir As String = String.Empty
|
|
' GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
|
|
' EgtSetFont(sNfeDir, OptionModule.m_sFontText)
|
|
' WriteMainPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, OptionModule.m_sFontText)
|
|
' End Set
|
|
'End Property
|
|
|
|
Public Property DxfScaleFactor As String
|
|
Get
|
|
Return LenToString(OptionModule.m_dDxfScaleFactor, 5)
|
|
End Get
|
|
Set(value As String)
|
|
Dim dVal As Double = 0
|
|
If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
OptionModule.m_dDxfScaleFactor = dVal
|
|
WriteMainPrivateProfileString(S_IMPORT, K_DXFSCALE, DoubleToString(OptionModule.m_dDxfScaleFactor, 5))
|
|
Map.refSceneHostVM.MainController.SetScaleForDxfImport(OptionModule.m_dDxfScaleFactor)
|
|
NotifyPropertyChanged(NameOf(DxfScaleFactor))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property StlScaleFactor As String
|
|
Get
|
|
Return LenToString(OptionModule.m_dStlScaleFactor, 5)
|
|
End Get
|
|
Set(value As String)
|
|
Dim dVal As Double = 0
|
|
If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
OptionModule.m_dStlScaleFactor = dVal
|
|
WriteMainPrivateProfileString(S_IMPORT, K_STLSCALE, DoubleToString(OptionModule.m_dStlScaleFactor, 5))
|
|
Map.refSceneHostVM.MainController.SetScaleForStlImport(OptionModule.m_dStlScaleFactor)
|
|
NotifyPropertyChanged(NameOf(StlScaleFactor))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
'Public Property ImageScaleFactor As String
|
|
' Get
|
|
' Return LenToString(OptionModule.m_dImgScaleFactor, 5)
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim dVal As Double = 0
|
|
' If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
' OptionModule.m_dImgScaleFactor = dVal
|
|
' WritePrivateProfileString(S_IMPORT, K_IMGSCALE, DoubleToString(OptionModule.m_dImgScaleFactor, 5))
|
|
' Map.refProjectVM.GetController().SetScaleForImageImport(OptionModule.m_dImgScaleFactor)
|
|
' NotifyPropertyChanged("ImageScaleFactor")
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property ImageWidth As String
|
|
' Get
|
|
' Return OptionModule.m_nImgWidth.ToString()
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim nVal As Integer = 0
|
|
' If Integer.TryParse(value, nVal) AndAlso nVal > 0 Then
|
|
' OptionModule.m_nImgWidth = nVal
|
|
' WritePrivateProfileString(S_EXPORT, K_IMGWIDTH, OptionModule.m_nImgWidth.ToString())
|
|
' Map.refProjectVM.GetController().SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight)
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property ImageHeight As String
|
|
' Get
|
|
' Return OptionModule.m_nImgHeight.ToString()
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim nVal As Integer = 0
|
|
' If Integer.TryParse(value, nVal) AndAlso nVal > 0 Then
|
|
' OptionModule.m_nImgHeight = nVal
|
|
' WritePrivateProfileString(S_EXPORT, K_IMGHEIGHT, OptionModule.m_nImgHeight.ToString())
|
|
' Map.refProjectVM.GetController().SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight)
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property ExtLineLen As String
|
|
' Get
|
|
' Return LenToString(OptionModule.m_dExtLineLen, 5)
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim dVal As Double = 0
|
|
' If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
' OptionModule.m_dExtLineLen = dVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_EXTLINELEN, DoubleToString(OptionModule.m_dExtLineLen, 5))
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property ArrowLen As String
|
|
' Get
|
|
' Return LenToString(OptionModule.m_dArrowLen, 5)
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim dVal As Double = 0
|
|
' If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
' OptionModule.m_dArrowLen = dVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_ARROWLEN, DoubleToString(OptionModule.m_dArrowLen, 5))
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property TextDist As String
|
|
' Get
|
|
' Return LenToString(OptionModule.m_dTextDist, 5)
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim dVal As Double = 0
|
|
' If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
' OptionModule.m_dTextDist = dVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_TEXTDIST, DoubleToString(OptionModule.m_dTextDist, 5))
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property SelectedUnitMeasure As String
|
|
' Get
|
|
' If OptionModule.m_nLenIsMM = 0 Then
|
|
' Return "inch"
|
|
' ElseIf OptionModule.m_nLenIsMM = 1 Then
|
|
' Return "mm"
|
|
' Else
|
|
' Return EgtMsg(MSG_OPTIONPAGE + 45)
|
|
' End If
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim nVal As Integer = 2
|
|
' If value = "inch" Then
|
|
' nVal = 0
|
|
' ElseIf value = "mm" Then
|
|
' nVal = 1
|
|
' End If
|
|
' OptionModule.m_nLenIsMM = nVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_LENISMM, OptionModule.m_nLenIsMM.ToString())
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property DecDigit As String
|
|
' Get
|
|
' Return OptionModule.m_nDecDigit.ToString()
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim nVal As Integer = 0
|
|
' If Integer.TryParse(value, nVal) AndAlso nVal > 0 Then
|
|
' OptionModule.m_nDecDigit = nVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_DECDIGIT, OptionModule.m_nDecDigit.ToString())
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property SelectedFont As String
|
|
' Get
|
|
' Return m_FontList(m_FontList.IndexOf(OptionModule.m_sFont))
|
|
' End Get
|
|
' Set(value As String)
|
|
' OptionModule.m_sFont = value
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_DIMFONT, OptionModule.m_sFont)
|
|
' End Set
|
|
'End Property
|
|
|
|
'Public Property TextHeight As String
|
|
' Get
|
|
' Return LenToString(OptionModule.m_dTextHeight, 5)
|
|
' End Get
|
|
' Set(value As String)
|
|
' Dim dVal As Double = 0
|
|
' If StringToLen(value, dVal) AndAlso dVal > 0 Then
|
|
' OptionModule.m_dTextHeight = dVal
|
|
' EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
|
|
' WritePrivateProfileString(S_DIMENSIONSTYLE, K_TEXTHEIGHT, DoubleToString(OptionModule.m_dTextHeight, 5))
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
Private m_DXFScaleEnable As Boolean = False
|
|
Public Property DXFScaleEnable As Boolean
|
|
Get
|
|
Return m_DXFScaleEnable
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_DXFScaleEnable = value
|
|
NotifyPropertyChanged(NameOf(DXFScaleEnable))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_STLScaleEnable As Boolean = False
|
|
Public Property STLScaleEnable As Boolean
|
|
Get
|
|
Return m_STLScaleEnable
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_STLScaleEnable = value
|
|
NotifyPropertyChanged(NameOf(STLScaleEnable))
|
|
End Set
|
|
End Property
|
|
|
|
'Private m_ImageScaleEnable As Boolean = False
|
|
'Public Property ImageScaleEnable As Boolean
|
|
' Get
|
|
' Return m_ImageScaleEnable
|
|
' End Get
|
|
' Set(value As Boolean)
|
|
' m_ImageScaleEnable = value
|
|
' NotifyPropertyChanged(NameOf(ImageScaleEnable))
|
|
' End Set
|
|
'End Property
|
|
|
|
Public Property SelectedDXFScale As String
|
|
Get
|
|
If Math.Abs(OptionModule.m_dDxfScaleFactor - ONEMM) < EPS_SMALL * 10 Then
|
|
Return ScaleDXFList(ScaleDXFList.IndexOf("mm"))
|
|
ElseIf Math.Abs(OptionModule.m_dDxfScaleFactor - ONEINCH) < EPS_SMALL * 10 Then
|
|
Return ScaleDXFList(ScaleDXFList.IndexOf("inch"))
|
|
Else
|
|
DXFScaleEnable = True
|
|
Return ScaleDXFList(ScaleDXFList.IndexOf(EgtMsg(6546)))
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
If value = "mm" Then
|
|
DxfScaleFactor = LenToString(ONEMM, 3)
|
|
DXFScaleEnable = False
|
|
ElseIf value = "inch" Then
|
|
DxfScaleFactor = LenToString(ONEINCH, 4)
|
|
DXFScaleEnable = False
|
|
Else
|
|
DXFScaleEnable = True
|
|
DxfScaleFactor = LenToString(OptionModule.m_dDxfScaleFactor, 4)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SelectedSTLScale As String
|
|
Get
|
|
If Math.Abs(OptionModule.m_dStlScaleFactor - ONEMM) < EPS_SMALL * 10 Then
|
|
Return ScaleSTLList(ScaleSTLList.IndexOf("mm"))
|
|
ElseIf Math.Abs(OptionModule.m_dStlScaleFactor - ONEINCH) < EPS_SMALL * 10 Then
|
|
Return ScaleSTLList(ScaleSTLList.IndexOf("inch"))
|
|
Else
|
|
STLScaleEnable = True
|
|
Return ScaleSTLList(ScaleSTLList.IndexOf(EgtMsg(6546)))
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
If value = "mm" Then
|
|
StlScaleFactor = LenToString(ONEMM, 3)
|
|
STLScaleEnable = False
|
|
ElseIf value = "inch" Then
|
|
StlScaleFactor = LenToString(ONEINCH, 4)
|
|
STLScaleEnable = False
|
|
Else
|
|
StlScaleFactor = LenToString(OptionModule.m_dStlScaleFactor, 4)
|
|
STLScaleEnable = True
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
'Public Property SelectedImageScale As String
|
|
' Get
|
|
' If Math.Abs(OptionModule.m_dImgScaleFactor - ONEMM) < EPS_SMALL * 10 Then
|
|
' Return ScaleImageList(ScaleImageList.IndexOf("mm"))
|
|
' ElseIf Math.Abs(OptionModule.m_dImgScaleFactor - ONEINCH) < EPS_SMALL * 10 Then
|
|
' Return ScaleImageList(ScaleImageList.IndexOf("inch"))
|
|
' Else
|
|
' ImageScaleEnable = True
|
|
' Return ScaleImageList(ScaleImageList.IndexOf(EgtMsg(6546)))
|
|
' ImageScaleEnable = True
|
|
' End If
|
|
' End Get
|
|
' Set(value As String)
|
|
' If value = "mm" Then
|
|
' ImageScaleFactor = LenToString(ONEMM, 3)
|
|
' ImageScaleEnable = False
|
|
' ElseIf value = "inch" Then
|
|
' ImageScaleFactor = LenToString(ONEINCH, 4)
|
|
' ImageScaleEnable = False
|
|
' Else
|
|
' ImageScaleFactor = LenToString(OptionModule.m_dImgScaleFactor, 4)
|
|
' ImageScaleEnable = True
|
|
' End If
|
|
' End Set
|
|
'End Property
|
|
|
|
' Definizione comandi
|
|
|
|
Private m_cmdTopSceneBackground As ICommand
|
|
Private m_cmdBotSceneBackground As ICommand
|
|
Private m_cmdGridColor As ICommand
|
|
Private m_cmdUpdateLicenceCmd As ICommand
|
|
Private m_cmdAddMachineCmd As ICommand
|
|
Private m_cmdExportMachineCmd As ICommand
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property Title As String
|
|
Get
|
|
Return EgtMsg(5005)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property GenericMsg As String
|
|
Get
|
|
Return EgtMsg(6514)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrentLanguageMsg As String
|
|
Get
|
|
Return EgtMsg(6501)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property LanguageAdvertMsg As String
|
|
Get
|
|
Return EgtMsg(6502)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TopSceneBackgroundMsg As String
|
|
Get
|
|
Return EgtMsg(6510)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property BotSceneBackgroundMsg As String
|
|
Get
|
|
Return EgtMsg(6511)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GridColorMsg As String
|
|
Get
|
|
Return EgtMsg(6517)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ThickLineMsg As String
|
|
Get
|
|
Return EgtMsg( 6536) ' Linee spesse
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SmoothTriMeshMsg As String
|
|
Get
|
|
Return EgtMsg( 6518) ' Superfici smussate
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property UpdateLicenceMsg As String
|
|
Get
|
|
Return EgtMsg( 6553) ' Aggiorna licenza
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CADMsg As String
|
|
Get
|
|
Return EgtMsg(6515)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeometryToleranceMsg As String
|
|
Get
|
|
Return EgtMsg(6513)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ImportMsg As String
|
|
Get
|
|
Return EgtMsg(6519)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DxfScaleFactorMsg As String
|
|
Get
|
|
Return EgtMsg(6520)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property StlScaleFactorMsg As String
|
|
Get
|
|
Return EgtMsg(6521)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImageScaleFactorMsg As String
|
|
Get
|
|
Return EgtMsg(6522)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ExportMsg As String
|
|
Get
|
|
Return EgtMsg(6523)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property UnitScaleMsg As String
|
|
Get
|
|
Return EgtMsg(6547) ' Unità di scala
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property FactorScaleMsg As String
|
|
Get
|
|
Return EgtMsg(6548) ' Fattore di scala
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImageMsg As String
|
|
Get
|
|
Return EgtMsg(6524)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImageWidthMsg As String
|
|
Get
|
|
Return EgtMsg(6525)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImageHeightMsg As String
|
|
Get
|
|
Return EgtMsg(6526)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CAMMsg As String
|
|
Get
|
|
Return EgtMsg(6516)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property MachiningSelGeomMsg As String
|
|
Get
|
|
Return EgtMsg(6506)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypeMillingMsg As String
|
|
Get
|
|
Return EgtMsg(6203)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypeDrillingMsg As String
|
|
Get
|
|
Return EgtMsg(6201)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypeSawingMsg As String
|
|
Get
|
|
Return EgtMsg(6202)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypePocketingMsg As String
|
|
Get
|
|
Return EgtMsg(6204)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypeMortisingMsg As String
|
|
Get
|
|
Return EgtMsg(6205)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property GeomTypeChiselingMsg As String
|
|
Get
|
|
Return EgtMsg(6209)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property NewMachiningPosMsg As String
|
|
Get
|
|
Return EgtMsg(6507)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property UseDispositionScriptMsg As String
|
|
Get
|
|
Return EgtMsg(6508)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property AddMachineMsg As String
|
|
Get
|
|
Return EgtMsg(6527) ' Aggiungi macchina
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ExportMachineMsg As String
|
|
Get
|
|
Return EgtMsg(6549) ' Esporta macchina
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DimensionMsg As String
|
|
Get
|
|
Return EgtMsg(6544) ' Quotatura
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ExtLineLenMsg As String
|
|
Get
|
|
Return EgtMsg(6537) ' Estensione linea
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ArrowLenMsg As String
|
|
Get
|
|
Return EgtMsg(6538) ' Dimensione freccia
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TextDistMsg As String
|
|
Get
|
|
Return EgtMsg(6539) ' Distanza messaggio
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property LenIsMMMsg As String
|
|
Get
|
|
Return EgtMsg(6540) ' Unità di misura
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property DecDigitMsg As String
|
|
Get
|
|
Return EgtMsg(6541) ' Numero dicmali
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property FontMsg As String
|
|
Get
|
|
Return EgtMsg(6542) ' Caretteri
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TextHeightMsg As String
|
|
Get
|
|
Return EgtMsg(6543) ' Dimensione testo
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
Private Function SelectColor(Col As Color3d, ByRef NewCol As Color3d) As Boolean
|
|
' Recupero colori custom
|
|
Dim sCustomColors As String = ""
|
|
GetMainPrivateProfileString(S_COLORS, K_CUSTOMCOLORS, "", sCustomColors)
|
|
Dim CustomColors() As String = sCustomColors.Split(","c)
|
|
Dim nCustomColors As New List(Of Integer)
|
|
For Each Color In CustomColors
|
|
Dim nColor As Integer
|
|
If Integer.TryParse(Color, nColor) Then
|
|
nCustomColors.Add(nColor)
|
|
End If
|
|
Next
|
|
' Creo dialogo colori
|
|
Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
ColorDlg.FullOpen = True
|
|
ColorDlg.CustomColors = nCustomColors.ToArray()
|
|
ColorDlg.Color = Col.ToColor()
|
|
' Visualizzo dialogo
|
|
If ColorDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return False
|
|
' Recupero colore scelto
|
|
NewCol.FromColor(ColorDlg.Color)
|
|
' Salvo eventuali modifiche ai colori custom
|
|
sCustomColors = ""
|
|
For Each Color In ColorDlg.CustomColors
|
|
sCustomColors &= Color.ToString() & ","
|
|
Next
|
|
sCustomColors = sCustomColors.Trim({" "c, ","c})
|
|
WriteMainPrivateProfileString(S_COLORS, K_CUSTOMCOLORS, sCustomColors)
|
|
Return True
|
|
End Function
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "TopSceneBackground"
|
|
|
|
''' <summary>
|
|
''' Returns a command that remove the current selected machining.
|
|
''' </summary>
|
|
Public ReadOnly Property TopSceneBackground_Command() As ICommand
|
|
Get
|
|
If m_cmdTopSceneBackground Is Nothing Then
|
|
m_cmdTopSceneBackground = New Command(AddressOf TopSceneBackgroundCmd)
|
|
End If
|
|
Return m_cmdTopSceneBackground
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
|
|
''' </summary>
|
|
Public Sub TopSceneBackgroundCmd()
|
|
' Recupero colore da Ini
|
|
Dim BackTopColor As New Color3d(192, 192, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
|
|
' Eseguo modifica con dialogo
|
|
If SelectColor(BackTopColor, BackTopColor) Then
|
|
OptionModule.m_TopSceneBackground = BackTopColor
|
|
Map.refSceneHostVM.MainScene.SetViewBackground(OptionModule.m_TopSceneBackground, OptionModule.m_BotSceneBackground)
|
|
WritePrivateProfileColor(S_SCENE, K_BACKTOP, OptionModule.m_TopSceneBackground)
|
|
NotifyPropertyChanged(NameOf(TopSceneBackground))
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' TopSceneBackground
|
|
|
|
#Region "BotSceneBackground"
|
|
|
|
''' <summary>
|
|
''' Returns a command that remove the current selected machining.
|
|
''' </summary>
|
|
Public ReadOnly Property BotSceneBackground_Command() As ICommand
|
|
Get
|
|
If m_cmdBotSceneBackground Is Nothing Then
|
|
m_cmdBotSceneBackground = New Command(AddressOf BotSceneBackgroundCmd)
|
|
End If
|
|
Return m_cmdBotSceneBackground
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
|
|
''' </summary>
|
|
Public Sub BotSceneBackgroundCmd()
|
|
' Recupero colore da Ini
|
|
Dim BackBotColor As New Color3d(192, 192, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
|
|
' Eseguo modifica con dialogo
|
|
If SelectColor(BackBotColor, BackBotColor) Then
|
|
OptionModule.m_BotSceneBackground = BackBotColor
|
|
Map.refSceneHostVM.MainScene.SetViewBackground(OptionModule.m_TopSceneBackground, OptionModule.m_BotSceneBackground)
|
|
WritePrivateProfileColor(S_SCENE, K_BACKBOTTOM, OptionModule.m_BotSceneBackground)
|
|
NotifyPropertyChanged(NameOf(BotSceneBackground))
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' BotSceneBackground
|
|
|
|
#Region "GridColor"
|
|
|
|
''' <summary>
|
|
''' Returns a command that remove the current selected machining.
|
|
''' </summary>
|
|
Public ReadOnly Property GridColor_Command() As ICommand
|
|
Get
|
|
If m_cmdGridColor Is Nothing Then
|
|
m_cmdGridColor = New Command(AddressOf GridColorCmd)
|
|
End If
|
|
Return m_cmdGridColor
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
|
|
''' </summary>
|
|
Public Sub GridColorCmd()
|
|
' Recupero colore da Ini
|
|
Dim GridColor As New Color3d(192, 192, 192)
|
|
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, GridColor)
|
|
' Eseguo modifica con dialogo
|
|
If SelectColor(GridColor, GridColor) Then
|
|
OptionModule.m_GridColor = GridColor
|
|
'IniFile.MinLnColor = GridColor
|
|
'IniFile.MajLnColor = GridColor
|
|
EgtSetGridColor(GridColor, GridColor)
|
|
WritePrivateProfileColor(S_GRID, K_MINLNCOLOR, OptionModule.m_GridColor)
|
|
WritePrivateProfileColor(S_GRID, K_MAJLNCOLOR, OptionModule.m_GridColor)
|
|
EgtDraw()
|
|
NotifyPropertyChanged(NameOf(GridColor))
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' GridColor
|
|
|
|
#Region "UpdateLicence"
|
|
|
|
''' <summary>
|
|
''' Returns a command that update the licence.
|
|
''' </summary>
|
|
Public ReadOnly Property UpdateLicence_Command() As ICommand
|
|
Get
|
|
If m_cmdUpdateLicenceCmd Is Nothing Then
|
|
m_cmdUpdateLicenceCmd = New Command(AddressOf UpdateLicenceCmd)
|
|
End If
|
|
Return m_cmdUpdateLicenceCmd
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Update the licence.
|
|
''' </summary>
|
|
Public Sub UpdateLicenceCmd()
|
|
' Apro dialogo per richiesta file licenza
|
|
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
|
|
.DefaultExt = ".lic",
|
|
.Filter = "Licences (.lic)|*.lic",
|
|
.CheckFileExists = True,
|
|
.ValidateNames = True
|
|
}
|
|
If LicDlg.ShowDialog() = True Then
|
|
' Recupero il direttorio del file
|
|
Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
|
|
' Se il file non è già nel direttorio di configurazione lo copio
|
|
If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
|
|
Try
|
|
File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True)
|
|
Catch ex As Exception
|
|
Return
|
|
End Try
|
|
End If
|
|
' Imposto il nuovo file di licenza nell'Ini
|
|
WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' AddMachine
|
|
|
|
#Region "AddMachine"
|
|
|
|
''' <summary>
|
|
''' Returns a command that add a new machining.
|
|
''' </summary>
|
|
Public ReadOnly Property AddMachine_Command() As ICommand
|
|
Get
|
|
If m_cmdAddMachineCmd Is Nothing Then
|
|
m_cmdAddMachineCmd = New Command(AddressOf AddMachineCmd)
|
|
End If
|
|
Return m_cmdAddMachineCmd
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Add a new machining.
|
|
''' </summary>
|
|
Public Sub AddMachineCmd()
|
|
' Apro dialogo per richiesta file zip di macchina
|
|
Dim MachDlg As New Microsoft.Win32.OpenFileDialog() With {
|
|
.DefaultExt = ".zip",
|
|
.Filter = "Machines (.zip)|*.zip",
|
|
.CheckFileExists = True,
|
|
.ValidateNames = True
|
|
}
|
|
If MachDlg.ShowDialog() <> True Then Return
|
|
Dim sMachZip As String = MachDlg.FileName
|
|
Dim sMachName As String = Path.GetFileNameWithoutExtension(sMachZip)
|
|
Dim sMachDir As String = Path.Combine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, sMachName)
|
|
' Preparo direttorio temporaneo
|
|
Dim sTempDir As String = Path.Combine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, "Temp")
|
|
If My.Computer.FileSystem.DirectoryExists( sTempDir) Then
|
|
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CreateDirectory( sTempDir)
|
|
' Unzip nel direttorio temporaneo
|
|
Using zip As New Ionic.Zip.ZipFile(sMachZip)
|
|
zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite)
|
|
End Using
|
|
' Se non è una macchina segnalo il problema ed esco
|
|
If Not My.Computer.FileSystem.FileExists( Path.Combine( sTempDir, sMachName, sMachName & ".ini")) Or
|
|
Not My.Computer.FileSystem.FileExists( Path.Combine( sTempDir, sMachName, sMachName & ".mlde")) Then
|
|
' Il file {0} non contiene una macchina - Avviso
|
|
Dim sOut As String = String.Format(EgtMsg(6529), sMachZip)
|
|
MessageBox.Show(sOut, EgtMsg(MSG_MESSAGEBOX + 2), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
' Rimuovo il direttorio temporaneo ed esco
|
|
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
Return
|
|
End If
|
|
' Imposto data e ora correnti al file mlde della macchina
|
|
Try
|
|
File.SetLastWriteTime( Path.Combine( sTempDir, sMachName, sMachName & ".mlde"), System.DateTime.Now)
|
|
Catch ex As Exception
|
|
End Try
|
|
' Verifico esistenza di una macchina con lo stesso nome
|
|
Dim bOldExists As Boolean = My.Computer.FileSystem.DirectoryExists( sMachDir)
|
|
Dim bUpdate As Boolean = True
|
|
If bOldExists Then
|
|
Dim MachBox As New UpdateMachineV(Application.Current.MainWindow, New UpdateMachineVM(sMachName))
|
|
MachBox.ShowDialog()
|
|
Select Case MachBox.DialogResult
|
|
Case MessageBoxResult.Yes
|
|
bUpdate = False
|
|
Case MessageBoxResult.No
|
|
bUpdate = True
|
|
Case MessageBoxResult.Cancel
|
|
' Rimuovo il direttorio temporaneo ed esco
|
|
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
Return
|
|
End Select
|
|
' Faccio una copia di backup della macchina corrente
|
|
Dim sBackupDir As String = sMachDir & ".old"
|
|
If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then
|
|
My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
Try
|
|
My.Computer.FileSystem.MoveDirectory( sMachDir, sBackupDir, True)
|
|
Catch ex As Exception
|
|
' Ripristino lo stato originale ed esco
|
|
My.Computer.FileSystem.MoveDirectory( sBackupDir, sMachDir, True)
|
|
' L'aggiornamento della macchina "{0}" non è riuscito.
|
|
Dim sKo As String = String.Format(EgtMsg(6535), sMachName)
|
|
EgtOutLog( sKo)
|
|
MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK)
|
|
Return
|
|
End Try
|
|
End If
|
|
' Installo la macchina
|
|
My.Computer.FileSystem.MoveDirectory( Path.Combine( sTempDir, sMachName), sMachDir, True)
|
|
' Se è un aggiornamento, recupero utensili, lavorazioni, attrezzaggi e dati per travi
|
|
If bOldExists And bUpdate Then
|
|
Dim sBackupDir As String = sMachDir & ".old"
|
|
If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Tools") Then
|
|
If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Tools") Then
|
|
My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Tools", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Tools", sMachDir & "\Tools", True)
|
|
End If
|
|
If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Machinings") Then
|
|
If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Machinings") Then
|
|
My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Machinings", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Machinings", sMachDir & "\Machinings", True)
|
|
End If
|
|
If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Materials") Then
|
|
If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Materials") Then
|
|
My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Materials", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Materials", sMachDir & "\Materials", True)
|
|
End If
|
|
If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\SetUp") Then
|
|
If My.Computer.FileSystem.DirectoryExists(sMachDir & "\SetUp") Then
|
|
My.Computer.FileSystem.DeleteDirectory(sMachDir & "\SetUp", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CopyDirectory(sBackupDir & "\SetUp", sMachDir & "\SetUp", True)
|
|
End If
|
|
If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\CustomData") Then
|
|
If My.Computer.FileSystem.DirectoryExists(sMachDir & "\CustomData") Then
|
|
My.Computer.FileSystem.DeleteDirectory(sMachDir & "\CustomData", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
End If
|
|
My.Computer.FileSystem.CopyDirectory(sBackupDir & "\CustomData", sMachDir & "\CustomData", True)
|
|
End If
|
|
End If
|
|
'La macchina "{0}" è stata aggiornata con successo.
|
|
Dim sOk As String = String.Format(EgtMsg(6530), sMachName)
|
|
EgtOutLog( sOk)
|
|
MessageBox.Show(sOk, EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK)
|
|
' Rimuovo il direttorio temporaneo
|
|
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
|
' Aggiorno la lista delle macchina
|
|
MyMachine.InsertMachine(sMachDir, Map.refMachinePanelVM.MachineList)
|
|
End Sub
|
|
|
|
#End Region ' AddMachine
|
|
|
|
#Region "ExportMachine"
|
|
|
|
''' <summary>
|
|
''' Returns a command that export a new machining.
|
|
''' </summary>
|
|
Public ReadOnly Property ExportMachine_Command() As ICommand
|
|
Get
|
|
If m_cmdExportMachineCmd Is Nothing Then
|
|
m_cmdExportMachineCmd = New Command(AddressOf ExportMachineCmd)
|
|
End If
|
|
Return m_cmdExportMachineCmd
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Export the current machine.
|
|
''' </summary>
|
|
Public Sub ExportMachineCmd()
|
|
' Recupero il nome della macchina correntemente selezionata
|
|
Dim sCurrMachineName As String = String.Empty
|
|
EgtGetCurrMachineName(sCurrMachineName)
|
|
' Creo il dialog per scegliere dove salvare lo zip
|
|
Dim sDirPath As String = String.Empty
|
|
Dim folderDialog As New Windows.Forms.FolderBrowserDialog
|
|
folderDialog.Description = EgtMsg(6550)
|
|
If folderDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
|
Return
|
|
End If
|
|
sDirPath = folderDialog.SelectedPath
|
|
' Creo zip file da salvare
|
|
Dim sZipToCreate As String = sDirPath & "\" & sCurrMachineName & ".zip"
|
|
If File.Exists(sZipToCreate) Then
|
|
File.Delete(sZipToCreate)
|
|
End If
|
|
Try
|
|
Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out)
|
|
zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
|
|
zip.AlternateEncoding = Text.Encoding.UTF8
|
|
' aggiungo i file della Macchina
|
|
Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachineName
|
|
If Directory.Exists(sMachineDir) Then
|
|
zip.AddSelectedFiles( "name != *\.git\*.* and name != *.git*", sMachineDir, sCurrMachineName, True)
|
|
End If
|
|
' salvo lo zip
|
|
zip.Save()
|
|
End Using
|
|
Catch ex1 As Exception
|
|
EgtOutLog("Exception in zip: " & ex1.ToString())
|
|
' L'esportazione della macchina "{0}" non è riuscita.
|
|
Dim sKo As String = String.Format(EgtMsg(6551), sCurrMachineName)
|
|
EgtOutLog(sKo)
|
|
MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK)
|
|
End Try
|
|
'La macchina "{0}" è stata esportata con successo.
|
|
Dim sOk As String = String.Format(EgtMsg(6552), sCurrMachineName)
|
|
EgtOutLog(sOk)
|
|
MessageBox.Show(sOk, EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK)
|
|
End Sub
|
|
|
|
#End Region ' ExportMachine
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|
|
|
|
Public Class LayerColor
|
|
Inherits VMBase
|
|
|
|
Public Enum LayerType As Integer
|
|
PRINTPART = 1
|
|
'REFERENCE = 2
|
|
MACHSTART = 3
|
|
RIBS = 4
|
|
SHELLNUMBERS = 5
|
|
AUXSOLIDS = 6
|
|
OTHERS = 7
|
|
End Enum
|
|
|
|
Private m_Type As LayerType
|
|
Public ReadOnly Property c3Color As Color3d
|
|
Get
|
|
Select Case m_Type
|
|
Case LayerType.PRINTPART
|
|
Return GeomEntityColors.c3Print
|
|
Case LayerType.RIBS
|
|
Return GeomEntityColors.c3Rib
|
|
Case LayerType.SHELLNUMBERS
|
|
Return GeomEntityColors.c3ShellNumber
|
|
Case LayerType.AUXSOLIDS
|
|
Return GeomEntityColors.c3AuxSolids
|
|
Case LayerType.MACHSTART
|
|
Return GeomEntityColors.c3MachStart
|
|
Case LayerType.OTHERS
|
|
Return GeomEntityColors.c3Others
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Background As Brush
|
|
Get
|
|
Return New SolidColorBrush(Color.FromArgb(CByte(255),
|
|
CByte(c3Color.R),
|
|
CByte(c3Color.G),
|
|
CByte(c3Color.B)))
|
|
End Get
|
|
End Property
|
|
|
|
Public Property dAlpha As Double
|
|
Get
|
|
Return c3Color.A
|
|
End Get
|
|
Set(value As Double)
|
|
GeomEntityColors.SetAlpha(m_Type, value)
|
|
NotifyPropertyChanged(NameOf(sAlpha))
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property sAlpha As String
|
|
Get
|
|
Return c3Color.A & "%"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Color_Msg As String
|
|
Get
|
|
Select Case m_Type
|
|
Case LayerType.PRINTPART
|
|
Return "Print"
|
|
Case LayerType.RIBS
|
|
Return "Ribs"
|
|
Case LayerType.SHELLNUMBERS
|
|
Return "Reduce Shell Number"
|
|
Case LayerType.AUXSOLIDS
|
|
Return "Filled Solids"
|
|
Case LayerType.MACHSTART
|
|
Return "Layer Start"
|
|
Case LayerType.OTHERS
|
|
Return "Others"
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Private m_cmdColor As ICommand
|
|
|
|
Sub New(Type As LayerType)
|
|
m_Type = Type
|
|
End Sub
|
|
|
|
Private Function SelectColor(Col As Color3d, ByRef NewCol As Color3d) As Boolean
|
|
' Recupero colori custom
|
|
Dim sCustomColors As String = ""
|
|
GetMainPrivateProfileString(S_COLORS, K_CUSTOMCOLORS, "", sCustomColors)
|
|
Dim CustomColors() As String = sCustomColors.Split(","c)
|
|
Dim nCustomColors As New List(Of Integer)
|
|
For Each Color In CustomColors
|
|
Dim nColor As Integer
|
|
If Integer.TryParse(Color, nColor) Then
|
|
nCustomColors.Add(nColor)
|
|
End If
|
|
Next
|
|
' Creo dialogo colori
|
|
Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
ColorDlg.FullOpen = True
|
|
ColorDlg.CustomColors = nCustomColors.ToArray()
|
|
ColorDlg.Color = Col.ToColor()
|
|
' Visualizzo dialogo
|
|
If ColorDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return False
|
|
' Recupero colore scelto
|
|
NewCol.FromColor(ColorDlg.Color)
|
|
' Salvo eventuali modifiche ai colori custom
|
|
sCustomColors = ""
|
|
For Each Color In ColorDlg.CustomColors
|
|
sCustomColors &= Color.ToString() & ","
|
|
Next
|
|
sCustomColors = sCustomColors.Trim({" "c, ","c})
|
|
WriteMainPrivateProfileString(S_COLORS, K_CUSTOMCOLORS, sCustomColors)
|
|
Return True
|
|
End Function
|
|
|
|
#Region "Color"
|
|
|
|
''' <summary>
|
|
''' Returns a command that remove the current selected machining.
|
|
''' </summary>
|
|
Public ReadOnly Property Color_Command() As ICommand
|
|
Get
|
|
If m_cmdColor Is Nothing Then
|
|
m_cmdColor = New Command(AddressOf ColorCmd)
|
|
End If
|
|
Return m_cmdColor
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
|
|
''' </summary>
|
|
Public Sub ColorCmd()
|
|
' Recupero colore da Ini
|
|
Dim c3Print As Color3d = c3Color
|
|
' Eseguo modifica con dialogo
|
|
If SelectColor(c3Color, c3Print) Then
|
|
GeomEntityColors.SetColor(m_Type, c3Print)
|
|
NotifyPropertyChanged(NameOf(Background))
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' PrintPartColor
|
|
|
|
End Class
|
|
|
|
'Public Class GeomTypeConverter
|
|
' Implements IValueConverter
|
|
|
|
' Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
|
' Select Case CInt(value)
|
|
' Case SceneSelModeOpt.PARTCURVES
|
|
' Return EgtMsg(MSG_OPTIONPAGE + 3)
|
|
' Case SceneSelModeOpt.PARTSURFACES
|
|
' Return EgtMsg(MSG_OPTIONPAGE + 4)
|
|
' Case Else
|
|
' Return EgtMsg(MSG_OPTIONPAGE + 5)
|
|
' End Select
|
|
' End Function
|
|
|
|
' Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
' Throw New NotImplementedException
|
|
' End Function
|
|
|
|
'End Class |