146 lines
5.3 KiB
VB.net
146 lines
5.3 KiB
VB.net
Imports EgtUILib
|
|
Public Class ControlsDirectCutUC1
|
|
|
|
' Dichiarazione delle Page UserControl
|
|
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
|
Friend m_Polishing As Polishing
|
|
Friend m_CopyTemplate As CopyTemplateUC
|
|
Friend m_SawTest As SawTestUC
|
|
|
|
' Stato di visualizzazione della macchina
|
|
Friend m_bShowMachine As Boolean = False
|
|
Friend m_nMachLook As Integer = MCH_LOOK.ALL
|
|
' Dati generali CN
|
|
Friend m_CN As CN_generico
|
|
Private m_bFirst As Boolean = True
|
|
' Riferimento alla pagina correntemente attiva
|
|
Friend m_ActiveDirectCutPage As DirectCutPages = DirectCutPages.DirectCut
|
|
' Variabili che indicano attivazione paginette con bottoni macchina
|
|
Private m_ControlsBtn_IsActive As Boolean
|
|
|
|
Public Shared m_dZSafe As Double = 52
|
|
|
|
' Variabile che indica se sono attivi i bottoni macchina nuovi o vecchi
|
|
Friend m_NewMachineButtonsType As Boolean
|
|
' Indica che la finestra del talio Singolo deve essere di tipo manuale
|
|
Friend m_bManulaCut As Boolean = False
|
|
|
|
Enum DirectCutPages
|
|
DirectCut
|
|
DirectCut1
|
|
Polishing
|
|
CopyTemplate
|
|
SawTest
|
|
End Enum
|
|
|
|
Private Sub ControlsDirectCutUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
|
' leggo la configurazione del programma per i nuovi tagli manuali
|
|
m_bManulaCut = GetPrivateProfileInt(S_GENERAL, K_MANUAL_CUT, 0, m_MainWindow.GetIniFile()) <> 0
|
|
|
|
'Creazione delle Page UserControl
|
|
m_SawTest = New SawTestUC
|
|
m_Polishing = New Polishing
|
|
m_CopyTemplate = New CopyTemplateUC
|
|
|
|
'Posizionemento nella griglia delle Page UserControl
|
|
m_SawTest.SetValue(Grid.RowProperty, 1)
|
|
m_Polishing.SetValue(Grid.RowProperty, 1)
|
|
m_CopyTemplate.SetValue(Grid.RowProperty, 1)
|
|
|
|
' assegno i nomi ai pulsanti
|
|
SawTestTxt.Text = EgtMsg(90207)
|
|
PolishingTxt.Text = EgtMsg(90231)
|
|
'CopyTemplateBtn.Content = EgtMsg(90209)
|
|
CopyTemplateTxt.Text = EgtMsg(90209)
|
|
'SquaringTxt.Text = "Squaring"
|
|
|
|
End Sub
|
|
|
|
Private Sub ControlsDirectCutUC1_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
|
' Se rientro da simulazione
|
|
If m_ActiveDirectCutPage = DirectCutPages.SawTest Then
|
|
LeftButtonGrid.Children.Add(m_SawTest)
|
|
Return
|
|
ElseIf m_ActiveDirectCutPage = DirectCutPages.CopyTemplate Then
|
|
Me.LeftButtonGrid.Children.Add(m_CopyTemplate)
|
|
Return
|
|
ElseIf m_ActiveDirectCutPage = DirectCutPages.Polishing Then
|
|
Me.LeftButtonGrid.Children.Add(m_Polishing)
|
|
Return
|
|
End If
|
|
|
|
' Caso standard
|
|
m_ActiveDirectCutPage = DirectCutPages.DirectCut1
|
|
|
|
' Attivo le lavorazioni solo se esiste il grezzo e se presente testa H1
|
|
Dim bRawOk As Boolean = (GetRawHeight() > EPS_SMALL)
|
|
Dim bH1Exists As Boolean = (EgtGetHeadId("H1") <> GDB_ID.NULL)
|
|
|
|
PolishingBtn.IsEnabled = (bRawOk And m_MainWindow.m_CurrentMachine.bPolishing)
|
|
SawTestBtn.IsEnabled = (bRawOk And bH1Exists)
|
|
CopyTemplateBtn.IsEnabled = bH1Exists
|
|
|
|
' aggiorno la visualizzazione dei parametri
|
|
ReloadParam()
|
|
|
|
' Nascondo i pezzi in parcheggio
|
|
HideParkedParts()
|
|
EgtZoom(ZM.ALL)
|
|
|
|
End Sub
|
|
|
|
' ricarica i dati utensili
|
|
Public Sub ReloadParam()
|
|
Dim sCurrSawing As String = m_MainWindow.m_CurrentMachine.sCurrSawing
|
|
Dim sCurrSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
|
|
Dim bSaw As Boolean = False
|
|
|
|
' se esiste una lavorazione di lama corrente vuol dire che deve essere preferita
|
|
If Not String.IsNullOrEmpty(sCurrSaw) And Not String.IsNullOrEmpty(sCurrSawing) Then
|
|
bSaw = EgtSetCalcTool(sCurrSaw, "H1", 1)
|
|
End If
|
|
If Not bSaw Then
|
|
EgtOutLog(" WARNING! Impossible to get point from SAW, there isn't SAW or SAWING! It's available only by DRAW")
|
|
End If
|
|
'm_SingleCut.SetEnableParam(bSaw)
|
|
'm_MultipleCut.SetEnableParam(bSaw)
|
|
'm_GridCut.SetEnableParam(bSaw)
|
|
End Sub
|
|
|
|
#Region "COMMAND CLICK BTN"
|
|
Private Sub SawTestBtn_Click(sender As Object, e As RoutedEventArgs) Handles SawTestBtn.Click
|
|
LeftButtonGrid.Children.Add(m_SawTest)
|
|
m_ActiveDirectCutPage = DirectCutPages.SawTest
|
|
End Sub
|
|
|
|
Private Sub PolishingBtn_Click(sender As Object, e As RoutedEventArgs) Handles PolishingBtn.Click
|
|
LeftButtonGrid.Children.Add(m_Polishing)
|
|
m_ActiveDirectCutPage = DirectCutPages.Polishing
|
|
End Sub
|
|
|
|
Private Sub CopyTemplateBtn_Click(sender As Object, e As RoutedEventArgs) Handles CopyTemplateBtn.Click
|
|
LeftButtonGrid.Children.Add(m_CopyTemplate)
|
|
m_ActiveDirectCutPage = DirectCutPages.CopyTemplate
|
|
End Sub
|
|
|
|
Private Sub ChangeUC1Btn_Click(sender As Object, e As RoutedEventArgs) Handles ChangeUC1Btn.Click
|
|
DirectCutPage_Unloaded(Nothing, Nothing)
|
|
m_ActiveDirectCutPage = DirectCutPages.DirectCut1
|
|
m_MainWindow.m_DirectCutPageUC.LoadDirectCutUC()
|
|
End Sub
|
|
|
|
#End Region ' Command Click Btn
|
|
|
|
Friend Sub DirectCutPage_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
|
Select Case m_ActiveDirectCutPage
|
|
Case DirectCutPages.SawTest
|
|
LeftButtonGrid.Children.Remove(m_SawTest)
|
|
Case DirectCutPages.Polishing
|
|
LeftButtonGrid.Children.Remove(m_Polishing)
|
|
Case DirectCutPages.CopyTemplate
|
|
LeftButtonGrid.Children.Remove(m_CopyTemplate)
|
|
End Select
|
|
End Sub
|
|
|
|
End Class
|