OmagCUT :
- Aggiunta navigazione tra le pagine di scelta dei componenti. - Aggiunti componenti curvi.
@@ -72,6 +72,11 @@
|
||||
Public Const S_MACH_INPROGRESS As String = "InProgress"
|
||||
Public Const K_PHASEVAR As String = "PhaseVar"
|
||||
|
||||
Public Const S_MACH_PROBING As String = "Probing"
|
||||
Public Const K_PROBINGSTATEVAR As String = "ProbingStateVar"
|
||||
Public Const K_SAWDIAMETER As String = "SawDiameter"
|
||||
Public Const K_RAWTHICKNESS As String = "RawThickness"
|
||||
|
||||
Public Const S_MACH_MACH As String = "Mach"
|
||||
Public Const K_CURRSAW As String = "CurrSaw"
|
||||
Public Const K_CURRDRILL As String = "CurrDrill"
|
||||
|
||||
@@ -157,8 +157,10 @@ Public Class DirectCutPageUC
|
||||
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
|
||||
' Creo MsgBox di attesa
|
||||
Dim MsgBoxStateInfo As New EgtMsgBox(m_MainWindow, EgtMsg(MSG_DIRECTCUTPAGEUC + 41), EgtMsg(MSG_DIRECTCUTPAGEUC + 42), True, EgtMsgBox.Icons.NULL)
|
||||
Dim ProbingStateNameVar As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH_PROBING, K_PROBINGSTATEVAR, "", ProbingStateNameVar, m_MainWindow.GetMachIniFile())
|
||||
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter("L108", 1)
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(ProbingStateNameVar, 1)
|
||||
' Definisco flag tastatura
|
||||
Dim bProbingOk As Boolean = False
|
||||
For I = 0 To 120
|
||||
@@ -187,8 +189,10 @@ Public Class DirectCutPageUC
|
||||
Next
|
||||
If bProbingOk Then
|
||||
' Leggo spessore misurato
|
||||
Dim SawDiameterNameVar As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH_PROBING, K_SAWDIAMETER, "", SawDiameterNameVar, m_MainWindow.GetMachIniFile())
|
||||
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter("E80006", 1)
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(SawDiameterNameVar, 1)
|
||||
Dim SawDiam As Double = 0
|
||||
For I = 0 To 20
|
||||
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 1 Then
|
||||
|
||||
@@ -123,21 +123,28 @@
|
||||
<Grid Name="LowerButtonsGrid" Grid.Column="1" Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Name="PartNumTxBl" Grid.Column="1" Style="{StaticResource OmagCut_CurrProjSummeryTextBlock}"
|
||||
<Grid Name="PartNumberGrd" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Name="PartNumTxBl" Grid.Column="0" Style="{StaticResource OmagCut_CurrProjSummeryTextBlock}"
|
||||
TextAlignment="Right"/>
|
||||
<EgtWPFLib:EgtTextBox Name="PartNumTxBx" Grid.Column="2" Width="60"
|
||||
<EgtWPFLib:EgtTextBox Name="PartNumTxBx" Grid.Column="1" Width="60"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
|
||||
<Button Name="OkBtn" Grid.Column="3" Style="{StaticResource OmagCut_GradientBlueIconButton}">
|
||||
</Grid>
|
||||
|
||||
<Button Name="OkBtn" Grid.Column="2" Style="{StaticResource OmagCut_GradientBlueIconButton}">
|
||||
<Image Source="Resources/V.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
<Button Name="ExitBtn" Grid.Column="4" Style="{StaticResource OmagCut_GradientBlueIconButton}">
|
||||
<Button Name="ExitBtn" Grid.Column="3" Style="{StaticResource OmagCut_GradientBlueIconButton}">
|
||||
<Image Source="Resources/X.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -4,343 +4,374 @@ Imports EgtWPFLib
|
||||
|
||||
Public Class DrawPageUC
|
||||
|
||||
' Constants
|
||||
Private Const NUM_VAR As Integer = 10
|
||||
Private Const LUA_CMP_VARS As String = "CMP"
|
||||
Private Const LUA_CMP_DRAW As String = "CMP_Draw"
|
||||
Private Const INFO_VAR As String = "Var"
|
||||
' Constants
|
||||
Private Const NUM_VAR As Integer = 10
|
||||
Private Const LUA_CMP_VARS As String = "CMP"
|
||||
Private Const LUA_CMP_DRAW As String = "CMP_Draw"
|
||||
Private Const INFO_VAR As String = "Var"
|
||||
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
'Dichiarazione delle Page UserControl
|
||||
Friend m_MainComponentPage As MainComponentPageUC
|
||||
'Dichiarazione delle Page UserControl
|
||||
Friend m_MainComponentPage As MainComponentPageUC
|
||||
|
||||
' Properties
|
||||
Private m_sCompoDir As String = String.Empty
|
||||
Private m_sCompoName As String = String.Empty
|
||||
Private m_CVars(NUM_VAR - 1) As CompoVar
|
||||
Private m_bDrawOk As Boolean = False
|
||||
Private m_bFirst As Boolean = True
|
||||
' Properties
|
||||
Private m_sCompoDir As String = String.Empty
|
||||
Private m_sCompoName As String = String.Empty
|
||||
Private m_CVars(NUM_VAR - 1) As CompoVar
|
||||
Private m_bDrawOk As Boolean = False
|
||||
Private m_bFirst As Boolean = True
|
||||
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents DrawScene As New Scene
|
||||
Dim DrawSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents DrawScene As New Scene
|
||||
Dim DrawSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
|
||||
'Riferimento alla pagina correntemente attiva
|
||||
Friend m_ActiveComponentPage As Pages
|
||||
'Riferimento alla pagina correntemente attiva
|
||||
Friend m_ActiveComponentPage As Pages
|
||||
|
||||
' Modalità aggiornamento variabili
|
||||
Friend m_bShowVar As Boolean = False
|
||||
' Modalità aggiornamento variabili
|
||||
Friend m_bShowVar As Boolean = False
|
||||
|
||||
Enum Pages
|
||||
MainComponent
|
||||
SecondaryComponent
|
||||
Draw
|
||||
End Enum
|
||||
Enum Pages
|
||||
MainComponent
|
||||
SecondaryComponent
|
||||
Draw
|
||||
End Enum
|
||||
|
||||
Private Sub DrawPage_Initialized(sender As Object, e As EventArgs)
|
||||
Private Sub DrawPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Creazione delle Page UserControl
|
||||
m_MainComponentPage = New MainComponentPageUC
|
||||
'Posizionemento nella griglia delle Page UserControl
|
||||
m_MainComponentPage.SetValue(Grid.ColumnProperty, 0)
|
||||
m_MainComponentPage.SetValue(Grid.RowSpanProperty, 2)
|
||||
'Creazione delle Page UserControl
|
||||
m_MainComponentPage = New MainComponentPageUC
|
||||
'Posizionemento nella griglia delle Page UserControl
|
||||
m_MainComponentPage.SetValue(Grid.ColumnProperty, 0)
|
||||
m_MainComponentPage.SetValue(Grid.RowSpanProperty, 2)
|
||||
|
||||
'Assegnazione scena all'host e posizionamento nella ImportPageGrid
|
||||
DrawSceneHost.Child = DrawScene
|
||||
DrawSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
DrawSceneHost.SetValue(Grid.RowProperty, 0)
|
||||
Me.LeftButtonGrid.Children.Add(DrawSceneHost)
|
||||
'Assegnazione scena all'host e posizionamento nella ImportPageGrid
|
||||
DrawSceneHost.Child = DrawScene
|
||||
DrawSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
DrawSceneHost.SetValue(Grid.RowProperty, 0)
|
||||
Me.LeftButtonGrid.Children.Add(DrawSceneHost)
|
||||
|
||||
'Associazione tag textbox e label per visualizzare nome nella calcolatrice
|
||||
TextBox1.Tag = Label1
|
||||
TextBox2.Tag = Label2
|
||||
TextBox3.Tag = Label3
|
||||
TextBox4.Tag = Label4
|
||||
TextBox5.Tag = Label5
|
||||
TextBox6.Tag = Label6
|
||||
TextBox7.Tag = Label7
|
||||
TextBox8.Tag = Label8
|
||||
TextBox9.Tag = Label9
|
||||
TextBox10.Tag = Label10
|
||||
'Associazione tag textbox e label per visualizzare nome nella calcolatrice
|
||||
TextBox1.Tag = Label1
|
||||
TextBox2.Tag = Label2
|
||||
TextBox3.Tag = Label3
|
||||
TextBox4.Tag = Label4
|
||||
TextBox5.Tag = Label5
|
||||
TextBox6.Tag = Label6
|
||||
TextBox7.Tag = Label7
|
||||
TextBox8.Tag = Label8
|
||||
TextBox9.Tag = Label9
|
||||
TextBox10.Tag = Label10
|
||||
|
||||
'Imposto i messaggi letti dal file dei messaggi
|
||||
'Imposto i messaggi letti dal file dei messaggi
|
||||
PartNumTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 1) 'Part Number - Numero pezzi
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub DrawPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
Private Sub DrawPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
|
||||
If m_bFirst Then
|
||||
' imposto colore di default
|
||||
Dim DefColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetDefaultMaterial(DefColor)
|
||||
' imposto colori sfondo
|
||||
Dim BackTopColor As New Color3d(192, 192, 192)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
|
||||
Dim BackBotColor As New Color3d(BackTopColor)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetViewBackground(BackTopColor, BackBotColor)
|
||||
' imposto colore di evidenziazione
|
||||
Dim MarkColor As New Color3d(255, 255, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetMarkMaterial(MarkColor)
|
||||
' imposto colore per superfici selezionate
|
||||
Dim SelSurfColor As New Color3d(255, 255, 192)
|
||||
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetSelSurfMaterial(SelSurfColor)
|
||||
' imposto tipo e colore del rettangolo di zoom
|
||||
Dim bOutline As Boolean = True
|
||||
Dim ZwColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetZoomWinAttribs(bOutline, ZwColor)
|
||||
' imposto colore della linea di distanza
|
||||
Dim DstLnColor As New Color3d(255, 0, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetDistLineMaterial(DstLnColor)
|
||||
' imposto parametri OpenGL
|
||||
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
|
||||
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
|
||||
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
||||
' inizializzo la scena (DB geometrico + visualizzazione)
|
||||
DrawScene.Init()
|
||||
' Imposto griglia
|
||||
LoadGridData()
|
||||
' leggo direttorio componenti
|
||||
GetPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir, m_MainWindow.GetIniFile())
|
||||
m_bFirst = False
|
||||
Else
|
||||
EgtSetCurrentContext(DrawScene.GetCtx())
|
||||
End If
|
||||
If m_bFirst Then
|
||||
' imposto colore di default
|
||||
Dim DefColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetDefaultMaterial(DefColor)
|
||||
' imposto colori sfondo
|
||||
Dim BackTopColor As New Color3d(192, 192, 192)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
|
||||
Dim BackBotColor As New Color3d(BackTopColor)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetViewBackground(BackTopColor, BackBotColor)
|
||||
' imposto colore di evidenziazione
|
||||
Dim MarkColor As New Color3d(255, 255, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetMarkMaterial(MarkColor)
|
||||
' imposto colore per superfici selezionate
|
||||
Dim SelSurfColor As New Color3d(255, 255, 192)
|
||||
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetSelSurfMaterial(SelSurfColor)
|
||||
' imposto tipo e colore del rettangolo di zoom
|
||||
Dim bOutline As Boolean = True
|
||||
Dim ZwColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetZoomWinAttribs(bOutline, ZwColor)
|
||||
' imposto colore della linea di distanza
|
||||
Dim DstLnColor As New Color3d(255, 0, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetDistLineMaterial(DstLnColor)
|
||||
' imposto parametri OpenGL
|
||||
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
|
||||
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
|
||||
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
|
||||
DrawScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
||||
' inizializzo la scena (DB geometrico + visualizzazione)
|
||||
DrawScene.Init()
|
||||
' Imposto griglia
|
||||
LoadGridData()
|
||||
' leggo direttorio componenti
|
||||
GetPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir, m_MainWindow.GetIniFile())
|
||||
m_bFirst = False
|
||||
Else
|
||||
EgtSetCurrentContext(DrawScene.GetCtx())
|
||||
End If
|
||||
|
||||
' inibisco selezione diretta da Scene
|
||||
DrawScene.SetStatusNull()
|
||||
' pulisco la scena e relativo db
|
||||
EgtNewFile()
|
||||
EgtDraw()
|
||||
' inibisco selezione diretta da Scene
|
||||
DrawScene.SetStatusNull()
|
||||
' pulisco la scena e relativo db
|
||||
EgtNewFile()
|
||||
EgtDraw()
|
||||
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
m_ActiveComponentPage = Pages.MainComponent
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
VariablesCompoGrid.Visibility = Windows.Visibility.Hidden
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
m_ActiveComponentPage = Pages.MainComponent
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
VariablesCompoGrid.Visibility = Windows.Visibility.Hidden
|
||||
PartNumberGrd.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
'Valore di default del numero pezzi
|
||||
PartNumTxBx.Text = 1
|
||||
'Valore di default del numero pezzi
|
||||
PartNumTxBx.Text = 1
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub LoadGridData()
|
||||
Dim dSnapStep As Double = GetPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10, m_MainWindow.GetIniFile())
|
||||
Dim nMinLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1, m_MainWindow.GetIniFile())
|
||||
Dim nMajLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10, m_MainWindow.GetIniFile())
|
||||
Dim nExtSStep As Integer = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50, m_MainWindow.GetIniFile())
|
||||
Dim MinLnColor As New Color3d(160, 160, 160)
|
||||
GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor, m_MainWindow.GetIniFile())
|
||||
Dim MajLnColor As New Color3d(160, 160, 160)
|
||||
GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor, m_MainWindow.GetIniFile())
|
||||
EgtSetGridFrame(Frame3d.GLOB)
|
||||
EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep)
|
||||
EgtSetGridColor(MinLnColor, MajLnColor)
|
||||
Dim bShowGrid As Boolean = (GetPrivateProfileInt(S_GRID, K_SHOWGRID, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
EgtSetGridShow(bShowGrid, False)
|
||||
End Sub
|
||||
Private Sub LoadGridData()
|
||||
Dim dSnapStep As Double = GetPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10, m_MainWindow.GetIniFile())
|
||||
Dim nMinLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1, m_MainWindow.GetIniFile())
|
||||
Dim nMajLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10, m_MainWindow.GetIniFile())
|
||||
Dim nExtSStep As Integer = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50, m_MainWindow.GetIniFile())
|
||||
Dim MinLnColor As New Color3d(160, 160, 160)
|
||||
GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor, m_MainWindow.GetIniFile())
|
||||
Dim MajLnColor As New Color3d(160, 160, 160)
|
||||
GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor, m_MainWindow.GetIniFile())
|
||||
EgtSetGridFrame(Frame3d.GLOB)
|
||||
EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep)
|
||||
EgtSetGridColor(MinLnColor, MajLnColor)
|
||||
Dim bShowGrid As Boolean = (GetPrivateProfileInt(S_GRID, K_SHOWGRID, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
EgtSetGridShow(bShowGrid, False)
|
||||
End Sub
|
||||
|
||||
Public Sub SelectedComponent(sCompo As String)
|
||||
' Carico componente
|
||||
LoadCurrentCompo(sCompo)
|
||||
End Sub
|
||||
Public Sub SelectedComponent(sCompo As String)
|
||||
' Carico componente
|
||||
LoadCurrentCompo(sCompo)
|
||||
End Sub
|
||||
|
||||
Private Sub LoadCurrentCompo(ByVal sCompo As String)
|
||||
' Verifico se cambiato
|
||||
If sCompo = m_sCompoName Then
|
||||
Return
|
||||
End If
|
||||
m_sCompoName = sCompo
|
||||
' Pulisco l'ambiente lua
|
||||
ResetLuaVariables()
|
||||
' Carico il file ed eseguo in modalità anteprima
|
||||
Dim bOk As Boolean = ExecCompoFile()
|
||||
Dim sMsg As String = String.Empty
|
||||
bOk = bOk AndAlso MakePreview(sMsg)
|
||||
If Not bOk Then
|
||||
EgtNewFile()
|
||||
End If
|
||||
Private Sub LoadCurrentCompo(ByVal sCompo As String)
|
||||
' Verifico se cambiato
|
||||
If sCompo = m_sCompoName Then
|
||||
Return
|
||||
End If
|
||||
m_sCompoName = sCompo
|
||||
' Pulisco l'ambiente lua
|
||||
ResetLuaVariables()
|
||||
' Carico il file ed eseguo in modalità anteprima
|
||||
Dim bOk As Boolean = ExecCompoFile()
|
||||
Dim sMsg As String = String.Empty
|
||||
bOk = bOk AndAlso MakePreview(sMsg)
|
||||
If Not bOk Then
|
||||
EgtNewFile()
|
||||
End If
|
||||
MessageTxBl.Text = sMsg
|
||||
MessageGrid.Background = If(m_bDrawOk, Brushes.Transparent, Application.Current.FindResource("OmagCut_Red"))
|
||||
DrawScene.ZoomAll()
|
||||
' se componenti con buchi interni visualizzo bottoni appositi
|
||||
If sCompo = "Pianocucina.lua" Or sCompo = "Pianobagno.lua" Then
|
||||
ShowInternalBtn()
|
||||
End If
|
||||
' leggo variabili e aggiorno griglia
|
||||
ReadAndShowVariables()
|
||||
' abilito bottoni Vista e Inserisci
|
||||
OkBtn.IsEnabled = True
|
||||
' un pezzo da inserire
|
||||
'tbNbr.Text = "1"
|
||||
End Sub
|
||||
DrawScene.ZoomAll()
|
||||
' se componenti con buchi interni visualizzo bottoni appositi
|
||||
If sCompo = "Pianocucina.lua" Or sCompo = "Pianobagno.lua" Then
|
||||
ShowInternalBtn()
|
||||
End If
|
||||
' leggo variabili e aggiorno griglia
|
||||
ReadAndShowVariables()
|
||||
' abilito bottoni Vista e Inserisci
|
||||
OkBtn.IsEnabled = True
|
||||
' un pezzo da inserire
|
||||
'tbNbr.Text = "1"
|
||||
End Sub
|
||||
|
||||
Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click
|
||||
DrawPage_Unloaded(sender, e)
|
||||
DrawPage_Loaded(sender, e)
|
||||
End Sub
|
||||
Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click
|
||||
DrawPage_Unloaded(sender, e)
|
||||
' Elimino nome del componente precedente
|
||||
m_sCompoName = String.Empty
|
||||
'
|
||||
If String.IsNullOrEmpty(m_MainComponentPage.m_SecondaryComponentPage.m_sCurrCompo) Then
|
||||
DrawPage_Loaded(sender, e)
|
||||
Else
|
||||
LoadSecondaryPage()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub UpdateView()
|
||||
' verifico ci sia un componente corrente
|
||||
If String.IsNullOrWhiteSpace(m_sCompoName) Then
|
||||
Return
|
||||
End If
|
||||
' aggiorno le variabili dalla griglia
|
||||
UpdateVariables()
|
||||
' ricalcolo il disegno
|
||||
Dim sMsg As String = String.Empty
|
||||
MakePreview(sMsg)
|
||||
Private Sub LoadSecondaryPage()
|
||||
EgtSetCurrentContext(DrawScene.GetCtx())
|
||||
|
||||
' inibisco selezione diretta da Scene
|
||||
DrawScene.SetStatusNull()
|
||||
' pulisco la scena e relativo db
|
||||
EgtNewFile()
|
||||
EgtDraw()
|
||||
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
LeftButtonGrid.Children.Add(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
m_ActiveComponentPage = Pages.MainComponent
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
VariablesCompoGrid.Visibility = Windows.Visibility.Hidden
|
||||
PartNumberGrd.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
'Valore di default del numero pezzi
|
||||
PartNumTxBx.Text = 1
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub UpdateView()
|
||||
' verifico ci sia un componente corrente
|
||||
If String.IsNullOrWhiteSpace(m_sCompoName) Then
|
||||
Return
|
||||
End If
|
||||
' aggiorno le variabili dalla griglia
|
||||
UpdateVariables()
|
||||
' ricalcolo il disegno
|
||||
Dim sMsg As String = String.Empty
|
||||
MakePreview(sMsg)
|
||||
MessageTxBl.Text = sMsg
|
||||
MessageGrid.Background = If(m_bDrawOk, Brushes.Transparent, Application.Current.FindResource("OmagCut_Red"))
|
||||
' aggiorno visualizzazione
|
||||
EgtSetView(VT.TOP, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
' aggiorno visualizzazione
|
||||
EgtSetView(VT.TOP, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
Private Function ExecCompoFile() As Boolean
|
||||
' Costruisco path completa del componente
|
||||
Dim sPath = m_sCompoDir & "\" & m_sCompoName
|
||||
' Carico il file
|
||||
Return EgtLuaExecFile(sPath)
|
||||
End Function
|
||||
Private Function ExecCompoFile() As Boolean
|
||||
' Costruisco path completa del componente
|
||||
Dim sPath = m_sCompoDir & "\" & m_sCompoName
|
||||
' Carico il file
|
||||
Return EgtLuaExecFile(sPath)
|
||||
End Function
|
||||
|
||||
Private Function ShowInternalBtn() As Boolean
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Visible
|
||||
AddBtn.Visibility = Windows.Visibility.Visible
|
||||
CancelBtn.Visibility = Windows.Visibility.Visible
|
||||
Return True
|
||||
End Function
|
||||
Private Function ShowInternalBtn() As Boolean
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Visible
|
||||
AddBtn.Visibility = Windows.Visibility.Visible
|
||||
CancelBtn.Visibility = Windows.Visibility.Visible
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function ReadAndShowVariables() As Boolean
|
||||
' Recupero nome, tipo e valore delle variabili globali
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
Dim CVar = New CompoVar
|
||||
CVar.m_nInd = i
|
||||
If CVar.NameTypeValueFromLua() Then
|
||||
m_CVars(i - 1) = CVar
|
||||
Else
|
||||
m_CVars(i - 1) = Nothing
|
||||
End If
|
||||
Next
|
||||
Private Function ReadAndShowVariables() As Boolean
|
||||
' Recupero nome, tipo e valore delle variabili globali
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
Dim CVar = New CompoVar
|
||||
CVar.m_nInd = i
|
||||
If CVar.NameTypeValueFromLua() Then
|
||||
m_CVars(i - 1) = CVar
|
||||
Else
|
||||
m_CVars(i - 1) = Nothing
|
||||
End If
|
||||
Next
|
||||
|
||||
' Aggiorno la griglia dalle variabili
|
||||
m_bShowVar = True
|
||||
' Aggiorno la griglia dalle variabili
|
||||
m_bShowVar = True
|
||||
|
||||
' Conto numero variabili definite e da nascondere
|
||||
Dim nShow As Integer = GetDefinedVarCount()
|
||||
Dim nHide As Integer = NUM_VAR - nShow
|
||||
' Conto numero variabili definite e da nascondere
|
||||
Dim nShow As Integer = GetDefinedVarCount()
|
||||
Dim nHide As Integer = NUM_VAR - nShow
|
||||
|
||||
For i As Integer = 1 To nHide
|
||||
GetNameEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
GetValueEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
GetNameEdit(j).Text = m_CVars(i - 1).m_sName
|
||||
GetNameEdit(j).Visibility = Windows.Visibility.Visible
|
||||
For i As Integer = 1 To nHide
|
||||
GetNameEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
GetValueEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
GetNameEdit(j).Text = m_CVars(i - 1).m_sName
|
||||
GetNameEdit(j).Visibility = Windows.Visibility.Visible
|
||||
GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
GetValueEdit(j).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
m_bShowVar = False
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function UpdateVariables() As Boolean
|
||||
' Conto numero variabili definite e da nascondere
|
||||
Dim nShow As Integer = GetDefinedVarCount()
|
||||
Dim nHide As Integer = NUM_VAR - nShow
|
||||
' aggiorno le variabili
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
' interpreto il valore, se non riesco ripristino default
|
||||
If Not m_CVars(i - 1).FromString(GetValueEdit(j).Text) Then
|
||||
GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
GetValueEdit(j).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
m_bShowVar = False
|
||||
Return True
|
||||
End Function
|
||||
End If
|
||||
' aggiorno la corrispondente variabile lua
|
||||
If Not m_CVars(i - 1).ToLua() Then
|
||||
Dim sErr As String = String.Empty
|
||||
EgtLuaGetLastError(sErr)
|
||||
EgtOutLog(sErr)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function UpdateVariables() As Boolean
|
||||
' Conto numero variabili definite e da nascondere
|
||||
Dim nShow As Integer = GetDefinedVarCount()
|
||||
Dim nHide As Integer = NUM_VAR - nShow
|
||||
' aggiorno le variabili
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
' interpreto il valore, se non riesco ripristino default
|
||||
If Not m_CVars(i - 1).FromString(GetValueEdit(j).Text) Then
|
||||
GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
End If
|
||||
' aggiorno la corrispondente variabile lua
|
||||
If Not m_CVars(i - 1).ToLua() Then
|
||||
Dim sErr As String = String.Empty
|
||||
EgtLuaGetLastError(sErr)
|
||||
EgtOutLog(sErr)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
Private Function GetDefinedVarCount() As Integer
|
||||
Dim nCount As Integer = 0
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
If m_CVars(i - 1) IsNot Nothing Then
|
||||
nCount += 1
|
||||
End If
|
||||
Next
|
||||
Return nCount
|
||||
End Function
|
||||
|
||||
Private Function GetDefinedVarCount() As Integer
|
||||
Dim nCount As Integer = 0
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
If m_CVars(i - 1) IsNot Nothing Then
|
||||
nCount += 1
|
||||
End If
|
||||
Next
|
||||
Return nCount
|
||||
End Function
|
||||
Private Function ResetLuaVariables() As Boolean
|
||||
EgtLuaResetGlobVar(LUA_CMP_VARS)
|
||||
EgtLuaResetGlobVar(LUA_CMP_DRAW)
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function ResetLuaVariables() As Boolean
|
||||
EgtLuaResetGlobVar(LUA_CMP_VARS)
|
||||
EgtLuaResetGlobVar(LUA_CMP_DRAW)
|
||||
Return False
|
||||
End Function
|
||||
Private Function MakePreview(ByRef sMsg As String) As Boolean
|
||||
If Not EgtLuaExecLine(LUA_CMP_DRAW & "(true)") Then
|
||||
sMsg = "Error in component execution"
|
||||
m_bDrawOk = False
|
||||
Else
|
||||
EgtLuaGetGlobStringVar(LUA_CMP_VARS & ".MSG", sMsg)
|
||||
Dim nErr As Integer = 0
|
||||
EgtLuaGetGlobIntVar(LUA_CMP_VARS & ".ERR", nErr)
|
||||
m_bDrawOk = (nErr = 0)
|
||||
End If
|
||||
Return m_bDrawOk
|
||||
End Function
|
||||
|
||||
Private Function MakePreview(ByRef sMsg As String) As Boolean
|
||||
If Not EgtLuaExecLine(LUA_CMP_DRAW & "(true)") Then
|
||||
sMsg = "Error in component execution"
|
||||
m_bDrawOk = False
|
||||
Else
|
||||
EgtLuaGetGlobStringVar(LUA_CMP_VARS & ".MSG", sMsg)
|
||||
Dim nErr As Integer = 0
|
||||
EgtLuaGetGlobIntVar(LUA_CMP_VARS & ".ERR", nErr)
|
||||
m_bDrawOk = (nErr = 0)
|
||||
End If
|
||||
Return m_bDrawOk
|
||||
End Function
|
||||
|
||||
Private Function MakeInsert(ByVal nNbr As Integer) As Boolean
|
||||
' ricarico componente corrente
|
||||
ExecCompoFile()
|
||||
' aggiorno variabili
|
||||
UpdateVariables()
|
||||
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
|
||||
Dim bDirect As Boolean = (GetPrivateProfileInt(S_NEST, K_DIRECT, 0, m_MainWindow.GetIniFile()) <> 0)
|
||||
' elimino eventuali precedenti pezzi vuoti
|
||||
EgtEraseEmptyParts()
|
||||
' eseguo inserimento
|
||||
For i As Integer = 1 To nNbr
|
||||
' Inserisco il componente
|
||||
If Not EgtLuaExecLine(LUA_CMP_DRAW & "(false)") Then
|
||||
Dim sErr As String = String.Empty
|
||||
EgtLuaGetLastError(sErr)
|
||||
EgtOutLog(sErr)
|
||||
Exit For
|
||||
End If
|
||||
' Ne recupero l'Id
|
||||
Dim nId2 As Integer = EgtGetLastPart()
|
||||
' Muovo la regione in Z per evitare problemi in visualizzazione
|
||||
Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
|
||||
EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
|
||||
' Aggiusto per lavorazioni
|
||||
AdjustFlatPart(nId2)
|
||||
' Inserisco in parcheggio
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True)
|
||||
' Se richiesto posizionamento diretto, lo eseguo
|
||||
If bDirect Then
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
Private Function MakeInsert(ByVal nNbr As Integer) As Boolean
|
||||
' ricarico componente corrente
|
||||
ExecCompoFile()
|
||||
' aggiorno variabili
|
||||
UpdateVariables()
|
||||
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
|
||||
Dim bDirect As Boolean = (GetPrivateProfileInt(S_NEST, K_DIRECT, 0, m_MainWindow.GetIniFile()) <> 0)
|
||||
' elimino eventuali precedenti pezzi vuoti
|
||||
EgtEraseEmptyParts()
|
||||
' eseguo inserimento
|
||||
For i As Integer = 1 To nNbr
|
||||
' Inserisco il componente
|
||||
If Not EgtLuaExecLine(LUA_CMP_DRAW & "(false)") Then
|
||||
Dim sErr As String = String.Empty
|
||||
EgtLuaGetLastError(sErr)
|
||||
EgtOutLog(sErr)
|
||||
Exit For
|
||||
End If
|
||||
' Ne recupero l'Id
|
||||
Dim nId2 As Integer = EgtGetLastPart()
|
||||
' Muovo la regione in Z per evitare problemi in visualizzazione
|
||||
Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
|
||||
EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
|
||||
' Aggiusto per lavorazioni
|
||||
AdjustFlatPart(nId2)
|
||||
' Inserisco in parcheggio
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True)
|
||||
' Se richiesto posizionamento diretto, lo eseguo
|
||||
If bDirect Then
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function GetNameEdit(ByVal nInd As Integer) As TextBlock
|
||||
Select Case nInd
|
||||
@@ -367,30 +398,30 @@ Public Class DrawPageUC
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetValueEdit(ByVal nInd As Integer) As TextBox
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return TextBox1
|
||||
Case 2
|
||||
Return TextBox2
|
||||
Case 3
|
||||
Return TextBox3
|
||||
Case 4
|
||||
Return TextBox4
|
||||
Case 5
|
||||
Return TextBox5
|
||||
Case 6
|
||||
Return TextBox6
|
||||
Case 7
|
||||
Return TextBox7
|
||||
Case 8
|
||||
Return TextBox8
|
||||
Case 9
|
||||
Return TextBox9
|
||||
Case Else
|
||||
Return TextBox10
|
||||
End Select
|
||||
End Function
|
||||
Private Function GetValueEdit(ByVal nInd As Integer) As TextBox
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return TextBox1
|
||||
Case 2
|
||||
Return TextBox2
|
||||
Case 3
|
||||
Return TextBox3
|
||||
Case 4
|
||||
Return TextBox4
|
||||
Case 5
|
||||
Return TextBox5
|
||||
Case 6
|
||||
Return TextBox6
|
||||
Case 7
|
||||
Return TextBox7
|
||||
Case 8
|
||||
Return TextBox8
|
||||
Case 9
|
||||
Return TextBox9
|
||||
Case Else
|
||||
Return TextBox10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub EgtTextBox_EgtOpening(sender As Object, e As RoutedEventArgs) Handles TextBox9.EgtOpening, TextBox10.EgtOpening
|
||||
Dim SelectedTextBox As TextBox = e.Source
|
||||
@@ -432,46 +463,45 @@ Public Class DrawPageUC
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
' se errore esco
|
||||
If Not m_bDrawOk Then
|
||||
Return
|
||||
End If
|
||||
' Leggo numero di pezzi da inserire
|
||||
Dim InsNbr As Integer = Int32.Parse(PartNumTxBx.Text)
|
||||
' Passo al contesto principale
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Inserisco il componente nel DB geometrico principale
|
||||
MakeInsert(InsNbr)
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
' se errore esco
|
||||
If Not m_bDrawOk Then
|
||||
Return
|
||||
End If
|
||||
' Leggo numero di pezzi da inserire
|
||||
Dim InsNbr As Integer = Int32.Parse(PartNumTxBx.Text)
|
||||
' Passo al contesto principale
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Inserisco il componente nel DB geometrico principale
|
||||
MakeInsert(InsNbr)
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
|
||||
Private Sub DrawPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
Select Case m_ActiveComponentPage
|
||||
Case Pages.MainComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage)
|
||||
Case Pages.SecondaryComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
Case Else
|
||||
End Select
|
||||
Private Sub DrawPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
Select Case m_ActiveComponentPage
|
||||
Case Pages.MainComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage)
|
||||
Case Pages.SecondaryComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
Case Else
|
||||
End Select
|
||||
|
||||
' Pulisco l'ambiente lua
|
||||
ResetLuaVariables()
|
||||
m_sCompoName = String.Empty
|
||||
' Pulisco l'ambiente lua
|
||||
ResetLuaVariables()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -123,17 +123,18 @@
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
<Button Name="Compo9" Grid.Row="8" Style="{StaticResource OmagCut_YellowIconButton}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="140"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Name="ImageCompo9" Grid.Column="0" />
|
||||
<TextBlock Name="LabelCompo9" Grid.Column="1"
|
||||
Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Grid Name="OthersBackGr" Grid.Row="8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Name="Compo9" Grid.ColumnSpan="2" Style="{StaticResource OmagCut_YellowIconButton}">
|
||||
<Grid>
|
||||
<Image Name="ImageCompo9" Source="/Resources/NumericKeyboardArrow.png"/>
|
||||
<TextBlock Name="LabelCompo9" Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -8,8 +8,14 @@ Public Class MainComponentPageUC
|
||||
'Dichiarazione delle Page UserControl
|
||||
Friend m_SecondaryComponentPage As SecondaryComponentPageUC
|
||||
|
||||
' Flag che indica se è attiva la prima o la seconda pagina
|
||||
Friend m_bIsFirstPage As Boolean
|
||||
|
||||
Friend CurrentBtn As Button = Nothing
|
||||
|
||||
' Variabile che contiene il nome del componente selezionato
|
||||
Friend m_sCurrCompoFam As String = String.Empty
|
||||
|
||||
Private Sub MainComponentPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Creazione delle Page UserControl
|
||||
@@ -18,71 +24,19 @@ Public Class MainComponentPageUC
|
||||
m_SecondaryComponentPage.SetValue(Grid.ColumnProperty, 0)
|
||||
m_SecondaryComponentPage.SetValue(Grid.RowSpanProperty, 2)
|
||||
|
||||
' Creazione converter da String a ImageSource
|
||||
Dim ImageConverter As New ImageSourceConverter
|
||||
Dim ThicknessConverter As New ThicknessConverter
|
||||
|
||||
'Assegnazione immagine e testo ai Button
|
||||
Dim nCompoNumber As Integer = GetPrivateProfileInt("Compo", "Count", 0, m_MainWindow.GetIniFile())
|
||||
For index As Integer = 1 To nCompoNumber
|
||||
Dim CustomThickness As Thickness = ThicknessConverter.ConvertFromString("0")
|
||||
Dim nCompoName As Integer = GetPrivateProfileInt("Compo" & index, "Name", 0, m_MainWindow.GetIniFile())
|
||||
Dim sCompoImage As String = ""
|
||||
Dim sCompoImageSource As ImageSource
|
||||
|
||||
'verifico presenza immagine e la aggiungo
|
||||
If GetPrivateProfileString("Compo" & index, "Image", "", sCompoImage, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
Try
|
||||
sCompoImageSource = ImageConverter.ConvertFromString(m_MainWindow.GetResourcesDir() & "\" & sCompoImage)
|
||||
GetImage(index).Height = 65
|
||||
GetImage(index).Width = 65
|
||||
GetImage(index).Source = sCompoImageSource
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Error loading image " & sCompoImage)
|
||||
sCompoImage = String.Empty
|
||||
GetImage(index).Height = 0
|
||||
GetImage(index).Width = 0
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End Try
|
||||
Else
|
||||
'Se non c'è l'immagine azzero la distanza tra testo e immagine
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End If
|
||||
|
||||
'verifico presenza testo
|
||||
If nCompoName > 0 Then
|
||||
Dim sCompoName As String = EgtMsg(MSG_COMPONENTPAGEUC + nCompoName)
|
||||
'verifico presenza immagine
|
||||
If sCompoImage.Length > 0 Then
|
||||
'se la lunghezza del testo è maggiore di 15 lo taglio
|
||||
If sCompoName.Length > 15 Then
|
||||
sCompoName = sCompoName.Substring(0, 15)
|
||||
End If
|
||||
GetLabel(index).Text = sCompoName
|
||||
'Se ci sono sia testo che immagine imposto un margine di 10
|
||||
CustomThickness.Right = 10
|
||||
GetImage(index).Margin = CustomThickness
|
||||
Else
|
||||
'se l'immagine non c'è e il testo è maggiore di 20 lo taglio
|
||||
If sCompoName.Length > 20 Then
|
||||
sCompoName = sCompoName.Substring(0, 20)
|
||||
End If
|
||||
GetLabel(index).Text = sCompoName
|
||||
End If
|
||||
Else
|
||||
'Se non c'è testo azzero la distanza tra testo e immagine
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End If
|
||||
|
||||
Next
|
||||
' Leggo messaggi da file ini
|
||||
LabelCompo9.Text = EgtMsg(MSG_COMPONENTPAGEUC + 9)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
m_bIsFirstPage = True
|
||||
LoadPage()
|
||||
CurrentBtn = Nothing
|
||||
Compo9.SetValue(Grid.ColumnProperty, 0)
|
||||
Compo9.SetValue(Grid.ColumnSpanProperty, 2)
|
||||
ImageCompo9.Visibility = Windows.Visibility.Hidden
|
||||
LabelCompo9.Visibility = Windows.Visibility.Visible
|
||||
End Sub
|
||||
|
||||
Private Function GetButton(ByVal nInd As Integer) As Button
|
||||
@@ -154,9 +108,65 @@ Public Class MainComponentPageUC
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub Compo_Click(sender As Object, e As RoutedEventArgs) Handles Compo1.Click, Compo2.Click, Compo3.Click, Compo4.Click, Compo5.Click, Compo6.Click, Compo7.Click, Compo8.Click, Compo9.Click
|
||||
Friend Function GetIndexFromButton(Button As Button) As Integer
|
||||
Select Case Button.Name
|
||||
Case "Compo1"
|
||||
If m_bIsFirstPage Then
|
||||
Return 1
|
||||
Else
|
||||
Return 9
|
||||
End If
|
||||
Case "Compo2"
|
||||
If m_bIsFirstPage Then
|
||||
Return 2
|
||||
Else
|
||||
Return 10
|
||||
End If
|
||||
Case "Compo3"
|
||||
If m_bIsFirstPage Then
|
||||
Return 3
|
||||
Else
|
||||
Return 11
|
||||
End If
|
||||
Case "Compo4"
|
||||
If m_bIsFirstPage Then
|
||||
Return 4
|
||||
Else
|
||||
Return 12
|
||||
End If
|
||||
Case "Compo5"
|
||||
If m_bIsFirstPage Then
|
||||
Return 5
|
||||
Else
|
||||
Return 13
|
||||
End If
|
||||
Case "Compo6"
|
||||
If m_bIsFirstPage Then
|
||||
Return 6
|
||||
Else
|
||||
Return 14
|
||||
End If
|
||||
Case "Compo7"
|
||||
If m_bIsFirstPage Then
|
||||
Return 7
|
||||
Else
|
||||
Return 15
|
||||
End If
|
||||
Case Else
|
||||
If m_bIsFirstPage Then
|
||||
Return 8
|
||||
Else
|
||||
Return 16
|
||||
End If
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub Compo_Click(sender As Object, e As RoutedEventArgs) Handles Compo1.Click, Compo2.Click, Compo3.Click, Compo4.Click, Compo5.Click, Compo6.Click, Compo7.Click, Compo8.Click
|
||||
CurrentBtn = e.Source
|
||||
Dim nCount As Integer = GetPrivateProfileInt(CurrentBtn.Name, "Count", 0, m_MainWindow.GetIniFile())
|
||||
Dim CompoName As String = "Compo" & GetIndexFromButton(CurrentBtn).ToString
|
||||
m_sCurrCompoFam = CompoName
|
||||
m_SecondaryComponentPage.m_sCurrCompo = String.Empty
|
||||
Dim nCount As Integer = GetPrivateProfileInt(CompoName, "Count", 0, m_MainWindow.GetIniFile())
|
||||
If nCount > 1 Then
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.SecondaryComponent
|
||||
@@ -165,10 +175,11 @@ Public Class MainComponentPageUC
|
||||
Dim nCompoName As Integer
|
||||
Dim sCompo As String = String.Empty
|
||||
Dim sCompoImage As String = String.Empty
|
||||
GetPrivateProfileCompo(CurrentBtn.Name, "Compo1", nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileCompo(CompoName, "Compo1", nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.VariablesCompoGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.PartNumberGrd.Visibility = Windows.Visibility.Visible
|
||||
' Carico componente
|
||||
m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo)
|
||||
End If
|
||||
@@ -199,4 +210,118 @@ Public Class MainComponentPageUC
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub ClearButton(nCount As Integer)
|
||||
Dim nEndIndex As Integer
|
||||
If m_bIsFirstPage Then
|
||||
nEndIndex = If(nCount < 8, nCount, 8)
|
||||
Else
|
||||
nEndIndex = If(nCount < 16, nCount - 8, 8)
|
||||
End If
|
||||
For index As Integer = 1 To nEndIndex
|
||||
GetLabel(index).Text = String.Empty
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
For index As Integer = nEndIndex + 1 To 8
|
||||
GetLabel(index).Text = String.Empty
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub LoadPage()
|
||||
Dim nDeltaSecondPage As Integer = 8
|
||||
' Leggo numero di componenti presenti
|
||||
Dim nCompoNumber As Integer = GetPrivateProfileInt("Compo", "Count", 0, m_MainWindow.GetIniFile())
|
||||
' Calcolo indici a seconda della pagina in cui sono
|
||||
If m_bIsFirstPage Then
|
||||
ClearButton(nCompoNumber)
|
||||
nDeltaSecondPage = 0
|
||||
Else
|
||||
ClearButton(nCompoNumber)
|
||||
nDeltaSecondPage = 8
|
||||
End If
|
||||
|
||||
' Creazione converter da String a ImageSource
|
||||
Dim ImageConverter As New ImageSourceConverter
|
||||
Dim ThicknessConverter As New ThicknessConverter
|
||||
|
||||
'Assegnazione immagine e testo ai Button
|
||||
For index = 1 To 8
|
||||
Dim CustomThickness As Thickness = ThicknessConverter.ConvertFromString("0")
|
||||
Dim nCompoName As Integer = GetPrivateProfileInt("Compo" & index + nDeltaSecondPage, "Name", 0, m_MainWindow.GetIniFile())
|
||||
Dim sCompoImage As String = ""
|
||||
Dim sCompoImageSource As ImageSource
|
||||
|
||||
'verifico presenza immagine e la aggiungo
|
||||
If GetPrivateProfileString("Compo" & index + nDeltaSecondPage, "Image", "", sCompoImage, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
Try
|
||||
sCompoImageSource = ImageConverter.ConvertFromString(m_MainWindow.GetResourcesDir() & "\" & sCompoImage)
|
||||
GetImage(index).Height = 65
|
||||
GetImage(index).Width = 65
|
||||
GetImage(index).Source = sCompoImageSource
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Error loading image " & sCompoImage)
|
||||
sCompoImage = String.Empty
|
||||
GetImage(index).Height = 0
|
||||
GetImage(index).Width = 0
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End Try
|
||||
Else
|
||||
'Se non c'è l'immagine azzero la distanza tra testo e immagine
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End If
|
||||
|
||||
'verifico presenza testo
|
||||
If nCompoName > 0 Then
|
||||
Dim sCompoName As String = EgtMsg(MSG_COMPONENTPAGEUC + nCompoName)
|
||||
'verifico presenza immagine
|
||||
If sCompoImage.Length > 0 Then
|
||||
'se la lunghezza del testo è maggiore di 15 lo taglio
|
||||
If sCompoName.Length > 15 Then
|
||||
sCompoName = sCompoName.Substring(0, 15)
|
||||
End If
|
||||
GetLabel(index).Text = sCompoName
|
||||
'Se ci sono sia testo che immagine imposto un margine di 10
|
||||
CustomThickness.Right = 10
|
||||
GetImage(index).Margin = CustomThickness
|
||||
Else
|
||||
'se l'immagine non c'è e il testo è maggiore di 20 lo taglio
|
||||
If sCompoName.Length > 20 Then
|
||||
sCompoName = sCompoName.Substring(0, 20)
|
||||
End If
|
||||
GetLabel(index).Text = sCompoName
|
||||
End If
|
||||
Else
|
||||
'Se non c'è testo azzero la distanza tra testo e immagine
|
||||
CustomThickness.Right = 0
|
||||
GetImage(index).Margin = CustomThickness
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
' Gestione bottone altri componenti
|
||||
Private Sub Compo9_Click(sender As Object, e As RoutedEventArgs) Handles Compo9.Click
|
||||
If m_bIsFirstPage Then
|
||||
m_bIsFirstPage = False
|
||||
LoadPage()
|
||||
Compo9.SetValue(Grid.ColumnProperty, 1)
|
||||
Compo9.SetValue(Grid.ColumnSpanProperty, 1)
|
||||
ImageCompo9.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/NumericKeyboardArrow.png", UriKind.Relative))
|
||||
ImageCompo9.Visibility = Windows.Visibility.Visible
|
||||
LabelCompo9.Visibility = Windows.Visibility.Hidden
|
||||
Else
|
||||
m_bIsFirstPage = True
|
||||
LoadPage()
|
||||
Compo9.SetValue(Grid.ColumnProperty, 0)
|
||||
Compo9.SetValue(Grid.ColumnSpanProperty, 2)
|
||||
ImageCompo9.Visibility = Windows.Visibility.Hidden
|
||||
LabelCompo9.Visibility = Windows.Visibility.Visible
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<ResourceDictionary Source="OmagCutDictionary.xaml"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Style="{StaticResource OmagCut_PageBorder}">
|
||||
<Border Style="{StaticResource OmagCut_Page2Border}">
|
||||
|
||||
<!-- Definizione della Grid laterale -->
|
||||
<Grid>
|
||||
@@ -57,19 +57,19 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<Button x:Name="L1Btn" Grid.Row="1" Height="60" Width="60" Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="L1Btn" Grid.Row="1" Height="60" Width="60" Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="L1TxBx" Grid.Column="1" Grid.Row="1" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<Button x:Name="L2Btn" Grid.Row="2" Height="60" Width="60" Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="L2Btn" Grid.Row="2" Height="60" Width="60" Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<EgtWPFLib:EgtTextBox x:Name="L2TxBx" Grid.Column="1" Grid.Row="2" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<Button x:Name="L3Btn" Grid.Row="3" Height="60" Width="60" Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="L3Btn" Grid.Row="3" Height="60" Width="60" Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<EgtWPFLib:EgtTextBox x:Name="L3TxBx" Grid.Column="1" Grid.Row="3" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<Button x:Name="R1Btn" Grid.Row="4" Height="60" Width="60" Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="R1Btn" Grid.Row="4" Height="60" Width="60" Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<EgtWPFLib:EgtTextBox x:Name="R1TxBx" Grid.Column="1" Grid.Row="4" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<Button x:Name="R2Btn" Grid.Row="5" Height="60" Width="60" Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="R2Btn" Grid.Row="5" Height="60" Width="60" Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<EgtWPFLib:EgtTextBox x:Name="R2TxBx" Grid.Column="1" Grid.Row="5" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="BackBtn" Grid.Column="1" Style="{StaticResource OmagCut_YellowIconButton}">
|
||||
<Button Name="BackBtn" Grid.Column="1" Style="{StaticResource OmagCut_YellowGradientYellowIconButton}">
|
||||
<Image Source="Resources/NumericKeyboardArrow.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -118,6 +118,11 @@
|
||||
<Setter Property="Background" Value="{StaticResource OmagCut_VeryLightGray}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OmagCut_Page2Border" TargetType="{x:Type Border}" BasedOn="{StaticResource OmagCut_EmptyBorder}">
|
||||
<Setter Property="Background" Value="{StaticResource OmagCut_LightGray}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource OmagCut_Yellow}"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________ -->
|
||||
|
||||
<LinearGradientBrush x:Key="Button_IsMouseOver" />
|
||||
|
||||
@@ -561,8 +561,10 @@ Public Class RawPartPageUC
|
||||
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
|
||||
' Creo MsgBox di attesa
|
||||
Dim MsgBoxStateInfo As New EgtMsgBox(m_MainWindow, EgtMsg(MSG_RAWPARTPAGEUC + 25), EgtMsg(MSG_RAWPARTPAGEUC + 26), True, EgtMsgBox.Icons.NULL)
|
||||
Dim ProbingStateNameVar As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH_PROBING, K_PROBINGSTATEVAR, "", ProbingStateNameVar, m_MainWindow.GetMachIniFile())
|
||||
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter("L108", 1)
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(ProbingStateNameVar, 1)
|
||||
' Definisco flag tastatura
|
||||
Dim bProbingOk As Boolean = False
|
||||
For I = 0 To 120
|
||||
@@ -591,8 +593,10 @@ Public Class RawPartPageUC
|
||||
Next
|
||||
If bProbingOk Then
|
||||
' Leggo spessore misurato
|
||||
Dim RawThicknessNameVar As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH_PROBING, K_PROBINGSTATEVAR, "", RawThicknessNameVar, m_MainWindow.GetMachIniFile())
|
||||
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter("E80004", 1)
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(RawThicknessNameVar, 1)
|
||||
Dim RawThickness As Double = 0
|
||||
For I = 0 To 20
|
||||
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 1 Then
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 743 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -2,11 +2,17 @@
|
||||
|
||||
Public Class SecondaryComponentPageUC
|
||||
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
'Riferimento alla MainComponentPage
|
||||
Dim m_MainComponentPage As MainComponentPageUC
|
||||
'Riferimento alla MainComponentPage
|
||||
Private m_MainComponentPage As MainComponentPageUC
|
||||
|
||||
' Variabile che contiene il nome del componente selezionato nella MainPage
|
||||
Private m_sMainCompoName As String
|
||||
|
||||
' Variabile che contiene il nome del componente selezionato
|
||||
Friend m_sCurrCompo As String = String.Empty
|
||||
|
||||
Private Sub SecondaryComponentPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
|
||||
@@ -19,15 +25,17 @@ Public Class SecondaryComponentPageUC
|
||||
Dim ImageConverter As New ImageSourceConverter
|
||||
Dim ThicknessConverter As New ThicknessConverter
|
||||
|
||||
m_sMainCompoName = m_MainComponentPage.m_sCurrCompoFam '"Compo" & m_MainComponentPage.GetIndexFromButton(CurrentMainBtn)
|
||||
|
||||
'Assegnazione immagine e testo ai Button
|
||||
Dim nCount As Integer = GetPrivateProfileInt(CurrentMainBtn.Name, "Count", 0, m_MainWindow.GetIniFile())
|
||||
Dim nCount As Integer = GetPrivateProfileInt(m_sMainCompoName, "Count", 0, m_MainWindow.GetIniFile())
|
||||
ClearButton(nCount)
|
||||
For index As Integer = 1 To nCount
|
||||
Dim CustomThickness As Thickness = ThicknessConverter.ConvertFromString("0")
|
||||
Dim nCompoName As Integer = GetPrivateProfileInt(CurrentMainBtn.Name, "Compo" & index, 0, m_MainWindow.GetIniFile())
|
||||
Dim nCompoName As Integer = GetPrivateProfileInt(m_sMainCompoName, "Compo" & index, 0, m_MainWindow.GetIniFile())
|
||||
Dim sCompo As String = ""
|
||||
Dim sCompoImage As String = ""
|
||||
m_MainComponentPage.GetPrivateProfileCompo(CurrentMainBtn.Name, "Compo" & index, nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
m_MainComponentPage.GetPrivateProfileCompo(m_sMainCompoName, "Compo" & index, nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
Dim sCompoImageSource As ImageSource
|
||||
|
||||
'verifico presenza immagine e la aggiungo
|
||||
@@ -87,28 +95,28 @@ Public Class SecondaryComponentPageUC
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GetButton(ByVal nInd As Integer) As Button
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return Compo1
|
||||
Case 2
|
||||
Return Compo2
|
||||
Case 3
|
||||
Return Compo3
|
||||
Case 4
|
||||
Return Compo4
|
||||
Case 5
|
||||
Return Compo5
|
||||
Case 6
|
||||
Return Compo6
|
||||
Case 7
|
||||
Return Compo7
|
||||
Case 8
|
||||
Return Compo8
|
||||
Case Else
|
||||
Return Compo9
|
||||
End Select
|
||||
End Function
|
||||
Private Function GetButton(ByVal nInd As Integer) As Button
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return Compo1
|
||||
Case 2
|
||||
Return Compo2
|
||||
Case 3
|
||||
Return Compo3
|
||||
Case 4
|
||||
Return Compo4
|
||||
Case 5
|
||||
Return Compo5
|
||||
Case 6
|
||||
Return Compo6
|
||||
Case 7
|
||||
Return Compo7
|
||||
Case 8
|
||||
Return Compo8
|
||||
Case Else
|
||||
Return Compo9
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetLabel(ByVal nInd As Integer) As TextBlock
|
||||
Select Case nInd
|
||||
@@ -133,84 +141,86 @@ Public Class SecondaryComponentPageUC
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetImage(ByVal nInd As Integer) As Image
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return ImageCompo1
|
||||
Case 2
|
||||
Return ImageCompo2
|
||||
Case 3
|
||||
Return ImageCompo3
|
||||
Case 4
|
||||
Return ImageCompo4
|
||||
Case 5
|
||||
Return ImageCompo5
|
||||
Case 6
|
||||
Return ImageCompo6
|
||||
Case 7
|
||||
Return ImageCompo7
|
||||
Case 8
|
||||
Return ImageCompo8
|
||||
Case Else
|
||||
Return ImageCompo9
|
||||
End Select
|
||||
End Function
|
||||
Private Function GetImage(ByVal nInd As Integer) As Image
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return ImageCompo1
|
||||
Case 2
|
||||
Return ImageCompo2
|
||||
Case 3
|
||||
Return ImageCompo3
|
||||
Case 4
|
||||
Return ImageCompo4
|
||||
Case 5
|
||||
Return ImageCompo5
|
||||
Case 6
|
||||
Return ImageCompo6
|
||||
Case 7
|
||||
Return ImageCompo7
|
||||
Case 8
|
||||
Return ImageCompo8
|
||||
Case Else
|
||||
Return ImageCompo9
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetButtonNumber(ByVal nInd As String) As Integer
|
||||
Select Case nInd
|
||||
Case "Compo1"
|
||||
Return 1
|
||||
Case "Compo2"
|
||||
Return 2
|
||||
Case "Compo3"
|
||||
Return 3
|
||||
Case "Compo4"
|
||||
Return 4
|
||||
Case "Compo5"
|
||||
Return 5
|
||||
Case "Compo6"
|
||||
Return 6
|
||||
Case "Compo7"
|
||||
Return 7
|
||||
Case "Compo8"
|
||||
Return 8
|
||||
Case Else
|
||||
Return 9
|
||||
End Select
|
||||
End Function
|
||||
Private Function GetButtonNumber(ByVal nInd As String) As Integer
|
||||
Select Case nInd
|
||||
Case "Compo1"
|
||||
Return 1
|
||||
Case "Compo2"
|
||||
Return 2
|
||||
Case "Compo3"
|
||||
Return 3
|
||||
Case "Compo4"
|
||||
Return 4
|
||||
Case "Compo5"
|
||||
Return 5
|
||||
Case "Compo6"
|
||||
Return 6
|
||||
Case "Compo7"
|
||||
Return 7
|
||||
Case "Compo8"
|
||||
Return 8
|
||||
Case Else
|
||||
Return 9
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub ClearButton(nCount As Integer)
|
||||
For index As Integer = 1 To nCount + 1
|
||||
Private Sub ClearButton(nCount As Integer)
|
||||
For index As Integer = 1 To nCount + 1
|
||||
GetLabel(index).Text = String.Empty
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
For index As Integer = nCount + 1 To 9
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
For index As Integer = nCount + 1 To 9
|
||||
GetLabel(index).Text = String.Empty
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
End Sub
|
||||
GetImage(index).Source = Nothing
|
||||
GetButton(index).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub Compo_Click(sender As Object, e As RoutedEventArgs) Handles Compo1.Click, Compo2.Click, Compo3.Click, Compo4.Click, Compo5.Click, Compo6.Click, Compo7.Click, Compo8.Click, Compo9.Click
|
||||
Dim CurrentBtn As Button = e.Source
|
||||
Dim nCompoName As Integer
|
||||
Dim sCompo As String = String.Empty
|
||||
Dim sCompoImage As String = String.Empty
|
||||
m_MainComponentPage.GetPrivateProfileCompo(m_MainComponentPage.CurrentBtn.Name, "Compo" & GetButtonNumber(CurrentBtn.Name), nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
Private Sub Compo_Click(sender As Object, e As RoutedEventArgs) Handles Compo1.Click, Compo2.Click, Compo3.Click, Compo4.Click, Compo5.Click, Compo6.Click, Compo7.Click, Compo8.Click, Compo9.Click
|
||||
Dim CurrentBtn As Button = e.Source
|
||||
Dim nCompoName As Integer
|
||||
Dim sCompo As String = String.Empty
|
||||
Dim sCompoImage As String = String.Empty
|
||||
m_MainComponentPage.GetPrivateProfileCompo(m_sMainCompoName, "Compo" & GetButtonNumber(CurrentBtn.Name), nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
' Carico componente
|
||||
m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo)
|
||||
m_MainWindow.m_DrawPageUC.VariablesCompoGrid.Visibility = Windows.Visibility.Visible
|
||||
|
||||
End Sub
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
' Carico componente
|
||||
m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo)
|
||||
m_sCurrCompo = "Compo" & GetButtonNumber(CurrentBtn.Name)
|
||||
m_MainWindow.m_DrawPageUC.VariablesCompoGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.PartNumberGrd.Visibility = Windows.Visibility.Visible
|
||||
|
||||
Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.MainComponent
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.MainComponent
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||