OmagCUT 1.9e2 :

- aggiunta gestione lettura codice a barre di grezzo
- migliorata chiusura programma con gestione di Alt+F4.
This commit is contained in:
Dario Sassi
2018-05-05 15:38:13 +00:00
parent 1690dc392a
commit e282a3cc50
11 changed files with 186 additions and 17 deletions
+56
View File
@@ -0,0 +1,56 @@
<Window x:Class="BarCodeWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
FontFamily="./Resources/Fonts/#Century Gothic"
ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
Title="SaveNameWD" Height="255.9" Width="426.5" ShowInTaskbar="False">
<!--Definizione della pagina di scelta del nome con cui salvare il progetto-->
<Border Style="{StaticResource OmagCut_Border}">
<Grid x:Name="SaveNameGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
</Grid.RowDefinitions>
<TextBlock Name="BarCodeTxbl" Grid.Column="1" Grid.Row="0"
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="BarCodeTxBx" Grid.Column="1" Grid.Row="1"
Style="{StaticResource OmagCut_KeyboardTextBox}"/>
<Grid Name="ButtonsGrid" Grid.Column="1" Grid.Row="3" Grid.RowSpan="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Button Name="OkBtn" Grid.Column="1"
IsDefault="True"
Style="{StaticResource OmagCut_GradientBlueIconButton}">
<Image Source="Resources/V.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="ExitBtn" Grid.Column="3"
IsCancel="True"
Style="{StaticResource OmagCut_GradientBlueIconButton}">
<Image Source="Resources/X.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
</Grid>
</Grid>
</Border>
</Window>
+49
View File
@@ -0,0 +1,49 @@
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib
Public Class BarCodeWD
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Sub New(Owner As Window)
Me.Owner = Owner
InitializeComponent()
End Sub
Private Sub SaveNameWD_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
BarCodeTxbl.Text = EgtMsg(90881) 'Codice a barre
BarCodeTxBx.Focus()
BarCodeTxBx.OpenKeyboard(BarCodeTxBx, BarCodeTxBx)
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
Dim nRawId As Integer = GetCurrentRaw()
If nRawId <> GDB_ID.NULL Then
' Cancello eventuale vecchio BarCode
EgtErase(EgtGetFirstNameInGroup(nRawId, NAME_BARCODE))
' Se definito, inserisco nuovo BarCode
If Not String.IsNullOrWhiteSpace(BarCodeTxBx.Text) Then
Dim ptRawCen As Point3d
GetRawCenter(ptRawCen)
Dim ptRawMin, ptRawMax As Point3d
GetRawBox(ptRawMin, ptRawMax)
Dim ptText As New Point3d(ptRawCen.x, ptRawCen.y, ptRawMax.z)
Dim nText As Integer = EgtCreateTextAdv(nRawId, ptText, 0, BarCodeTxBx.Text, "", 500, False, 50.0, 1, 0, INS_POS.MC, GDB_RT.GLOB)
EgtSetName(nText, NAME_BARCODE)
EgtSetColor(nText, New Color3d(255, 0, 0))
End If
' Aggiorno visualizzazione
EgtDraw()
End If
Close()
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
Close()
End Sub
End Class
+2
View File
@@ -108,6 +108,8 @@ Module ConstGen
Public Const NAME_DAMAGED_REG As String = "DmgReg"
' Nome gruppo contorno grezzo da fotografia
Public Const NAME_RAW_PHOTO_OUTLINE As String = "RawPhotoOutline"
' Nome testo per Barcode
Public Const NAME_BARCODE As String = "BarCode"
' Contrassegno di progetto OmagCut
Public Const NAME_PROJMARK As String = "OmagCut"
+3
View File
@@ -143,6 +143,9 @@
Public Const K_RAWTHICKNESS As String = "RawThickness"
Public Const K_ENABLERAWPROBE As String = "EnableRawProbe"
Public Const S_MACH_BARCODEREADER As String = "BarcodeReader"
Public Const K_ENABLEBCR As String = "EnableBCR"
Public Const S_MACH_MACH As String = "Mach"
Public Const K_CURRSAW As String = "CurrSaw"
Public Const K_CURRDRILL As String = "CurrDrill"
+11 -1
View File
@@ -121,6 +121,9 @@ Public Class CurrentMachine
' Indica se la macchina ha il tastatore della lastra
Private m_HasRawProbe As Boolean = True
' Indica se la macchina ha il lettore di codice a barre
Private m_HasBarCodeReader As Boolean = False
' Tipi di attrezzaggio
Friend Enum MountedToolConfigs As Integer
SAW = 0
@@ -696,13 +699,18 @@ Public Class CurrentMachine
Return False
End Function
Friend ReadOnly Property bHasRawProbe As Boolean
Get
Return m_HasRawProbe
End Get
End Property
Friend ReadOnly Property bHasBarCodeReader As Boolean
Get
Return m_HasBarCodeReader
End Get
End Property
#End Region
Sub New()
@@ -855,6 +863,8 @@ Public Class CurrentMachine
Next
' leggo se la macchina ha il tastatore dello spessore tavola
m_HasRawProbe = (GetPrivateProfileInt(S_MACH_PROBING, K_ENABLERAWPROBE, 1, sMachIniFile) <> 0)
' leggo se la macchina ha il lettore di codice a barre della lastra
m_HasBarCodeReader = (GetPrivateProfileInt(S_MACH_BARCODEREADER, K_ENABLEBCR, 0, sMachIniFile) <> 0)
End Sub
Friend Function IsVacuumMovePossible() As Boolean
+37 -11
View File
@@ -805,8 +805,16 @@ Class MainWindow
Me.WindowState = Windows.WindowState.Minimized
Return
End If
' Lancio la chiusura
Me.Close()
End Sub
Private Sub MyClosing(sender As Object, e As CancelEventArgs) Handles Me.Closing
' Verifico se stato simulazione consente di uscire
If m_SimulationPage.GetSimExecuting() Then Return
If m_SimulationPage.GetSimExecuting() Then
e.Cancel = True
Return
End If
' Verifica se progetto corrente da salvare
Dim bPrjToSave As Boolean = False
EgtSetCurrentContext(m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
@@ -819,6 +827,7 @@ Class MainWindow
End If
Select Case SaveCurrProj.m_nPressedBtn
Case 0 ' Annulla
e.Cancel = True
Return
Case 1 ' Si
bPrjToSave = True
@@ -827,17 +836,35 @@ Class MainWindow
End Select
End If
' Uscita da pagina corrente definizione grezzo
If Not ExitFromRaw() Then Return
If Not ExitFromRaw() Then
e.Cancel = True
Return
End If
' Uscita da pagina corrente CSV
If Not ExitFromCsv() Then Return
If Not ExitFromCsv() Then
e.Cancel = True
Return
End If
' Uscita da pagina corrente di split
If Not ExitFromSplit() Then Return
If Not ExitFromSplit() Then
e.Cancel = True
Return
End If
' Uscita da pagina corrente di simulazione
If Not ExitFromSimulation() Then Return
If Not ExitFromSimulation() Then
e.Cancel = True
Return
End If
' Uscita da pagina corrente di macchina
If Not ExitFromMachine() Then Return
If Not ExitFromMachine() Then
e.Cancel = True
Return
End If
' Uscita da pagina tagli diretti
If Not ExitFromDirectCut(sender, e) Then Return
If Not ExitFromDirectCut(sender, Nothing) Then
e.Cancel = True
Return
End If
' Eventuale salvataggio progetto corrente
If bPrjToSave Then
EgtSetCurrentContext(m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
@@ -845,8 +872,7 @@ Class MainWindow
m_CurrentProjectPageUC.SaveProject()
End If
' Uscita
MainWindow_Unloaded(sender, e)
Me.Close()
MainWindowExit()
End Sub
Private Function ExitFromRaw() As Boolean
@@ -925,9 +951,9 @@ Class MainWindow
Return True
End Function
Private Sub MainWindow_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
Private Sub MainWindowExit()
' Chiudo comunicazione con CN
m_CNCommunication.m_CN.Stop_Connection()
If Not IsNothing(m_CNCommunication.m_CN) Then m_CNCommunication.m_CN.Stop_Connection()
' Chiudo il gestore della macchina fotografica
m_Camera.Close()
' Terminazione generale di EgtInterface
+2 -2
View File
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.9.4.2")>
<Assembly: AssemblyFileVersion("1.9.4.2")>
<Assembly: AssemblyVersion("1.9.5.2")>
<Assembly: AssemblyFileVersion("1.9.5.2")>
+10
View File
@@ -271,6 +271,9 @@
<Compile Include="OptionsPageUC.xaml.vb">
<DependentUpon>OptionsPageUC.xaml</DependentUpon>
</Compile>
<Compile Include="BarCodeWD.xaml.vb">
<DependentUpon>BarCodeWD.xaml</DependentUpon>
</Compile>
<Compile Include="SaveNameWD.xaml.vb">
<DependentUpon>SaveNameWD.xaml</DependentUpon>
</Compile>
@@ -463,6 +466,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="BarCodeWD.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SaveNameWD.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -670,6 +677,9 @@
<ItemGroup>
<Resource Include="Resources\Measure.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\BarCode.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe
+9 -3
View File
@@ -157,16 +157,22 @@
<Grid Name="LowerButtonGrid" Grid.Column="1" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="9*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="7*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Name="RawProbingBtn" Grid.Row="3" Style="{StaticResource OmagCut_YellowGradientYellowIconButton}">
<Button Name="RawProbingBtn" Style="{StaticResource OmagCut_YellowGradientYellowIconButton}">
<Image Source="Resources/RawProbe.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="OkBtn" Grid.Column="3" Style="{StaticResource OmagCut_GradientBlueIconButton}">
<Button Name="BarCodeBtn" Grid.Column="2" Style="{StaticResource OmagCut_YellowGradientYellowIconButton}">
<Image Source="Resources/BarCode.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="OkBtn" Grid.Column="5" Style="{StaticResource OmagCut_GradientBlueIconButton}">
<Image Source="Resources/V.png" Width="65" Height="65" HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Button>
+7
View File
@@ -115,6 +115,8 @@ Public Class RawPartPageUC
' Nascondo bottone tastatura lastra se disattivato da file .ini
RawProbingBtn.Visibility = If(m_CurrentMachine.bHasRawProbe, Windows.Visibility.Visible, Windows.Visibility.Collapsed)
' Nascondo bottone lettura codice a barre se disattivato da file .ini
BarCodeBtn.Visibility = If(m_CurrentMachine.bHasBarCodeReader, Windows.Visibility.Visible, Windows.Visibility.Collapsed)
' Imposto i messaggi letti dal file dei messaggi
OutlineBtn.Content = EgtMsg(MSG_RAWPARTPAGEUC + 33) 'Rectangle - Rettangolo
@@ -1430,6 +1432,11 @@ Public Class RawPartPageUC
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
End Sub
Private Sub BarCodeBtn_Click(sender As Object, e As RoutedEventArgs) Handles BarCodeBtn.Click
Dim BarCodeWindow As New BarCodeWD(m_MainWindow)
BarCodeWindow.ShowDialog()
End Sub
Private Sub RawPartPage_Unloaded(sender As Object, e As RoutedEventArgs)
' Rimuovo layer temporaneo per crocette
EgtErase(m_nTempLay)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB