TestEIn 1.6d10 :
- possibilità di salvare un singolo pezzo o layer o entità.
This commit is contained in:
@@ -24,6 +24,8 @@ Public Class Controller
|
||||
Public Event OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Public Event OnSavingProject(ByVal sender As Object)
|
||||
Public Event OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Public Event OnSavingObject(ByVal sender As Object)
|
||||
Public Event OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Public Event OnImportingProject(ByVal sender As Object, ByVal bOkType As Boolean)
|
||||
Public Event OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Public Event OnExportingProject(ByVal sender As Object)
|
||||
@@ -330,6 +332,59 @@ Public Class Controller
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function SaveObject(ByVal nId As Integer, Optional ByVal sDir As String = "", Optional ByVal nType As NGE = NGE.CMPTEXT) As Boolean
|
||||
'Creo nome di default
|
||||
Dim sName As String = String.Empty
|
||||
If Not EgtGetName(nId, sName) Then
|
||||
Dim nObjType As Integer = EgtGetType(nId)
|
||||
If nObjType = GDB_TY.GROUP Then
|
||||
If EgtIsPart(nId) Then
|
||||
sName = "Part" & nId.ToString()
|
||||
ElseIf EgtIsLayer(nId) Then
|
||||
sName = "Layer" & nId.ToString()
|
||||
Else
|
||||
sName = "Group" & nId.ToString()
|
||||
End If
|
||||
ElseIf nObjType <> GDB_TY.NONE Then
|
||||
Dim sTitle As String = String.Empty
|
||||
EgtGetTitle(nId, sTitle)
|
||||
sName = sTitle & nId.ToString()
|
||||
Else
|
||||
sName = "Unknown" & nId.ToString()
|
||||
End If
|
||||
End If
|
||||
'Sistemo path
|
||||
Dim sFile As String
|
||||
If String.IsNullOrWhiteSpace(sDir) Then
|
||||
sFile = sName
|
||||
Else
|
||||
sFile = sDir.TrimEnd("\") & "\" & sName
|
||||
End If
|
||||
'Assegnazione nome file con dialogo
|
||||
Dim SaveFileDialog As New SaveFileDialog
|
||||
SaveFileDialog.Title = "Save Object"
|
||||
SaveFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge"
|
||||
SaveFileDialog.FileName = sFile
|
||||
SaveFileDialog.InitialDirectory = sDir.TrimEnd("\")
|
||||
If SaveFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
End If
|
||||
Dim sFileName As String = SaveFileDialog.FileName
|
||||
'Prima del salvataggio
|
||||
RaiseEvent OnSavingObject(Me)
|
||||
'Salvataggio dell'oggetto con la sua ascendenza
|
||||
m_Scene.Cursor = Cursors.WaitCursor
|
||||
EnableCommandLog()
|
||||
Dim bOk As Boolean = EgtSaveObjToFile(nId, sFileName, nType)
|
||||
DisableCommandLog()
|
||||
m_Scene.Cursor = Cursors.Default
|
||||
'Aggiorno
|
||||
RaiseEvent UpdateUI(Me, False)
|
||||
'Gestione risultato
|
||||
RaiseEvent OnSavedObject(Me, sFileName, bOk)
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function ImportProject(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean
|
||||
' gestisco eventuale file corrente modificato
|
||||
If Not ManageModified() Then
|
||||
|
||||
Reference in New Issue
Block a user