f5c89ac320
- Risolti errori in DrawPage per textbox true o false.
198 lines
9.3 KiB
VB.net
198 lines
9.3 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class ChooseMachining
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
Private m_CurrentMachine As CurrentMachine = m_MainWindow.m_CurrentMachine
|
|
' Liste che contengono gli elementi appartenenti alle ComboBox
|
|
Private m_SawingList As New List(Of String)
|
|
Private m_AuxiliaryMachiningTypeList As New List(Of String)
|
|
Private m_DrillingList As New List(Of String)
|
|
Private m_MillingList As New List(Of String)
|
|
' Numero righe della finestra, necessario per non ridimensionarla quando si cambia il tipo di utensile ausiliario
|
|
Private m_RowNumber As Integer = 6
|
|
|
|
Sub New(Owner As Window)
|
|
Me.Owner = Owner
|
|
InitializeComponent()
|
|
ShowDialog()
|
|
End Sub
|
|
|
|
Private Sub ChooseMachining_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
|
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
|
|
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
|
|
CurrSawingCmBx.ItemsSource = m_SawingList
|
|
AuxiliaryMachiningCmBx.ItemsSource = m_AuxiliaryMachiningTypeList
|
|
CurrDrillingCmBx.ItemsSource = m_DrillingList
|
|
CurrMillingCmBx.ItemsSource = m_MillingList
|
|
|
|
CurrSawingTxBl.Text = EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 1)
|
|
AuxiliaryMachiningTxBl.Text = EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 2)
|
|
CurrDrillingTxBl.Text = EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 3)
|
|
CurrMillingTxBl.Text = EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 4)
|
|
|
|
End Sub
|
|
|
|
Private Sub ChooseMachining_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
|
InitializeMachiningLists()
|
|
End Sub
|
|
|
|
Private Sub InitializeMachiningLists()
|
|
|
|
'Creo lista lavorazioni di lama
|
|
CreateMachiningList(MCH_MY.SAWING, m_CurrentMachine.sCurrSaw, m_SawingList)
|
|
|
|
' Verifico la configurazione della macchina per creare i combobox
|
|
Select Case m_CurrentMachine.MountedToolConfig
|
|
Case CurrentMachine.MountedToolConfigs.SAW
|
|
ChooseMachiningGrid.Children.Remove(AuxiliaryMachiningTxBl)
|
|
ChooseMachiningGrid.Children.Remove(AuxiliaryMachiningCmBx)
|
|
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL, CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER
|
|
' Definizione di due riga della tabella con la giusta altezza
|
|
For Index = 0 To 1
|
|
Dim Row As New RowDefinition
|
|
Row.Height = New GridLength(0.5, GridUnitType.Star)
|
|
ChooseMachiningGrid.RowDefinitions.Add(Row)
|
|
Next
|
|
AuxiliaryMachiningTxBl.SetValue(Grid.RowProperty, 2)
|
|
AuxiliaryMachiningCmBx.SetValue(Grid.RowProperty, 3)
|
|
ButtonsGrid.SetValue(Grid.RowProperty, 5)
|
|
AuxiliaryMachiningTxBl.Visibility = Windows.Visibility.Visible
|
|
AuxiliaryMachiningCmBx.Visibility = Windows.Visibility.Visible
|
|
Me.Height = 341.2
|
|
m_RowNumber += 2
|
|
End Select
|
|
CurrSawingCmBx.SelectedItem = If(Not IsNothing(m_SawingList(0)), m_SawingList(0), Nothing)
|
|
|
|
m_AuxiliaryMachiningTypeList.Add("Nessuna")
|
|
If m_CurrentMachine.bDrilling Then
|
|
m_AuxiliaryMachiningTypeList.Add("Fresatura")
|
|
If m_CurrentMachine.bMilling Then
|
|
m_AuxiliaryMachiningTypeList.Add("Foratura")
|
|
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER Or m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
|
|
m_AuxiliaryMachiningTypeList.Add("Entrambe")
|
|
End If
|
|
End If
|
|
Else
|
|
If m_CurrentMachine.bMilling Then
|
|
m_AuxiliaryMachiningTypeList.Add("Foratura")
|
|
End If
|
|
End If
|
|
AuxiliaryMachiningCmBx.SelectedItem = "Nessuna"
|
|
|
|
End Sub
|
|
|
|
Private Sub CreateMachiningList(MachiningType As Integer, CurrTool As String, MachiningList As List(Of String))
|
|
'Cerco tutte le lavorazioni che utilizzano l'utensile corrente le aggiungo alla lista
|
|
Dim MachiningTool As String = String.Empty
|
|
Dim MachiningName As String = String.Empty
|
|
If EgtMdbGetFirstMachining(MachiningType, MachiningName) Then
|
|
EgtMdbSetCurrMachining(MachiningName)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningTool)
|
|
If MachiningTool = CurrTool Then
|
|
MachiningList.Add(MachiningName)
|
|
End If
|
|
While EgtMdbGetNextMachining(MachiningType, MachiningName)
|
|
EgtMdbSetCurrMachining(MachiningName)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningTool)
|
|
If MachiningTool = CurrTool Then
|
|
MachiningList.Add(MachiningName)
|
|
End If
|
|
End While
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub AuxiliaryMachiningCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles AuxiliaryMachiningCmBx.SelectionChanged
|
|
Select Case AuxiliaryMachiningCmBx.SelectedItem
|
|
Case "Nessuna"
|
|
If m_RowNumber > 8 Then
|
|
For Index = m_RowNumber - 1 To 8 Step -1
|
|
ChooseMachiningGrid.RowDefinitions.RemoveAt(Index)
|
|
Next
|
|
m_RowNumber = 8
|
|
End If
|
|
ButtonsGrid.SetValue(Grid.RowProperty, 5)
|
|
CurrDrillingTxBl.Visibility = Windows.Visibility.Hidden
|
|
CurrDrillingCmBx.Visibility = Windows.Visibility.Hidden
|
|
CurrMillingTxBl.Visibility = Windows.Visibility.Hidden
|
|
CurrMillingCmBx.Visibility = Windows.Visibility.Hidden
|
|
Me.Height = 341.2
|
|
Case "Foratura"
|
|
' Definizione di due riga della tabella con la giusta altezza
|
|
If m_RowNumber < 10 Then
|
|
For Index = 1 To 10 - m_RowNumber
|
|
Dim Row As New RowDefinition
|
|
Row.Height = New GridLength(0.5, GridUnitType.Star)
|
|
ChooseMachiningGrid.RowDefinitions.Add(Row)
|
|
Next
|
|
m_RowNumber = 10
|
|
End If
|
|
CurrDrillingTxBl.SetValue(Grid.RowProperty, 4)
|
|
CurrDrillingCmBx.SetValue(Grid.RowProperty, 5)
|
|
ButtonsGrid.SetValue(Grid.RowProperty, 7)
|
|
CreateMachiningList(MCH_MY.DRILLING, m_CurrentMachine.sCurrDrill, m_DrillingList)
|
|
CurrDrillingTxBl.Visibility = Windows.Visibility.Visible
|
|
CurrDrillingCmBx.Visibility = Windows.Visibility.Visible
|
|
CurrMillingTxBl.Visibility = Windows.Visibility.Hidden
|
|
CurrMillingCmBx.Visibility = Windows.Visibility.Hidden
|
|
Me.Height = 426.5
|
|
Case "Fresatura"
|
|
' Definizione di due riga della tabella con la giusta altezza
|
|
If m_RowNumber < 10 Then
|
|
For Index = 1 To 10 - m_RowNumber
|
|
Dim Row As New RowDefinition
|
|
Row.Height = New GridLength(0.5, GridUnitType.Star)
|
|
ChooseMachiningGrid.RowDefinitions.Add(Row)
|
|
Next
|
|
m_RowNumber = 10
|
|
End If
|
|
CurrMillingTxBl.SetValue(Grid.RowProperty, 4)
|
|
CurrMillingCmBx.SetValue(Grid.RowProperty, 5)
|
|
ButtonsGrid.SetValue(Grid.RowProperty, 7)
|
|
CreateMachiningList(MCH_MY.MILLING, m_CurrentMachine.sCurrMill, m_MillingList)
|
|
CurrDrillingTxBl.Visibility = Windows.Visibility.Hidden
|
|
CurrDrillingCmBx.Visibility = Windows.Visibility.Hidden
|
|
CurrMillingTxBl.Visibility = Windows.Visibility.Visible
|
|
CurrMillingCmBx.Visibility = Windows.Visibility.Visible
|
|
Me.Height = 426.5
|
|
Case "Entrambe"
|
|
' Definizione di quattro riga della tabella con la giusta altezza
|
|
If m_RowNumber < 12 Then
|
|
For Index = 1 To 12 - m_RowNumber
|
|
Dim Row As New RowDefinition
|
|
Row.Height = New GridLength(0.5, GridUnitType.Star)
|
|
ChooseMachiningGrid.RowDefinitions.Add(Row)
|
|
Next
|
|
m_RowNumber = 12
|
|
End If
|
|
CurrDrillingTxBl.SetValue(Grid.RowProperty, 4)
|
|
CurrDrillingCmBx.SetValue(Grid.RowProperty, 5)
|
|
CurrMillingTxBl.SetValue(Grid.RowProperty, 6)
|
|
CurrMillingCmBx.SetValue(Grid.RowProperty, 7)
|
|
ButtonsGrid.SetValue(Grid.RowProperty, 9)
|
|
CreateMachiningList(MCH_MY.DRILLING, m_CurrentMachine.sCurrDrill, m_DrillingList)
|
|
CreateMachiningList(MCH_MY.MILLING, m_CurrentMachine.sCurrMill, m_MillingList)
|
|
CurrDrillingTxBl.Visibility = Windows.Visibility.Visible
|
|
CurrDrillingCmBx.Visibility = Windows.Visibility.Visible
|
|
CurrMillingTxBl.Visibility = Windows.Visibility.Visible
|
|
CurrMillingCmBx.Visibility = Windows.Visibility.Visible
|
|
Me.Height = 511.8
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub CurrSawingCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawingCmBx.SelectionChanged
|
|
m_MainWindow.m_CurrentMachine.sCurrSawing = CurrSawingCmBx.SelectedItem
|
|
End Sub
|
|
|
|
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
|
DialogResult = True
|
|
End Sub
|
|
|
|
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
|
DialogResult = False
|
|
End Sub
|
|
|
|
End Class
|