OmagOFFICE :

- Aggiunta importazione Csv.
This commit is contained in:
Emmanuele Sassi
2017-05-08 08:36:16 +00:00
parent 90db656549
commit 8f61ba413d
14 changed files with 1179 additions and 38 deletions
+1
View File
@@ -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
+501
View File
@@ -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
+97 -11
View File
@@ -1,11 +1,97 @@
<UserControl x:Class="CsvWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>
<EgtWPFLib5:EgtCustomWindow x:Class="CsvWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagOFFICE="clr-namespace:OmagOFFICE"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding TitleMsg}"
IsMinimizable="False"
IsClosable="False"
ShowInTaskbar="False"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStartupLocation="CenterOwner"
Width="270" ResizeMode="NoResize" SizeToContent="Height">
<StackPanel Margin="5,5,5,0">
<TextBlock Text="{Binding CsvPath}"
Margin="0,0,0,5"/>
<TreeView ItemsSource="{Binding CsvTypeList}" Height="300"
Margin="0,0,0,5" >
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<EventSetter Event="MouseUp" Handler="PartTypeClick"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type OmagOFFICE:CsvPartType}"
ItemsSource="{Binding CsvPartList}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="{Binding PictureString}" Height="32" Width="32" Margin="0,8,6,4" />
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="15" Margin="10" />
</Grid>
<HierarchicalDataTemplate.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<EventSetter Event="MouseUp" Handler="PartItemClick"/>
<Style.Triggers>
<DataTrigger Binding="{Binding bIsActive}" Value="False">
<Setter Property="Foreground" Value="{StaticResource Omag_VeryLightGray}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</HierarchicalDataTemplate.ItemContainerStyle>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type OmagOFFICE:CsvPartItem}">
<Grid Width="246" Margin="0,5,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Name}" Height="18" FontSize="14" HorizontalAlignment="Right"/>
<TextBlock Grid.Column="1" Text="{Binding sText1}" Height="18" FontSize="14" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="{Binding sText2}" Height="18" FontSize="14" HorizontalAlignment="Left"/>
</Grid>
</DataTemplate>
</TreeView.Resources>
</TreeView>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<Button Content="{Binding NewMsg}"
Command="{Binding NewCommand}"
Style="{StaticResource CompoWindow_Button}"/>
<Button Content="{Binding OpenMsg}"
Command="{Binding OpenCommand}"
Style="{StaticResource CompoWindow_Button}"/>
</UniformGrid>
<UniformGrid Columns="2"
Margin="0,0,0,5">
<Button Content="{Binding InsertMsg}"
Command="{Binding InsertCommand}"
Style="{StaticResource CompoWindow_Button}"/>
<Button Content="{Binding RemoveMsg}"
Command="{Binding RemoveCommand}"
Style="{StaticResource CompoWindow_Button}"/>
</UniformGrid>
</StackPanel>
</EgtWPFLib5:EgtCustomWindow>
+39
View File
@@ -1,3 +1,42 @@
Public Class CsvWindowV
Private WithEvents m_CsvWindowVM As CsvWindowVM
Sub New(Owner As Window, CsvWindowVM As CsvWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = CsvWindowVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_CsvWindowVM = CsvWindowVM
End Sub
Public Sub PartItemClick(sender As Object, e As MouseButtonEventArgs)
Dim TreeViewItem As TreeViewItem = DirectCast(sender, TreeViewItem)
If TypeOf TreeViewItem.DataContext Is CsvPartItem Then
Dim CsvPartItem As CsvPartItem = DirectCast(TreeViewItem.DataContext, CsvPartItem)
OmagOFFICEMap.refCsvM.CsvPartList(CsvPartItem.nType - 1).m_bActive = CsvPartItem.bIsActive
CsvPartItem.bIsActive = Not CsvPartItem.bIsActive
e.Handled = True
End If
End Sub
Public Sub PartTypeClick(sender As Object, e As MouseButtonEventArgs)
Dim TreeViewItem As TreeViewItem = DirectCast(sender, TreeViewItem)
If TypeOf TreeViewItem.DataContext Is CsvPartType Then
Dim CsvPartType As CsvPartType = DirectCast(TreeViewItem.DataContext, CsvPartType)
' Determino quanti attivi per decidere cosa fare
Dim nItemOn As Integer = 0
For Each Item As CsvPartItem In CsvPartType.CsvPartList
If Item.bIsActive Then nItemOn += 1
Next
Dim bActivate As Boolean = (nItemOn <= CsvPartType.CsvPartList.Count() - nItemOn)
' Aggiorno stato
For Each Item As CsvPartItem In CsvPartType.CsvPartList
Item.bIsActive = bActivate
OmagOFFICEMap.refCsvM.CsvPartList(Item.nType - 1).m_bActive = Item.bIsActive
Next
End If
End Sub
End Class
+376 -1
View File
@@ -1,3 +1,378 @@
Public Class CsvWindowVM
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class CsvWindowVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Riferimento alla classe CsvM
Private m_refCsvM As CsvM
Private m_CsvPath As String
Public Property CsvPath As String
Get
Return m_CsvPath
End Get
Set(value As String)
m_CsvPath = value
NotifyPropertyChanged("CsvPath")
End Set
End Property
Private m_CsvTypeList As New ObservableCollection(Of CsvPartType)
Public Property CsvTypeList As ObservableCollection(Of CsvPartType)
Get
Return m_CsvTypeList
End Get
Set(value As ObservableCollection(Of CsvPartType))
m_CsvTypeList = value
End Set
End Property
#Region "Messages"
Public ReadOnly Property TitleMsg As String
Get
Return EgtMsg(MSG_CADCUTPAGEUC + 8)
End Get
End Property
Public ReadOnly Property NewMsg As String
Get
Return EgtMsg(MSG_CSVPAGEUC + 3)
End Get
End Property
Public ReadOnly Property OpenMsg As String
Get
Return EgtMsg(MSG_CSVPAGEUC + 1)
End Get
End Property
Public ReadOnly Property InsertMsg As String
Get
Return EgtMsg(MSG_CSVPAGEUC + 2)
End Get
End Property
Public ReadOnly Property RemoveMsg As String
Get
Return EgtMsg(MSG_CSVPAGEUC + 4)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdNew As ICommand
Private m_cmdOpen As ICommand
Private m_cmdInsert As ICommand
Private m_cmdRemove As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' recupero riferimento alla classe CsvM
m_refCsvM = OmagOFFICEMap.refCsvM
' Visualizzazione lista
ShowTreeView()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub ShowTreeView()
' Path del file Csv
Dim TempPath As New Text.StringBuilder(260)
PathCompactPathEx(TempPath, OmagOFFICEMap.refCsvM.CsvPath, 28, 0)
CsvPath = TempPath.ToString()
' Pezzi del file Csv
m_CsvTypeList.Clear()
Dim sCurrMat As String = String.Empty
Dim dCurrTh As Double = 0
Dim nCatToNest As Integer = 0
Dim nCatCount As Integer = 0
Dim PartCathegory As New CsvPartType("", 0)
For i As Integer = 1 To OmagOFFICEMap.refCsvM.CsvPartList.Count()
' Dati pezzo corrente
Dim CurrPart As CsvPart = OmagOFFICEMap.refCsvM.CsvPartList(i - 1)
' Gestione categoria
If i = 1 Then
sCurrMat = CurrPart.m_sMaterial
dCurrTh = CurrPart.m_dTh
ElseIf String.Compare(sCurrMat, CurrPart.m_sMaterial, True) <> 0 Or
Math.Abs(dCurrTh - CurrPart.m_dTh) > 10 * EPS_SMALL Then
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
" - " & LenToString(dCurrTh, 2) &
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
PartCathegory.IsExpanded = True
CsvTypeList.Add(PartCathegory)
sCurrMat = CurrPart.m_sMaterial
dCurrTh = CurrPart.m_dTh
PartCathegory = New CsvPartType("", 0)
nCatToNest = 0
nCatCount = 0
End If
' Gestione pezzo
nCatToNest += CurrPart.m_nToNest
nCatCount += CurrPart.m_nCount
Dim sCount As String = CurrPart.m_nToNest.ToString() & "/" & CurrPart.m_nCount.ToString()
Dim sDim As String = LenToString(CurrPart.m_dDimX, 1) & "x" & LenToString(CurrPart.m_dDimY, 1)
PartCathegory.CsvPartList.Add(New CsvPartItem(CurrPart.m_sName, i, sCount, sDim, CurrPart.m_bActive))
Next
' Inserisco ultima categoria
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
" - " & LenToString(dCurrTh, 2) &
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
PartCathegory.IsExpanded = True
CsvTypeList.Add(PartCathegory)
NotifyPropertyChanged("CsvTypeList")
End Sub
Private Sub UpdateTreeView()
For Each CatItem As CsvPartType In m_CsvTypeList
For Each PrtItem As CsvPartItem In CatItem.CsvPartList
Dim PartData As CsvPart = OmagOFFICEMap.refCsvM.CsvPartList(PrtItem.nType - 1)
Dim sCount As String = PartData.m_nToNest.ToString() & "/" & PartData.m_nCount.ToString()
PrtItem.sText1 = sCount
Next
Next
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "NewCommand"
Public ReadOnly Property NewCommand As ICommand
Get
If m_cmdNew Is Nothing Then
m_cmdNew = New Command(AddressOf NewCmd)
End If
Return m_cmdNew
End Get
End Property
Public Sub NewCmd(ByVal param As Object)
OmagOFFICEMap.refCsvM.NewCmd()
' Visualizzazione lista
ShowTreeView()
End Sub
#End Region ' NewCommand
#Region "OpenCommand"
Public ReadOnly Property OpenCommand As ICommand
Get
If m_cmdOpen Is Nothing Then
m_cmdOpen = New Command(AddressOf Open)
End If
Return m_cmdOpen
End Get
End Property
Public Sub Open(ByVal param As Object)
OmagOFFICEMap.refCsvM.Open()
' Visualizzazione lista
ShowTreeView()
End Sub
#End Region ' OpenCommand
#Region "InsertCommand"
Public ReadOnly Property InsertCommand As ICommand
Get
If m_cmdInsert Is Nothing Then
m_cmdInsert = New Command(AddressOf Insert)
End If
Return m_cmdInsert
End Get
End Property
Public Sub Insert(ByVal param As Object)
OmagOFFICEMap.refCsvM.Insert()
' Aggiorno TreeView
UpdateTreeView()
End Sub
#End Region ' InsertCommand
#Region "RemoveCommand"
Public ReadOnly Property RemoveCommand As ICommand
Get
If m_cmdRemove Is Nothing Then
m_cmdRemove = New Command(AddressOf Remove)
End If
Return m_cmdRemove
End Get
End Property
Public Sub Remove(ByVal param As Object)
' Elenco eventuali altre liste Csv riferite dai pezzi
Dim bOther As Boolean = False
Dim sOtherCsv As String = String.Empty
OmagOFFICEMap.refCsvM.Remove(bOther, sOtherCsv)
' Aggiorno TreeView
UpdateTreeView()
' Eventuale messaggi di pezzi liberi o da altre liste
If bOther Then
' Pezzi non rimossi perché liberi
Dim sOut As String = EgtMsg(MSG_EGTMSGBOX + 13)
If Not String.IsNullOrWhiteSpace(sOtherCsv) Then
' o di altre liste Csv
sOut &= EgtMsg(MSG_EGTMSGBOX + 14) & " (" & sOtherCsv.TrimEnd(", ".ToCharArray()) & ")"
End If
MessageBox.Show("", sOut, MessageBoxButton.OK)
End If
End Sub
#End Region ' RemoveCommand
#End Region ' COMMANDS
End Class
Public Class CsvPartItem
Inherits VMBase
Private m_nType As Integer
Public ReadOnly Property nType As Integer
Get
Return m_nType
End Get
End Property
Private m_sName As String
Public Property Name As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged("Name")
End Set
End Property
Private m_sText1 As String
Public Property sText1 As String
Get
Return m_sText1
End Get
Set(value As String)
m_sText1 = value
NotifyPropertyChanged("sText1")
End Set
End Property
Private m_sText2 As String
Public Property sText2 As String
Get
Return m_sText2
End Get
Set(value As String)
m_sText2 = value
NotifyPropertyChanged("sText2")
End Set
End Property
Private m_bIsActive As Boolean
Public Property bIsActive As Boolean
Get
Return m_bIsActive
End Get
Set(value As Boolean)
If value <> m_bIsActive Then
m_bIsActive = value
NotifyPropertyChanged("bIsActive")
End If
End Set
End Property
#Region "CONSTRUCTORS"
Sub New(Title As String, nType As Integer, sText1 As String, sText2 As String)
m_nType = nType
m_sName = Title
m_sText1 = sText1
m_sText2 = sText2
m_bIsActive = True
End Sub
Sub New(Title As String, nType As Integer, sText1 As String, sText2 As String, bIsActive As Boolean)
m_nType = nType
m_sName = Title
m_sText1 = sText1
m_sText2 = sText2
m_bIsActive = bIsActive
End Sub
#End Region ' CONSTRUCTORS
End Class
Public Class CsvPartType
Inherits VMBase
Private m_nFType As Integer
Public ReadOnly Property nFType As Integer
Get
Return m_nFType
End Get
End Property
Private m_sName As String
Public Property Name As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged("Name")
End Set
End Property
Private m_isExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_isExpanded
End Get
Set(value As Boolean)
If (value <> m_isExpanded) Then
m_isExpanded = value
NotifyPropertyChanged("IsExpanded")
End If
End Set
End Property
Public ReadOnly Property PictureString As String
Get
Return "/Resources/TreeView/Folder.png"
End Get
End Property
Private m_CsvPartList As ObservableCollection(Of CsvPartItem)
Public Property CsvPartList As ObservableCollection(Of CsvPartItem)
Get
Return m_CsvPartList
End Get
Set(value As ObservableCollection(Of CsvPartItem))
m_CsvPartList = value
End Set
End Property
Sub New(sName As String, nType As Integer)
m_nFType = nType
m_sName = sName
m_CsvPartList = New ObservableCollection(Of CsvPartItem)
End Sub
End Class
+5
View File
@@ -40,6 +40,11 @@ Public Class MainWindowM
Private m_sResourcesRoot As String
Private m_sTablesRoot As String
Private m_sLogFile As String
Friend ReadOnly Property sCsvAutoDir As String
Get
Return m_sDataRoot & "\" & CSVAUTO_DIR
End Get
End Property
#End Region ' FIELDS
+2 -2
View File
@@ -69,5 +69,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.8.4.4")>
<Assembly: AssemblyFileVersion("1.8.4.4")>
<Assembly: AssemblyVersion("1.8.5.1")>
<Assembly: AssemblyFileVersion("1.8.5.1")>
+4
View File
@@ -154,6 +154,7 @@
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\ConstMsg.vb" />
<Compile Include="CsvWindow\CsvM.vb" />
<Compile Include="CsvWindow\CsvWindowV.xaml.vb">
<DependentUpon>CsvWindowV.xaml</DependentUpon>
</Compile>
@@ -503,6 +504,9 @@
<ItemGroup>
<Resource Include="Resources\SimulTab\MachMode.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\TreeView\Folder.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagOFFICE\OmagOFFICER32.exe
+4 -4
View File
@@ -24,11 +24,11 @@
Command="{Binding ImportDxfCommand}">
<Image Source="/Resources/NestingTab/ImportDxf.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="4" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding ImportCsvCommand}">
<ToggleButton Grid.Column="4" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingToggleButton}"
IsChecked="{Binding CsvImport_IsChecked}">
<Image Source="/Resources/NestingTab/ImportCsv.png" Stretch="Uniform"/>
</Button>
</ToggleButton>
</Grid>
+20 -19
View File
@@ -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
+5
View File
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+112
View File
@@ -305,4 +305,116 @@
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- CsvTreeViewItem DA CAMBIARE!! -->
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Fill" Color="#FF595959"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Stroke" Color="#FF262626"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Stroke" Color="#FF1BBBFA"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Fill" Color="Transparent"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Stroke" Color="#FF262626"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Fill" Color="#FF595959"/>
<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Fill" Color="Transparent"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Stroke" Color="#FF989898"/>
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
<Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="{StaticResource TreeViewItem.TreeArrow.Static.Fill}" Stroke="{StaticResource TreeViewItem.TreeArrow.Static.Stroke}">
<Path.RenderTransform>
<RotateTransform Angle="135" CenterY="3" CenterX="3"/>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="RenderTransform" TargetName="ExpandPath">
<Setter.Value>
<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
</Setter.Value>
</Setter>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsChecked" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CsvPartItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="ExpanderBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
</Border>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1"/>
<Setter Property="Background" TargetName="ExpanderBorder" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="ExpanderBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="BorderThickness" TargetName="ExpanderBorder" Value="1,1,0,1"/>
<!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>-->
</Trigger>
<!--<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</MultiTrigger>-->
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary>
+13 -1
View File
@@ -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