From 8f61ba413dc7c6406956c5f69f053470e61cb2f9 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Mon, 8 May 2017 08:36:16 +0000 Subject: [PATCH] OmagOFFICE : - Aggiunta importazione Csv. --- CompoWindow/CompoWindowVM.vb | 1 + CsvWindow/CsvM.vb | 501 ++++++++++++++++++++++++ CsvWindow/CsvWindowV.xaml | 108 ++++- CsvWindow/CsvWindowV.xaml.vb | 39 ++ CsvWindow/CsvWindowVM.vb | 377 +++++++++++++++++- MainWindow/MainWindowM.vb | 5 + My Project/AssemblyInfo.vb | 4 +- OmagOFFICE.vbproj | 4 + OptionPanel/NestingTab/NestingTabV.xaml | 8 +- OptionPanel/NestingTab/NestingTabVM.vb | 39 +- Project/ProjectVM.vb | 5 + Resources/TreeView/Folder.png | Bin 0 -> 1292 bytes Utility/OmagOFFICEDictionary.xaml | 112 ++++++ Utility/OmagOFFICEMap.vb | 14 +- 14 files changed, 1179 insertions(+), 38 deletions(-) create mode 100644 CsvWindow/CsvM.vb create mode 100644 Resources/TreeView/Folder.png diff --git a/CompoWindow/CompoWindowVM.vb b/CompoWindow/CompoWindowVM.vb index 9ba288a..c89643a 100644 --- a/CompoWindow/CompoWindowVM.vb +++ b/CompoWindow/CompoWindowVM.vb @@ -23,6 +23,7 @@ Public Class CompoWindowVM Friend Const LUA_CMP_WITHINT As String = LUA_CMP_VARS & ".WithInt" Friend Event m_CloseWindow(bDialogResult As Boolean) + Friend m_SelCompoFamily As CompoItem = Nothing Friend m_SelCompo As CompoItem = Nothing Friend m_SelInternalCompo As CompoItem = Nothing diff --git a/CsvWindow/CsvM.vb b/CsvWindow/CsvM.vb new file mode 100644 index 0000000..1979b46 --- /dev/null +++ b/CsvWindow/CsvM.vb @@ -0,0 +1,501 @@ +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class CsvM + + ' Dati lista + Private m_sCsvPath As String = String.Empty + Friend ReadOnly Property CsvPath As String + Get + Return m_sCsvPath + End Get + End Property + Private m_CsvPartList As New List(Of CsvPart) + Friend ReadOnly Property CsvPartList As List(Of CsvPart) + Get + Return m_CsvPartList + End Get + End Property + Private m_sCompoDir As String = String.Empty + + ' Dati del grezzo + Private m_nRawId As Integer = GDB_ID.NULL + Private m_ptRawMin As Point3d + Private m_ptRawMax As Point3d + +#Region "CONSTRUCTOR" + + Sub New() + ' Creo riferimento a questa classe in OmagOFFICEMap + OmagOFFICEMap.SetRefCsvM(Me) + InitCsvM() + ' Leggo direttorio componenti + GetMainPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir) + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Friend Sub InitCsvM() + ' Leggo lista pezzi corrente + Dim sCsvFile As String = String.Empty + GetmainPrivateProfileString(S_CSV, K_CSVLASTFILE, "", sCsvFile) + If Not String.IsNullOrEmpty(sCsvFile) Then + LoadCsvPartList(sCsvFile) + End If + End Sub + + Friend Sub NewCmd() + ' Salvo lista dei pezzi attuale + SaveCsvPartList() + ' Pulisco path e lista dei pezzi Csv + m_sCsvPath = String.Empty + m_CsvPartList.Clear() + ' Registro in ini nessuna path + WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, "") + End Sub + + Friend Sub Open() + ' Salvo lista dei pezzi attuale + SaveCsvPartList() + ' Leggo direttorio corrente dei file CSV + Dim sCurrDir As String = "" + GetMainPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir) + ' Apro dialogo scelta file + Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() + OpenFileDialog.InitialDirectory = sCurrDir + OpenFileDialog.Filter = "Csv file|*.Csv|Epl file|*.Epl" + If Not OpenFileDialog.ShowDialog() Then Return + ' Salvo direttorio corrente + WriteMainPrivateProfileString(S_CSV, K_CSVCURRDIR, Path.GetDirectoryName(OpenFileDialog.FileName)) + ' Apertura file + Dim sPath = OpenFileDialog.FileName + If String.Compare(Path.GetExtension(sPath), ".CSV", True) = 0 Then + LoadCsvFile(sPath) + Else + LoadCsvPartList(sPath) + End If + End Sub + + Friend Sub Insert() + ' Recupero lo spessore della lastra corrente + Dim dRawHeight As Double = EstCalc.GetRawHeight() + If dRawHeight < EPS_SMALL Then Return + ' Recupero il materiale della lastra corrente + Dim sCurrMat As String = String.Empty + If Not IsNothing(CurrentMachine.CurrMat) Then + sCurrMat = CurrentMachine.CurrMat.sName + End If + ' Creo la lista dei pezzi inseribili nella lastra corrente + Dim InsPartList As New List(Of CsvPart) + For i As Integer = 1 To m_CsvPartList.Count() + Dim CurrPart As CsvPart = m_CsvPartList(i - 1) + If CurrPart.m_bActive And + Math.Abs(CurrPart.m_dTh - dRawHeight) < 100 * EPS_SMALL And + (String.IsNullOrWhiteSpace(CurrPart.m_sMaterial) Or + String.IsNullOrWhiteSpace(sCurrMat) Or + sCurrMat = "***" Or + String.Compare(CurrPart.m_sMaterial, sCurrMat, True) = 0) Then + InsPartList.Add(CurrPart) + End If + Next + ' Lancio l'inserimento dei pezzi + ExecInsert(InsPartList) + ' Aggiorno visualizzazione + EgtDraw() + End Sub + + Private Function ExecInsert(InsPartList As List(Of CsvPart)) As Boolean + Dim bMaxDimOnX As Boolean = (GetMainPrivateProfileInt(S_CSV, K_MAXDIMONX, 1) <> 0) + If bMaxDimOnX Then + ' Ordino la lista dei pezzi secondo la dimensione minima decrescente (va su Y) + InsPartList.Sort(Function(P, Q) + Dim dPMin As Double = Math.Min(P.m_dDimX, P.m_dDimY) + Dim dQMin As Double = Math.Min(Q.m_dDimX, Q.m_dDimY) + If Math.Abs(dPMin - dQMin) < EPS_SMALL Then + Return (P.m_nOriInd - Q.m_nOriInd) + Else + Return CInt(Math.Ceiling(dQMin - dPMin)) + End If + End Function) + Else + ' Ordino la lista dei pezzi secondo le Y decrescenti + InsPartList.Sort(Function(P, Q) + If Math.Abs(P.m_dDimY - Q.m_dDimY) < EPS_SMALL Then + Return (P.m_nOriInd - Q.m_nOriInd) + Else + Return CInt(Math.Ceiling(Q.m_dDimY - P.m_dDimY)) + End If + End Function) + End If + ' Creo o svuoto gruppo temporaneo per i pezzi + Dim nIpGrp As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, "CSV") + If nIpGrp = GDB_ID.NULL Then + nIpGrp = EgtCreateGroup(GDB_ID.ROOT) + If nIpGrp = GDB_ID.NULL Then Return False + EgtSetName(nIpGrp, "CSV") + Else + EgtEmptyGroup(nIpGrp) + End If + EgtSetLevel(nIpGrp, GDB_LV.TEMP) + EgtSetStatus(nIpGrp, GDB_ST.OFF) + ' Carico lua per creare rettangoli + Dim sLuaPath = m_sCompoDir & "\Rettangolo.lua" + If Not EgtLuaExecFile(sLuaPath) Then Return False + ' Inserisco nel gruppo un nuovo componente per ogni pezzo da inserire + For i As Integer = 1 To InsPartList.Count() + Dim CurrPart As CsvPart = InsPartList(i - 1) + ' Definizione variabili + Dim dDimX = CurrPart.m_dDimX + Dim dDimY = CurrPart.m_dDimY + If bMaxDimOnX And dDimY > dDimX Then + Dim dTemp As Double = dDimX + dDimX = dDimY + dDimY = dTemp + End If + EgtLuaSetGlobNumVar("CMP.V1", dDimX) + EgtLuaSetGlobNumVar("CMP.V2", dDimY) + EgtLuaSetGlobStringVar("CMP.INFO", CurrPart.m_sName) + ' Esecuzione componente + If Not EgtLuaExecLine("CMP_Draw(false)") Then Return False + ' Recupero Id del nuovo componente + Dim nId As Integer = EgtGetLastPart() + If nId = GDB_ID.NULL Then Return False + CurrPart.m_nId = nId + ' Muovo la regione in Z per evitare problemi in visualizzazione + Dim nRegId = EgtGetFirstNameInGroup(nId, NAME_REGION) + EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB) + ' Eventuale testo per indicare il sopra + If Not bMaxDimOnX Then + Dim dH As Double = Math.Min(0.15 * dDimY, 30) + Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC) + EgtSetColor(nText, New Color3d()) + End If + ' Aggiusto per lavorazioni + AdjustFlatPart(nId) + ' Aggiungo info su CSV di origine + EgtSetInfo(nId, INFO_CSV_PATH, m_sCsvPath) + EgtSetInfo(nId, INFO_CSV_PART, CurrPart.m_sName) + ' Lo sposto nel gruppo speciale + EgtRelocate(nId, nIpGrp) + Next + EgtLuaResetGlobVar("CMP") + EgtLuaResetGlobVar("CMP_Draw") + ' Provo ad inserire i pezzi + For i As Integer = 1 To InsPartList.Count() + Dim CurrPart As CsvPart = InsPartList(i - 1) + While CurrPart.m_nToNest > 0 + If PackOnePart(CurrPart.m_nId) Then + CurrPart.m_nToNest -= 1 + Else + Exit While + End If + End While + Next + Return True + End Function + + Private Function PackOnePart(nId As Integer) As Boolean + ' Dimensioni del pezzo + Dim ptPartMin, ptPartMax As Point3d + If Not EgtGetBBox(nId, GDB_BB.IGNORE_DIM + GDB_BB.IGNORE_TEXT, ptPartMin, ptPartMax) Then Return False + Dim dPartLen As Double = ptPartMax.x - ptPartMin.x + Dim dPartHeight As Double = ptPartMax.y - ptPartMin.y + ' Centro del grezzo + Dim nRawCenId = EgtGetFirstNameInGroup(m_nRawId, "RawCenter") + Dim ptRawCenter As Point3d + EgtStartPoint(nRawCenId, GDB_ID.ROOT, ptRawCenter) + Dim dRawCenX = ptRawCenter.x - m_ptRawMin.x + Dim dRawCenY = ptRawCenter.y - m_ptRawMin.y + ' Inserisco il pezzo nel grezzo, in centro in XY e in alto in Z + Dim ptP As New Point3d(dRawCenX - 0.5 * dPartLen, dRawCenY - 0.5 * dPartHeight, m_ptRawMax.z - m_ptRawMin.z) + ' Ne creo una copia nella radice + Dim nId2 As Integer = EgtCopyGlob(nId, GDB_ID.ROOT) + If EgtAddPartToRawPart(nId2, ptP, m_nRawId) Then + ' Aggiungo le lavorazioni standard + AddMachinings(nId2, True, False) + ' Eseguo nesting + Dim bFit As Boolean = False + If EstCalc.UpdateNestRegions() Then + Dim bAligned As Boolean = (GetMainPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0) <> 0) + EstCalc.EnableReferenceRegion(bAligned) + If Not EgtExistsInfo(m_nRawId, KEY_RAWBYPOINTS) Then + bFit = EgtPackPartInRectangle(nId2, True, True) + End If + If Not bFit Then + bFit = EgtPackPart(nId2, True, True) + End If + End If + ' Gestione risultato nesting + If bFit Then + Return True + Else + EraseMachinings(nId2) + EgtRemovePartFromRawPart(nId2) + EgtErase(nId2) + End If + End If + Return False + End Function + + Friend Sub Remove(ByRef bOther As Boolean, ByRef sOtherCsv As String) + ' Rimuovo i pezzi selezionati della lista CSV corrente e ne aggiorno i contatori + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nNextId As Integer = EgtGetNextSelectedObj() + If Not RemoveOnePart(nId) Then + bOther = True + Dim sCsvPath As String = String.Empty + If EgtGetInfo(nId, INFO_CSV_PATH, sCsvPath) Then + Dim sCsvName As String = Path.GetFileNameWithoutExtension(sCsvPath) + If sOtherCsv.IndexOf(sCsvName) = -1 Then + sOtherCsv = sOtherCsv & sCsvName & ", " + End If + End If + End If + nId = nNextId + End While + ' Aggiorno visualizzazione + EgtDraw() + End Sub + + Private Function RemoveOnePart(nId As Integer) As Boolean + ' Verifico sia nel grezzo + If EgtGetParent(nId) <> m_nRawId Then Return False + ' Recupero identificativi da Info + Dim sCsvPath As String = String.Empty + EgtGetInfo(nId, INFO_CSV_PATH, sCsvPath) + Dim sName As String = String.Empty + EgtGetInfo(nId, INFO_CSV_PART, sName) + ' Verifico che il pezzo appartenga a questo Csv + If String.Compare(sCsvPath, m_sCsvPath, True) = 0 Then + ' Cerco il pezzo nella lista dei pezzi + For i = 1 To m_CsvPartList.Count() + Dim CurrPart As CsvPart = m_CsvPartList(i - 1) + If String.Compare(sName, CurrPart.m_sName, True) = 0 Then + ' Rimuovo le lavorazioni + EraseMachinings(nId) + ' Rimuovo dal grezzo + EgtRemovePartFromRawPart(nId) + ' Cancello il pezzo + EgtErase(nId) + ' Aggiorno il contatore + CurrPart.m_nToNest += 1 + ' Esco + Return True + End If + Next + End If + ' Pezzo non appartenente al Csv corrente + Return False + End Function + + Private Function LoadCsvFile(sCsvPath As String) As Boolean + ' Pulisco path e lista dei pezzi Csv + m_sCsvPath = String.Empty + m_CsvPartList.Clear() + ' Definizione variabili + EgtLuaCreateGlobTable("CSV") + EgtLuaSetGlobStringVar("CSV.FILE", sCsvPath) + ' Esecuzione + Dim nErr As Integer = 999 + If EgtLuaExecFile(OmagOFFICEMap.refMainWindowVM.MainWindowM.sCsvAutoDir & "\CsvRead.lua") AndAlso + EgtLuaCallFunction("CSV.Read") Then + ' Verifica stato di errore + EgtLuaGetGlobIntVar("CSV.ERR", nErr) + End If + If nErr <> 0 Then + EgtOutLog("Error in CsvRead : " & nErr.ToString()) + Return False + End If + ' Assegno path + m_sCsvPath = sCsvPath + ' Preparo lista dei pezzi + Dim nNbr As Integer = 0 + EgtLuaGetGlobIntVar("CSV.NBR", nNbr) + For i As Integer = 1 To nNbr + Dim OnePart As New CsvPart + Dim sN As String = i.ToString() + EgtLuaGetGlobStringVar("CSV.NAME" & sN, OnePart.m_sName) + OnePart.m_bActive = True + EgtLuaGetGlobStringVar("CSV.MAT" & sN, OnePart.m_sMaterial) + EgtLuaGetGlobIntVar("CSV.COUNT" & sN, OnePart.m_nCount) + OnePart.m_nToNest = OnePart.m_nCount + EgtLuaGetGlobBoolVar("CSV.RECT" & sN, OnePart.m_bIsRect) + EgtLuaGetGlobNumVar("CSV.DIMX" & sN, OnePart.m_dDimX) + EgtLuaGetGlobNumVar("CSV.DIMY" & sN, OnePart.m_dDimY) + EgtLuaGetGlobNumVar("CSV.TH" & sN, OnePart.m_dTh) + OnePart.m_nOriInd = i + ' inserisco in lista + m_CsvPartList.Add(OnePart) + Next + EgtLuaResetGlobVar("CSV") + ' Ordinamento lista dei pezzi (ordine crescente su materiale e spessore) + m_CsvPartList.Sort(Function(x, y) + Dim nComp As Integer = String.Compare(x.m_sMaterial, y.m_sMaterial, True) + If nComp = 0 Then + If Math.Abs(x.m_dTh - y.m_dTh) < EPS_SMALL Then + Return (x.m_nOriInd - y.m_nOriInd) + Else + Return CInt(Math.Ceiling(x.m_dTh - y.m_dTh)) + End If + Else + Return nComp + End If + End Function) + ' Salvo come epl + SaveCsvPartList() + ' Rinomino file originale + Dim sBakPath As String = sCsvPath & ".bak" + Dim sBakName As String = Path.GetFileName(sBakPath) + ' cancello eventuale vecchio backup + If My.Computer.FileSystem.FileExists(sBakPath) Then + My.Computer.FileSystem.DeleteFile(sBakPath) + End If + ' eseguo rinomina + My.Computer.FileSystem.RenameFile(sCsvPath, sBakName) + Return True + End Function + + Friend Sub SaveCsvPartList() + ' Se non c'è nulla di attivo, non faccio alcunché + If String.IsNullOrEmpty(m_sCsvPath) Then + EgtOutLog("CSV List missing") + Return + End If + ' Path del file + Dim sFile As String = Path.ChangeExtension(m_sCsvPath, ".epl") + ' Gestione file + Try + ' Apro file + Dim Writer As New IO.StreamWriter(sFile, False) + ' Intestazione + Writer.WriteLine("[General]") + Writer.WriteLine("Path=" & m_sCsvPath) + ' Ciclo sui pezzi + For i As Integer = 1 To m_CsvPartList.Count() + Dim CurrPart As CsvPart = m_CsvPartList(i - 1) + Writer.WriteLine("[P" & i.ToString() & "]") + Writer.WriteLine("Nam=" & CurrPart.m_sName) + Writer.WriteLine("Mat=" & CurrPart.m_sMaterial) + Writer.WriteLine("Act=" & If(CurrPart.m_bActive, "1", "0")) + Writer.WriteLine("Cnt=" & CurrPart.m_nCount.ToString()) + Writer.WriteLine("Add=" & CurrPart.m_nAdd.ToString()) + Writer.WriteLine("ToN=" & CurrPart.m_nToNest.ToString()) + Writer.WriteLine("Rct=" & If(CurrPart.m_bIsRect, "1", "0")) + Writer.WriteLine("DX=" & DoubleToString(CurrPart.m_dDimX, 4)) + Writer.WriteLine("DY=" & DoubleToString(CurrPart.m_dDimY, 4)) + Writer.WriteLine("Th=" & DoubleToString(CurrPart.m_dTh, 4)) + Writer.WriteLine("OIn=" & CurrPart.m_nOriInd.ToString()) + Next + ' Terminatore + Writer.WriteLine("[END]") + ' Chiudo file + Writer.Close() + ' Registro in ini path + WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile) + ' Errore + Catch ex As Exception + EgtOutLog("CSV List error writing " & sFile) + End Try + End Sub + + Private Sub LoadCsvPartList(sFile As String) + ' Pulisco path e lista dei pezzi Csv + m_sCsvPath = String.Empty + m_CsvPartList.Clear() + ' Gestione file + Try + ' Apro file + Dim Reader As New IO.StreamReader(sFile, False) + ' Lettura intestazione + Dim sLine As String = Reader.ReadLine() + While sLine <> Nothing + If sLine = "[General]" Then + ' non devo fare alcunché + ElseIf sLine.Length() >= 5 AndAlso sLine.Substring(0, 5) = "Path=" Then + Dim sItems() As String = sLine.Split("=".ToCharArray) + If sItems.Count() >= 2 Then + m_sCsvPath = sItems(1) + End If + Else + Exit While + End If + sLine = Reader.ReadLine() + End While + ' Ciclo di lettura dei pezzi + Dim nI As Integer = 1 + Dim sPart As String = "[P" & nI.ToString() & "]" + Dim OnePart As New CsvPart + While sLine <> Nothing + ' Inizio pezzo o fine del file + If sLine = sPart Or sLine = "[END]" Then + ' se esiste pezzo precedente, lo salvo + If nI > 1 Then + ' inserisco in lista + m_CsvPartList.Add(OnePart) + End If + ' predisposizioni per prossimo pezzo + nI += 1 + sPart = "[P" & nI.ToString() & "]" + OnePart = New CsvPart + ' Dato + Else + Dim sItems() As String = sLine.Split("=".ToCharArray) + If sItems.Count() >= 2 Then + If sItems(0) = "Nam" Then + OnePart.m_sName = sItems(1) + ElseIf sItems(0) = "Mat" Then + OnePart.m_sMaterial = sItems(1) + ElseIf sItems(0) = "Act" Then + OnePart.m_bActive = If(sItems(1) = "0", False, True) + ElseIf sItems(0) = "Cnt" Then + StringToInt(sItems(1), OnePart.m_nCount) + ElseIf sItems(0) = "Add" Then + StringToInt(sItems(1), OnePart.m_nAdd) + ElseIf sItems(0) = "ToN" Then + StringToInt(sItems(1), OnePart.m_nToNest) + ElseIf sItems(0) = "Rct" Then + OnePart.m_bIsRect = If(sItems(1) = "0", False, True) + ElseIf sItems(0) = "DX" Then + StringToDouble(sItems(1), OnePart.m_dDimX) + ElseIf sItems(0) = "DY" Then + StringToDouble(sItems(1), OnePart.m_dDimY) + ElseIf sItems(0) = "Th" Then + StringToDouble(sItems(1), OnePart.m_dTh) + ElseIf sItems(0) = "OIn" Then + StringToInt(sItems(1), OnePart.m_nOriInd) + End If + End If + End If + sLine = Reader.ReadLine() + End While + ' Chiudo il file + Reader.Close() + ' Errore + Catch ex As Exception + EgtOutLog("Error reading " & sFile) + End Try + End Sub + +#End Region ' METHODS + +End Class + +Friend Class CsvPart + Public m_sName As String = String.Empty + Public m_sMaterial As String = String.Empty + Public m_bActive As Boolean = True + Public m_nCount As Integer = 0 + Public m_nAdd As Integer = 0 + Public m_nToNest As Integer = 0 + Public m_bIsRect As Boolean = True + Public m_dDimX As Double = 0 + Public m_dDimY As Double = 0 + Public m_dTh As Double = 0 + Public m_nOriInd As Integer = 0 + Public m_nId As Integer = GDB_ID.NULL +End Class diff --git a/CsvWindow/CsvWindowV.xaml b/CsvWindow/CsvWindowV.xaml index e477eb8..c4de8ae 100644 --- a/CsvWindow/CsvWindowV.xaml +++ b/CsvWindow/CsvWindowV.xaml @@ -1,11 +1,97 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb index 4448763..4304401 100644 --- a/OptionPanel/NestingTab/NestingTabVM.vb +++ b/OptionPanel/NestingTab/NestingTabVM.vb @@ -31,6 +31,26 @@ Public Class NestingTabVM Private m_vtTotMove As Vector3d Private m_dSnapDist As Double = 0 + Private m_CsvImport_IsChecked As Boolean + Private m_CsvImportWindow As CsvWindowV + Public Property CsvImport_IsChecked As Boolean + Get + Return m_CsvImport_IsChecked + End Get + Set(value As Boolean) + If value <> m_CsvImport_IsChecked Then + m_CsvImport_IsChecked = value + If m_CsvImport_IsChecked Then + m_CsvImportWindow = New CsvWindowV(Application.Current.MainWindow, New CsvWindowVM) + m_CsvImportWindow.Show() + Else + m_CsvImportWindow.Close() + End If + NotifyPropertyChanged("CsvImport_IsChecked") + End If + End Set + End Property + Private m_MaxMoveIsChecked As Boolean Public Property MaxMoveIsChecked As Boolean Get @@ -120,7 +140,6 @@ Public Class NestingTabVM ' Definizione comandi Private m_cmdDraw As ICommand Private m_cmdImportDxf As ICommand - Private m_cmdImportCsv As ICommand Private m_cmdUp As ICommand Private m_cmdLeft As ICommand Private m_cmdRight As ICommand @@ -256,29 +275,11 @@ Public Class NestingTabVM Public Sub ImportDxf(ByVal param As Object) Dim DxfImportWindow As New DxfImportWindowV(Application.Current.MainWindow, New DxfImportWindowVM) DxfImportWindow.ShowDialog() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) End Sub #End Region ' ImportDxfCommand -#Region "ImportCsvCommand" - - Public ReadOnly Property ImportCsvCommand As ICommand - Get - If m_cmdImportCsv Is Nothing Then - m_cmdImportCsv = New Command(AddressOf ImportCsv) - End If - Return m_cmdImportCsv - End Get - End Property - - Public Sub ImportCsv(ByVal param As Object) - - End Sub - -#End Region ' ImportCsvCommand - #Region "UpCommand" Public ReadOnly Property UpCommand As ICommand diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb index a37c6f2..d25b6ff 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -3,6 +3,9 @@ #Region "FIELDS & PROPERTIES" + ' Oggetto che gestisce il Csv durante tutto il programma + Private m_CsvM As CsvM + #End Region ' FIELDS & PROPERTIES #Region "CONSTRUCTOR" @@ -10,6 +13,8 @@ Sub New() ' Creo riferimento a questa classe in OmagOFFICEMap OmagOFFICEMap.SetRefProjectVM(Me) + ' Creo oggetto che gestisce Csv + m_CsvM = New CsvM End Sub #End Region ' CONSTRUCTOR diff --git a/Resources/TreeView/Folder.png b/Resources/TreeView/Folder.png new file mode 100644 index 0000000000000000000000000000000000000000..2c1339d04ed24a4dbbe8aeecdde99b279336a84f GIT binary patch literal 1292 zcmV+n1@roeP)H7$(J1j1ltl0mh9(YV}ujem zuqFUiOlCOXF?a-UBv>qtKn_C=$kEBh!a>S=0%Zab7K6v41ZpUTm;|AY>-&TkfIbna zt7?5!0BCvx;;bqhLX2RE@Hheyo)&~0hKM?yI3fa;fJZQZ4Gs-4t{MXgR=Ozzt-#`% z9;kW*Pnzoi!P5m)33!U+&YvP=N)`o-r2Z1I7y`yxB&70U9fBgZPV2q`48P0U0E0)R zZQj!+F)f{W@=tuc>mAjRYMKLegn-3hQ8o~0DNWHif18eIn5&N;W`T(6dX(LzOZ1*S z!!zyeqn$tofD}F8Fu0_QSzI7Lbp_e?JT*Ms#B5m)0B3%n_uLF$sbWRMn5+r}MNuq@ zo1P+Hnna#_gmIKAfu8j+J~T!&Jju;3uJWt3)PY>u2RuTQm0t}vHBB@INWFv(T|kb! z&M1NHl{y8dsF$XlY zPRK4NOCwBER085bO}009nL=@%{=p*CKpCj7`bG5Fn{srt#6AG6riv5AdV}lfKy4xI z5iBBgLlP-2ZiK=^WFSg2C2Z`*Bnj^4LHheHak^Ba1kA5Cjzv`wkqGDj+ThNlyGsf{ zH7mQis)n@yNEQyq`jKYMCRytPR__0r-3M^50sIXfKPV$j2v|t~0000 + + + + + + + + + + + + + + + + + diff --git a/Utility/OmagOFFICEMap.vb b/Utility/OmagOFFICEMap.vb index 040a000..8c00b8b 100644 --- a/Utility/OmagOFFICEMap.vb +++ b/Utility/OmagOFFICEMap.vb @@ -18,6 +18,7 @@ Module OmagOFFICEMap Private m_refSplitModeVM As SplitModeVM Private m_refMoveRawModeVM As MoveRawModeVM Private m_refSimulTabVM As SimulTabVM + Private m_refCsvM As CsvM #Region "Get" @@ -117,6 +118,12 @@ Module OmagOFFICEMap End Get End Property + Public ReadOnly Property refCsvM As CsvM + Get + Return m_refCsvM + End Get + End Property + #End Region ' Get #Region "Set" @@ -196,6 +203,11 @@ Module OmagOFFICEMap Return Not IsNothing(m_refSimulTabVM) End Function + Friend Function SetRefCsvM(CsvM As CsvM) As Boolean + m_refCsvM = CsvM + Return Not IsNothing(m_refCsvM) + End Function + #End Region ' Set #Region "Init" @@ -213,7 +225,7 @@ Module OmagOFFICEMap Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(m_refMachGroupPanelVM) AndAlso Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso - Not IsNothing(m_refMachiningTabVM) + Not IsNothing(m_refMachiningTabVM) AndAlso Not IsNothing(m_refCsvM) End Function #End Region ' Init