Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Windows.Input
Imports System.Windows.Media
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5

Public MustInherit Class MyMachGroupVM
   Inherits Core.MyMachGroupVM


   ' definizione comandi
   Private m_cmdDeleteMachGroup As ICommand

#Region "CONSTRUCTORS"

   Sub New(MyMachGroupM As MyMachGroupM)
      MyBase.New(MyMachGroupM)
   End Sub

#End Region    ' CONSTRUCTORS

#Region "METHODS"

#End Region    ' METHODS

#Region "COMMANDS"

#Region "DeleteMachGroup"

   ' Returns a command that manage the MainWindow_Unloaded command
   Public ReadOnly Property DeleteMachGroup_Command As ICommand
      Get
         If m_cmdDeleteMachGroup Is Nothing Then
            m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
         End If
         Return m_cmdDeleteMachGroup
      End Get
   End Property

   Public Overridable Sub DeleteMachGroup()
      ' elimino tutte le copie
      Dim nRawPartId As Integer = EgtGetFirstRawPart()
      Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
      While nRawPartId <> GDB_ID.NULL
         EgtRemovePartFromRawPart(nBeamId)
         EgtErase(nBeamId)
         nRawPartId = EgtGetNextRawPart(nRawPartId)
         nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
      End While
      ' elimino MachGroup
      EgtRemoveMachGroup(Me.Id)
   End Sub

#End Region ' DeleteMachGroup

#End Region    ' COMMANDS

End Class
