OmagVIEW :

- modifiche varie.
This commit is contained in:
Dario Sassi
2016-06-20 17:05:16 +00:00
parent 7e67f84aaa
commit 721a05f51a
12 changed files with 522 additions and 152 deletions
+7 -4
View File
@@ -22,9 +22,10 @@
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="1" Grid.Row="1">
@@ -45,11 +46,13 @@
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="MachineLbl" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="ProjectLbl" Grid.Column="1" Grid.Row="7" HorizontalAlignment="Center"
<TextBlock Name="ProjIndexLbl" Grid.Column="1" Grid.Row="7" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="CopyrightLbl" Grid.Column="1" Grid.Row="8" HorizontalAlignment="Center"
<TextBlock Name="ProjPathLbl" Grid.Column="1" Grid.Row="8" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="CopyrightLbl" Grid.Column="1" Grid.Row="9" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="15" />
<Button Name="ExitBtn" Grid.Column="1" Grid.Row="10" IsCancel="True"
<Button Name="ExitBtn" Grid.Column="1" Grid.Row="11" IsCancel="True"
Style="{StaticResource OmagCut_WindowGrayTextButton}" Margin="1,0"/>
</Grid>
+9 -3
View File
@@ -32,11 +32,17 @@ Public Class AboutBoxWD
Else
MachineLbl.Text = "Machine : ---"
End If
Dim nProjInd As Integer = 0
If EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_PROJINDEX, nProjInd) Then
ProjIndexLbl.Text = "Project : " & nProjInd.ToString()
Else
ProjIndexLbl.Text = "Project : ---"
End If
Dim sFile As String = String.Empty
If EgtGetCurrFilePath(sFile) Then
ProjectLbl.Text = "Project : " & sFile
Else
ProjectLbl.Text = "Project : ---"
Dim CompactPath As New Text.StringBuilder(260)
PathCompactPathEx(CompactPath, sFile, 44, 0)
ProjPathLbl.Text = "(" & CompactPath.ToString() & ")"
End If
ExitBtn.Content = EgtMsg(MSG_MISSINGKEYWD + 4) 'Ok
End Sub
+27
View File
@@ -33,10 +33,37 @@ Module ConstGen
Public Const TEMP_DIR As String = "Temp"
' Sottodirettorio di default per le macchine
Public Const MACHINES_DFL_DIR As String = "Machines"
' Sottodirettorio di default per progetti
Public Const PROJ_DFL_DIR As String = "Data"
' Nome file corrente
Public Const CURR_PROJ_NAME As String = "CurrProj.nge"
Public Const CURR_PROJ_NEW As String = "CurrProj.new"
Public Const CURR_PROJ_LOCK As String = "CurrProj.lck"
Public Const CURR_PROJ_EPL As String = "CurrProj.epl"
' Costanti per lavorazioni
Public Const MACH_GROUP As String = "Mach01"
Public Const MAIN_TAB As String = "MainTab"
Public Const SECOND_TAB As String = "2ndTab"
' Nome della superficie del grezzo
Public Const NAME_RAW_SOLID As String = "RawSolid"
' Contrassegno di progetto OmagCut
Public Const NAME_PROJMARK As String = "OmagCut"
' Info per indice progetto
Public Const INFO_PROJINDEX As String = "ProjIndex"
' Info per materiale progetto
Public Const INFO_PROJMAT As String = "ProjMat"
' Nome layer delle regioni
Public Const NAME_REGION As String = "Region"
' Nome layer preview
Public Const NAME_PREVIEW As String = "PV"
' Info per stato pezzo
Public Const INFO_PARTOK As String = "POK"
' Info in pezzo con suo nome in Csv
Public Const INFO_CSV_PART As String = "CsvPart"
End Module
+2
View File
@@ -22,6 +22,7 @@ Module ConstIni
Public Const K_MESSAGES As String = "Messages"
Public Const K_WINPLACE As String = "WinPlace"
Public Const K_MMUNITS As String = "MmUnits"
Public Const K_PROJDIR As String = "ProjDir"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
@@ -52,6 +53,7 @@ Module ConstIni
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
Public Const K_ZOOMWIN As String = "ZoomWin"
Public Const K_DISTLINE As String = "DistLine"
Public Const K_TOPVIEWROTSTEP As String = "TopViewRotStep"
Public Const S_GRID As String = "Grid"
Public Const K_SHOWGRID As String = "ShowGrid"
+20 -16
View File
@@ -5,18 +5,12 @@
Title="MainWindow" Height="1024" Width="1280" ResizeMode="NoResize" WindowStyle="None"
FontFamily="./Resources/Fonts/#Century Gothic"
Icon="Resources/LogoOmag.jpg">
<!-- Chiamata al Dictionary -->
<!--<Window.Resources>
<ResourceDictionary Source="OmagVIEWDictionary.xaml" />
</Window.Resources>-->
<!-- ** Definizione della Grid della MainWindow ** -->
<Grid Name="MainWindowGrid" Background="{StaticResource OmagCut_Gray}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="11*"/>
</Grid.RowDefinitions>
<!-- ** Definizione della Grid della Row 0 (Barra superiore) ** -->
@@ -39,9 +33,9 @@
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ToggleButton Name="OptionsBtn" Grid.Column="5" Style="{StaticResource OmagCut_BlueIconToggleButton}">
<Button Name="OptionsBtn" Grid.Column="5" Style="{StaticResource OmagCut_BlueIconButton}">
<Image Source="Resources/Options.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</ToggleButton>
</Button>
</Grid>
@@ -58,14 +52,24 @@
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button Name="OkPartBtn" Grid.Row="0"/>
<Button Name="RuinedPartBtn" Grid.Row="1"/>
<Button Name="LabelBtn" Grid.Row="2"/>
<Button Name="OkAllBtn" Grid.Row="0" Style="{StaticResource OmagCut_GreenTextButton}"
FontSize="36"/>
<Button Name="OkPartBtn" Grid.Row="1" Style="{StaticResource OmagCut_GreenTextButton}"
FontSize="36"/>
<Button Name="RuinedPartBtn" Grid.Row="2" Style="{StaticResource OmagCut_RedTextButton}"
FontSize="36"/>
<Button Name="LabelBtn" Grid.Row="3" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="36"/>
<Button Name="ConfirmBtn" Grid.Row="4" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="36"/>
</Grid>
</Grid>
+261 -54
View File
@@ -9,24 +9,23 @@ Class MainWindow
' Mutex per avere una sola istanza del programma in esecuzione
Private m_objMutex As New Mutex
Friend m_OptionsPageUC As OptionsPageUC
' Dichiarazione variabili direttori
' Pagine e bottoni
Private m_OptionsPageUC As OptionsPageUC
Private m_SceneButtons As SceneButtonsUC
' Variabili direttori
Private m_sDataRoot As String = String.Empty
Private m_sConfigDir As String = String.Empty
Private m_sTempDir As String = String.Empty
Private m_sMachinesRoot As String = String.Empty
Private m_sProjDir As String = String.Empty
Private m_sIniFile As String = String.Empty
Private m_nDebug As Integer = 0
'Dichiarazione variabile contenente la lingua corrente
' Variabile con la lingua corrente
Friend m_CurrLanguage As Language
'Dichiarazione lista delle lingue disponibili e lingua corrente
' Lista delle lingue disponibili e lingua corrente
Friend m_LanguagesList As New List(Of Language)
' Macchina corrente
Private m_sCurrMachine As String = String.Empty
' Opzioni abilitate dalla licenza attiva associata alla chiave
Private m_nKeyOptions As UInteger
Friend Enum KEY_OPT As UInteger
@@ -39,17 +38,14 @@ Class MainWindow
ENABLE_MILL = 64
PROCUCTION_LINE = 128
End Enum
' Dichiarazione Scene
' Scene
Friend WithEvents CurrentProjectScene As New Scene
Private CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
Private m_bFirst As Boolean = True
' Dichiarazione delle Page UserControl
Friend m_SceneButtons As SceneButtonsUC
Friend m_nTopViewRotStep As Integer = 0
' Timer per aggiornamento interfaccia
Private m_IdleTimer As New DispatcherTimer(DispatcherPriority.ApplicationIdle)
' Lista dei pezzi attivi
Private m_vParts As New List(Of Integer)
Public Function GetIniFile() As String
Return m_sIniFile
@@ -63,6 +59,10 @@ Class MainWindow
Return m_sMachinesRoot
End Function
Public Function GetProjectDir() As String
Return m_sProjDir
End Function
Public Function GetCurrMachine() As String
Return m_sCurrMachine
End Function
@@ -95,6 +95,10 @@ Class MainWindow
End If
' Recupero nome macchina corrente
GetPrivateProfileString(S_MACH, K_CURRMACH, "", m_sCurrMachine, m_sIniFile)
' Impostazione direttorio per progetto corrente
If GetPrivateProfileString(S_GENERAL, K_PROJDIR, "", m_sProjDir, m_sIniFile) = 0 Then
m_sProjDir = m_sDataRoot & "\" & PROJ_DFL_DIR
End If
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_sIniFile)
@@ -168,24 +172,24 @@ Class MainWindow
WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal)
' Inizializzazione della libreria EgtWPFLib
EgtWPFInit()
' Creazione delle Page UserControl
m_OptionsPageUC = New OptionsPageUC
' Posizionemento nella griglia delle Page UserControl
m_OptionsPageUC.SetValue(Grid.ColumnProperty, 0)
m_OptionsPageUC.SetValue(Grid.RowProperty, 1)
' Disabilita la possibilità di imitare il click del tasto destro del mouse tenendo premuto il dito sul touch
' NB: Se abilitato impedisce di utilizzare lo stato Pressed dei Button che quindi non si evidenziano quando premuti
Stylus.SetIsPressAndHoldEnabled(Me, False)
'Assegnazione scena all'host e posizionamento nella PlacePageGrid
CurrentProjectSceneHost.Child = CurrentProjectScene
CurrentProjectSceneHost.SetValue(Grid.ColumnProperty, 1)
CurrentProjectSceneHost.SetValue(Grid.RowProperty, 1)
Me.SceneGrid.Children.Add(CurrentProjectSceneHost)
'Creazione delle Page UserControl
m_SceneButtons = New SceneButtonsUC
' Messaggi sui bottoni
OkAllBtn.Content = EgtMsg(91301) 'Pezzi Tutti Validi
OkPartBtn.Content = EgtMsg(91302) 'Pezzo Valido
RuinedPartBtn.Content = EgtMsg(91303) 'Pezzo Rovinato
LabelBtn.Content = EgtMsg(91304) 'Stampa Etichetta
ConfirmBtn.Content = EgtMsg(91305) 'Conferma
' Abilitazione stampa etichetta
LabelBtn.IsEnabled = False
' Imposto OnIdle
AddHandler m_IdleTimer.Tick, AddressOf OnIdle
End Sub
@@ -266,14 +270,25 @@ Class MainWindow
Dim MissingKeyWnd As New EgtMsgBox(Me, EgtMsg(MSG_MISSINGKEYWD + 1), EgtMsg(MSG_MISSINGKEYWD + 2) & " " & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
Me.Close()
End If
' Leggo angolo rotazione vista top
m_nTopViewRotStep = GetPrivateProfileInt(S_SCENE, K_TOPVIEWROTSTEP, 0, GetIniFile())
' Inizializzo gestore lavorazioni
EgtInitMachMgr(GetMachinesRootDir())
m_bFirst = False
' Carico progetto in scarico
If Not LoadProject(m_sTempDir & "\CurrProj.nge") Then
If LoadProject() Then
' Se c'è file segnalazione nuovo lo trasformo in segnalazione bloccato
If My.Computer.FileSystem.FileExists(m_sProjDir & "\" & CURR_PROJ_NEW) Then
' Rinomino segnalazione nuovo in segnalazione blocco
My.Computer.FileSystem.MoveFile(m_sProjDir & "\" & CURR_PROJ_NEW, m_sProjDir & "\" & CURR_PROJ_LOCK, True)
End If
Else
NewProject()
End If
' Aggiorno la visualizzazione
EgtSetGenericView(0, (m_nTopViewRotStep - 1) * 90)
EgtZoom(ZM.ALL)
' Controllo abilitazione bottone conferma
UpdateConfirmBtn()
' inibisco selezione diretta da Scene
CurrentProjectScene.SetStatusNull()
'Posizionemento nella griglia delle Page UserControl
@@ -284,10 +299,6 @@ Class MainWindow
m_IdleTimer.Start()
End Sub
Private Sub OptionsBtn_Click(sender As Object, e As RoutedEventArgs) Handles OptionsBtn.Click
OptionsBtn.IsChecked = True
End Sub
Private Sub MainWindow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles Me.PreviewMouseDown
End Sub
@@ -303,8 +314,6 @@ Class MainWindow
Not CurrentProjectScene.IsStatusNull() Then
Return
End If
' Identificativo del grezzo
Dim nRawId As Integer = EgtGetFirstRawPart()
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelect(True, True, True, True, True)
Dim nSel As Integer
@@ -313,13 +322,15 @@ Class MainWindow
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = nRawId)
If EgtIsPart(nPartId) Or bPartInTable Then
' Verifico sia un pezzo attivo
Dim bIsPart As Boolean = (m_vParts.FindIndex(Function(x) x = nPartId) >= 0)
If bIsPart Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se già selezionato deseleziono
If nStat = GDB_ST.SEL Then
EgtDeselectObj(nPartId)
' Altrimenti seleziono
Else
EgtDeselectAll()
EgtSelectObj(nPartId)
@@ -331,7 +342,150 @@ Class MainWindow
End While
End Sub
Private Sub OkAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkAllBtn.Click
' Dichiaro validi tutti i pezzi
For Each nPartId As Integer In m_vParts
SetPartStatus(nPartId, True)
Next
' Aggiorno la visualizzazione
EgtDeselectAll()
EgtDraw()
' Controllo abilitazione bottone conferma
UpdateConfirmBtn()
End Sub
Private Sub OkPartBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkPartBtn.Click
If SetPartStatus(EgtGetFirstSelectedObj(), True) Then
' Aggiorno la visualizzazione
EgtDeselectAll()
EgtDraw()
' Controllo abilitazione bottone conferma
UpdateConfirmBtn()
End If
End Sub
Private Sub RuinedPartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RuinedPartBtn.Click
If SetPartStatus(EgtGetFirstSelectedObj(), False) Then
' Aggiorno la visualizzazione
EgtDeselectAll()
EgtDraw()
' Controllo abilitazione bottone conferma
UpdateConfirmBtn()
End If
End Sub
Private Function SetPartStatus(nPartId As Integer, bOk As Boolean) As Boolean
' Verifico esistenza
If nPartId = GDB_ID.NULL Then Return False
' Cerco layer regione
Dim nRegId = EgtGetFirstNameInGroup(nPartId, NAME_REGION)
If nRegId = GDB_ID.NULL Then Return False
' Cerco prima regione nel layer
Dim nId = EgtGetFirstInGroup(nRegId)
While nId <> GDB_ID.NULL
If EgtGetType(nId) = GDB_TY.SRF_FRGN Then
If bOk Then
EgtSetColor(nId, New Color3d(0, 255, 0, 80))
Else
EgtSetColor(nId, New Color3d(255, 0, 0, 80))
End If
Exit While
End If
nId = EgtGetNext(nId)
End While
' Se non trovato, errore
If nId = GDB_ID.NULL Then Return False
' Assegno stato a pezzo
EgtSetInfo(nPartId, INFO_PARTOK, If(bOk, "1", "0"))
Return True
End Function
Private Sub UpdateConfirmBtn()
' Verifico esistano pezzi e siano stati tutti settati
Dim bConfirm As Boolean = (m_vParts.Count() > 0)
For Each nPartId As Integer In m_vParts
If Not EgtExistsInfo(nPartId, INFO_PARTOK) Then
bConfirm = False
End If
Next
' Aggiorno stato bottone
ConfirmBtn.IsEnabled = bConfirm
End Sub
Private Sub ConfirmBtn_Click(sender As Object, e As RoutedEventArgs) Handles ConfirmBtn.Click
' Se esiste file di lock
If My.Computer.FileSystem.FileExists(m_sProjDir & "\" & CURR_PROJ_LOCK) Then
' Emetto stato pezzi
If SavePartStatus() Then
' Rimuovo file di lock
My.Computer.FileSystem.DeleteFile(m_sProjDir & "\" & CURR_PROJ_LOCK)
End If
End If
End Sub
Private Function SavePartStatus() As Boolean
' Gestione file
Try
' Recupero materiale
Dim sMaterial As String = String.Empty
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_PROJMAT, sMaterial)
' Recupero spessore
Dim nSolidRawId As Integer = EgtGetFirstNameInGroup(EgtGetFirstRawPart(), NAME_RAW_SOLID)
Dim b3RawBox As New BBox3d
EgtGetBBoxGlob(nSolidRawId, GDB_BB.STANDARD, b3RawBox)
Dim dThick As Double = If(b3RawBox.IsEmpty(), 0, b3RawBox.DimZ())
' Apro file
Dim Writer As New IO.StreamWriter(m_sProjDir & "\" & CURR_PROJ_EPL, False)
' Intestazione
Writer.WriteLine("[General]")
Writer.WriteLine("Path=*RuinedParts*")
' Ciclo sui pezzi
Dim nI As Integer = 0
For Each nPartId As Integer In m_vParts
Dim nOk As Integer = 1
If EgtGetInfo(nPartId, INFO_PARTOK, nOk) And nOk = 0 Then
nI += 1
Writer.WriteLine("[P" & nI.ToString() & "]")
Dim sName As String = String.Empty
EgtGetInfo(nPartId, INFO_CSV_PART, sName)
Writer.WriteLine("Nam=" & sName)
Writer.WriteLine("Mat=" & sMaterial)
Writer.WriteLine("Act=1")
Writer.WriteLine("Cnt=0")
Writer.WriteLine("Add=1")
Writer.WriteLine("ToN=1")
Dim sCompo As String = String.Empty
EgtGetInfo(nPartId, "CMP", sCompo)
Writer.WriteLine("Rct=" & If(sCompo = "Rettangolo", "1", "0"))
Dim dDimX As Double = 0
EgtGetInfo(nPartId, "V1", dDimX)
Writer.WriteLine("DX=" & DoubleToString(dDimX, 4))
Dim dDimY As Double = 0
EgtGetInfo(nPartId, "V2", dDimY)
Writer.WriteLine("DY=" & DoubleToString(dDimY, 4))
Writer.WriteLine("Th=" & DoubleToString(dThick, 4))
Writer.WriteLine("OIn=" & nI.ToString())
End If
Next
' Terminatore
Writer.WriteLine("[END]")
' Chiudo file
Writer.Close()
Return True
' Errore
Catch ex As Exception
EgtOutLog("Error writing epl file")
Return False
End Try
End Function
Private Sub OptionsBtn_Click(sender As Object, e As RoutedEventArgs) Handles OptionsBtn.Click
Dim OptionPage As New OptionsPageUC(Me)
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs)
' Salvo progetto
SaveProject()
' Uscita
MainWindow_Unloaded(sender, e)
Me.Close()
@@ -365,38 +519,54 @@ Class MainWindow
EgtWPFLib.InitializeEgtWPFLib.EgtPaths_Initialization()
End Sub
' OnIdle
Private Sub OnIdle()
End Sub
' Evento che apre AboutBox quando viene clickato il logo
Private Sub LogoBrd_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles LogoBrd.MouseDown
Dim AboutBox As New AboutBoxWD(Me)
End Sub
Private Function LoadProject(ByVal sPath As String) As Boolean
' OnIdle
Private Sub OnIdle()
' Se non c'è segnalazione di nuovo progetto, esco
If Not My.Computer.FileSystem.FileExists(m_sProjDir & "\" & CURR_PROJ_NEW) Then Return
' Carico nuovo progetto
LoadProject()
' Rinomino segnalazione nuovo in segnalazione blocco
My.Computer.FileSystem.MoveFile(m_sProjDir & "\" & CURR_PROJ_NEW, m_sProjDir & "\" & CURR_PROJ_LOCK, True)
' Aggiorno la visualizzazione
EgtSetGenericView(0, (m_nTopViewRotStep - 1) * 90)
EgtZoom(ZM.ALL)
' Controllo abilitazione bottone conferma
UpdateConfirmBtn()
End Sub
Private Function LoadProject() As Boolean
' Reset elenco pezzi
m_vParts.Clear()
' Carico il file
If Not EgtOpenFile(sPath) Then
Return False
End If
' Recupero il gruppo di lavoro del file
Dim nMachGrpId As Integer = EgtGetFirstMachGroup()
If nMachGrpId = GDB_ID.NULL Then
Return False
End If
' Carico il gruppo e verifico che la sua macchina sia quella corrente
Dim sFileMachine As String = String.Empty
If Not EgtSetCurrMachGroup(nMachGrpId) Then
EgtGetInfo(nMachGrpId, "Machine", sFileMachine)
Else
EgtGetCurrMachineName(sFileMachine)
End If
If Not EgtOpenFile(m_sProjDir & "\" & CURR_PROJ_NAME) Then Return False
' Rendo corrente il primo (e unico gruppo di lavoro)
If Not EgtSetCurrMachGroup(EgtGetFirstMachGroup()) Then Return False
' Visualizzo solo la tavola della macchina
EgtShowOnlyTable(True)
' Attivo ultima fase di lavorazione
EgtSetCurrPhase(EgtGetPhaseCount())
' Nascondo lavorazioni
HideAllMachinings()
' Recupero elenco dei pezzi attivi nella fase
MakePartList()
' Nascondo preview lavorazioni nei pezzi
For Each nPartId As Integer In m_vParts
Dim nPV = EgtGetFirstNameInGroup(nPartId, NAME_PREVIEW)
If nPV <> GDB_ID.NULL Then
EgtSetStatus(nPV, GDB_ST.OFF)
End If
Next
Return True
End Function
Friend Function NewProject() As Boolean
Private Function NewProject() As Boolean
' Reset elenco pezzi
m_vParts.Clear()
' Imposto il nuovo progetto
EgtNewFile()
' Recupero nome macchina corrente
@@ -414,4 +584,41 @@ Class MainWindow
Return True
End Function
Private Function SaveProject() As Boolean
' Verifico non sia progetto vuoto
If m_vParts.Count() = 0 Then Return True
' Salvo il file
If Not EgtSaveFile(m_sProjDir & "\" & CURR_PROJ_NAME, NGE.CMPTEXT) Then Return False
Return True
End Function
Private Function HideAllMachinings() As Boolean
Dim nId As Integer = EgtGetFirstOperation()
While nId <> GDB_ID.NULL
If EgtGetOperationType(nId) <> MCH_OY.DISP Then
EgtSetOperationStatus(nId, False)
End If
nId = EgtGetNextOperation(nId)
End While
Return True
End Function
Private Function MakePartList() As Boolean
' Ciclo su tutti i grezzi dell'ultima fase
Dim nLastPhase = EgtGetPhaseCount()
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawId, nLastPhase) Then
' Ciclo su tutti i pezzi del grezzo
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
While nPartId <> GDB_ID.NULL
m_vParts.Add(nPartId)
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
End If
nRawId = EgtGetNextRawPart(nRawId)
End While
Return True
End Function
End Class
+5 -6
View File
@@ -191,22 +191,21 @@
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<AppDesigner Include="My Project\" />
<Resource Include="Resources\Fonts\gothic.ttf" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\GenericView.png" />
<Resource Include="Resources\LogoOmag.jpg" />
<Resource Include="Resources\LookFromTOP.png" />
<Resource Include="Resources\Options.png" />
<Resource Include="Resources\Pan.png" />
<Resource Include="Resources\V.png" />
<Resource Include="Resources\X.png" />
<Resource Include="Resources\ZoomAll.png" />
<Resource Include="Resources\ZoomIn.png" />
<Resource Include="Resources\ZoomOut.png" />
<Resource Include="Resources\ZoomWin.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\LogoOmag.jpg" />
<Resource Include="Resources\Options.png" />
<Resource Include="Resources\V.png" />
<Resource Include="Resources\X.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagVIEW\OmagVIEWR32.exe
+40
View File
@@ -262,6 +262,46 @@
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Style>
<!--GreenTextOmagCutButton-->
<Style x:Key="OmagCut_GreenTextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource OmagCut_Button_Wrap}">
<Setter Property="Background" Value="{StaticResource OmagCut_Green}"/>
<Setter Property="BorderBrush" Value="{StaticResource OmagCut_Blue}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource OmagCut_Green}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="OpacityMask" Value="#33FF0000"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FFF4F4F4"/>
<Setter Property="BorderBrush" Value="#FFADB2B5"/>
<Setter Property="TextElement.Foreground" Value="#FF838383"/>
</Trigger>
</Style.Triggers>
</Style>
<!--RedTextOmagCutButton-->
<Style x:Key="OmagCut_RedTextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource OmagCut_Button_Wrap}">
<Setter Property="Background" Value="{StaticResource OmagCut_Red}"/>
<Setter Property="BorderBrush" Value="{StaticResource OmagCut_Blue}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource OmagCut_Red}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="OpacityMask" Value="#33FF0000"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FFF4F4F4"/>
<Setter Property="BorderBrush" Value="#FFADB2B5"/>
<Setter Property="TextElement.Foreground" Value="#FF838383"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<!--CheckBox-->
+117 -64
View File
@@ -1,76 +1,129 @@
<UserControl x:Class="OptionsPageUC"
<Window x:Class="OptionsPageUC"
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"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="853.3" d:DesignWidth="1280">
FontFamily="./Resources/Fonts/#Century Gothic"
Height="682.4" Width="511.8" ResizeMode="NoResize"
ShowInTaskbar="False" AllowsTransparency="True" WindowStyle="None"
Background="Transparent">
<!-- Definizione della OptionsPage -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="0.75*"/>
<RowDefinition Height="7.5*"/>
</Grid.RowDefinitions>
<Border Style="{StaticResource OmagCut_WindowBorder}">
<GroupBox Name="LanguageGpBx" Grid.RowSpan="2" Style="{StaticResource OmagCut_GroupBox}">
<Grid >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="2.25*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<TextBlock Name="OptTitle" Grid.Column="1" Grid.Row="0"
FontSize="{StaticResource FontSize_UpperCaseCharacter}" HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<GroupBox Name="LanguageGpBx" Grid.Column="1" Grid.Row="2" Style="{StaticResource OmagCut_GroupBox}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ComboBox Name="LanguageCmBx" Grid.Column="1" Grid.Row="1" MinWidth="49" Height="40">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding LanguageName}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Name="LanguageMsgTxBl" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3"
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}" />
</Grid>
</GroupBox>
<GroupBox Name="UnitsOfMeasureGpBx" Grid.Column="1" Grid.Row="4" Style="{StaticResource OmagCut_GroupBox}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<ComboBox Name="UnitsOfMeasureCmBx" Grid.Column="1" Grid.Row="1" Height="40">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</GroupBox>
<GroupBox Name="ViewRotGpBx" Grid.Column="1" Grid.Row="6" Style="{StaticResource OmagCut_GroupBox}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<ComboBox Name="ViewRotCmBx" Grid.Column="1" Grid.Row="1" Height="40">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</GroupBox>
<Grid Grid.Column="1" Grid.Row="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ComboBox Name="LanguageCmBx" Grid.Column="1" Grid.Row="1" MinWidth="49" Height="40">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding LanguageName}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Name="LanguageMsgTxBl" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3"
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}" />
<Button Name="OkBtn" Grid.Column="1" IsCancel="True" Style="{StaticResource OmagCut_GradientBlueIconButton}">
<Image Source="Resources/V.png" Width="65" Height="65" HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Button>
</Grid>
</Grid>
</GroupBox>
</Border>
<GroupBox Name="UnitsOfMeasureGpBx" Grid.Column="1" Style="{StaticResource OmagCut_GroupBox}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<ComboBox Name="UnitsOfMeasureCmBx" Grid.Column="1" Grid.Row="1" Height="40">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</GroupBox>
</Grid>
</UserControl>
</Window>
+33 -4
View File
@@ -6,12 +6,29 @@ Public Class OptionsPageUC
Private UnitsList() As String = {"inch", "mm"}
Private ViewRotsList() As String = {"0", "90", "180", "270"}
Sub New(Owner As Window)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Owner = Owner
Me.Top = Owner.Top + (Owner.Height / 2 - Me.Height / 2)
Me.Left = Owner.Left + (Owner.Width / 2 - Me.Width / 2)
Me.ShowDialog()
End Sub
Private Sub OptionsPageUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Associazione della lista linguaggi alla combobox
LanguageCmBx.ItemsSource = m_MainWindow.m_LanguagesList
' Associazione della lista unità di misura alla combobox
UnitsOfMeasureCmBx.ItemsSource = UnitsList
' Associazione della lista rotazioni alla combobox
ViewRotCmBx.ItemsSource = ViewRotsList
' Imposto la lingua corrente
LanguageCmBx.SelectedItem = m_MainWindow.m_CurrLanguage
@@ -19,10 +36,15 @@ Public Class OptionsPageUC
' Imposto l'unità di misura corrente
UnitsOfMeasureCmBx.SelectedIndex = If(EgtUiUnitsAreMM(), 1, 0)
' Imposto la rotazione corrente
ViewRotCmBx.SelectedIndex = m_MainWindow.m_nTopViewRotStep
' Messaggi
LanguageGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 1)
LanguageMsgTxBl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 2)
UnitsOfMeasureGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 3)
OptTitle.Text = EgtMsg(MSG_OMAGCUT + 6) ' OPZIONI
LanguageGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 1) ' Lingua
LanguageMsgTxBl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 2) ' La nuova lingua diventerà corr...
UnitsOfMeasureGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 3) ' Unità di misura
ViewRotGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 4) ' Rotazione vista
End Sub
Private Sub LanguageCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles LanguageCmBx.SelectionChanged
@@ -33,8 +55,15 @@ Public Class OptionsPageUC
Private Sub UnitsOfMeasureCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles UnitsOfMeasureCmBx.SelectionChanged
Dim bMM As Boolean = (UnitsOfMeasureCmBx.SelectedIndex <> 0)
EgtSetUiUnits(bMM)
'm_MainWindow.m_CurrentProjectPageUC.UpdateHeightTxBx()
WritePrivateProfileString(S_GENERAL, K_MMUNITS, If(bMM, 1, 0), m_MainWindow.GetIniFile())
End Sub
Private Sub ViewRotCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles ViewRotCmBx.SelectionChanged
m_MainWindow.m_nTopViewRotStep = ViewRotCmBx.SelectedIndex
WritePrivateProfileString(S_SCENE, K_TOPVIEWROTSTEP, m_MainWindow.m_nTopViewRotStep.ToString(), m_MainWindow.GetIniFile())
' aggiorno visualizzazione
EgtSetGenericView(0, (m_MainWindow.m_nTopViewRotStep - 1) * 90)
EgtZoom(ZM.ALL)
End Sub
End Class
Binary file not shown.
+1 -1
View File
@@ -42,7 +42,7 @@ Public Class SceneButtonsUC
End Sub
Private Sub TopViewBtn_Click(sender As Object, e As RoutedEventArgs) Handles TopViewBtn.Click
EgtSetView(VT.TOP)
EgtSetGenericView(0, (m_MainWindow.m_nTopViewRotStep - 1) * 90)
End Sub
Private Function GetCurrScene() As EgtUILib.Scene