Imports System.ComponentModel Imports EgtUILib Public Class RawPartOptionVM Inherits ViewModelBase Private m_MoveWithFixture As Boolean = False Public Property MoveWithFixture As Boolean Get Return m_MoveWithFixture End Get Set(value As Boolean) If value <> m_MoveWithFixture Then If value Then ' Abilito la selezione di RawPart con autoselezione delle sue ventose Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE ' Seleziono le ventose associate ad uno dei grezzi selezionati ' ciclo sui grezzi selezionati Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj() While nSelRawPartId <> GDB_ID.NULL ' seleziono i sottopezzi del grezzo DispositionUtility.SelectRawPartFixture(nSelRawPartId) nSelRawPartId = EgtGetNextSelectedObj() End While Else ' Abilito la selezione di RawPart Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART ' ciclo sui grezzi selezionati Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj() While nSelRawPartId <> GDB_ID.NULL ' deseleziono i sottopezzi del grezzo DispositionUtility.DeselectRawPartFixture(nSelRawPartId) nSelRawPartId = EgtGetNextSelectedObj() End While End If EgtDraw() m_MoveWithFixture = value OnPropertyChanged("MoveWithFixture") End If End Set End Property friend Sub SetMoveWithFixture(value As Boolean) m_MoveWithFixture=value OnPropertyChanged(NameOf(MoveWithFixture)) End Sub Private m_bRawPartParamVisibility As Visibility Public ReadOnly Property RawPartParamVisibility As Visibility Get Return m_bRawPartParamVisibility End Get End Property #Region "Messages" Public ReadOnly Property NewMsg As String Get Return EgtMsg(MSG_DISPOSITION + 3) End Get End Property Public ReadOnly Property RemoveMsg As String Get Return EgtMsg(MSG_DISPOSITION + 4) End Get End Property Public ReadOnly Property LenghtMsg As String Get Return EgtMsg(MSG_DISPOSITION + 5) End Get End Property Public ReadOnly Property WidthMsg As String Get Return EgtMsg(MSG_DISPOSITION + 6) End Get End Property Public ReadOnly Property HeightMsg As String Get Return EgtMsg(MSG_DISPOSITION + 7) End Get End Property Public ReadOnly Property PositionMsg As String Get Return EgtMsg(MSG_DISPOSITION + 8) End Get End Property #End Region ' Messages ' Definizione comandi Private m_cmdNewRawPart As ICommand Private m_cmdRemoveRawPart As ICommand Sub New() Map.SetRefRawPartOptionVM(Me) If EgtGetFirstSelectedObj() <> GDB_ID.NULL Then m_bRawPartParamVisibility = Visibility.Visible Else m_bRawPartParamVisibility = Visibility.Collapsed End If End Sub #Region "COMMANDS" #Region "NewRawPartCommand" ''' ''' Returns a command that do Done. ''' Public ReadOnly Property NewRawPartCommand As ICommand Get If m_cmdNewRawPart Is Nothing Then m_cmdNewRawPart = New RelayCommand(AddressOf NewRawPart) End If Return m_cmdNewRawPart End Get End Property ''' ''' Execute NewRawPart. This method is invoked by the DoneCommand. ''' Public Sub NewRawPart() DispositionUtility.ShowParts() m_bRawPartParamVisibility = Visibility.Visible OnPropertyChanged("RawPartParamVisibility") End Sub #End Region ' NewRawPartCommand #Region "RemoveRawPartCommand" ''' ''' Returns a command that do Done. ''' Public ReadOnly Property RemoveRawPartCommand As ICommand Get If m_cmdRemoveRawPart Is Nothing Then m_cmdRemoveRawPart = New RelayCommand(AddressOf RemoveRawPart) End If Return m_cmdRemoveRawPart End Get End Property ''' ''' Execute RemoveRawPart. This method is invoked by the DoneCommand. ''' Public Sub RemoveRawPart() ' ciclo sui grezzi selezionati Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj() While nSelRawPartId <> GDB_ID.NULL ' rimuovo il grezzo dalla disposizione EgtRemoveRawPart(nSelRawPartId) nSelRawPartId = EgtGetNextSelectedObj() End While EgtDraw() End Sub #End Region ' RemoveRawPartCommand #End Region ' Commands End Class