Files
omagoffice/CsvWindow/CsvWindowV.xaml.vb
Emmanuele Sassi 5b5ed98214 OmagOFFICE :
- gestione numero ripetizioni in import DXF.
- gestione aggiunta/sottrazione pezzi in CSV.
2018-09-24 08:07:24 +00:00

60 lines
2.2 KiB
VB.net

Imports EgtWPFLib5
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
#Region "EVENTS"
' Evento di click di un Item dell'albero
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)
m_CsvWindowVM.PartItemClick(CsvPartItem)
e.Handled = True
End If
End Sub
' Evento di click di un Type(categoria) dell'albero
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
CsvM.CsvPartList(Item.nType - 1).m_bActive = Item.bIsActive
Next
End If
End Sub
Private Sub CsvWindowV_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_GENERAL, K_CSVWINPLACE, Me)
End Sub
Private Sub CsvWindowV_Unloaded(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
' Salvo posizione finestra
WinPosFromWindowToIni(Me, S_GENERAL, K_CSVWINPLACE)
End Sub
#End Region ' EVENTS
End Class