OmagOFFICE :

- Migliorato AboutBox.
- Miglioramenti per compatibilità con nuova versione WPFLib5.
This commit is contained in:
Emmanuele Sassi
2017-11-25 16:55:39 +00:00
parent 573a41c5e1
commit 4c679fbd48
34 changed files with 660 additions and 1268 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="AboutBox" Height="320" Width="300" WindowStyle="None" ResizeMode="NoResize"
ShowInTaskbar="False" Visibility="{Binding AboutBoxVisibility,Mode=OneWay}" WindowStartupLocation="CenterOwner">
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Border BorderThickness="2" BorderBrush="LightBlue">
<Grid >
+1 -1
View File
@@ -193,7 +193,7 @@ Public Class CompoManagerVM
bHasIntCompo = True
End If
' Passo al contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Inserisco il componente nel DB geometrico principale
If bHasIntCompo Then
CompoWindowMap.refCompoWindowVM.MakeCompoInsert(InsNbr, m_PartName)
+1 -1
View File
@@ -310,7 +310,7 @@ Public Class CompoWindowVM
Return False
End If
' Passo al contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
' Elimino eventuali precedenti pezzi vuoti
-2
View File
@@ -151,6 +151,4 @@ Module ConstIni
Public Const K_VEINMA_IMGWIDTH As String = "ImgWidth"
Public Const K_VEINMA_IMGHEIGHT As String = "ImgHeight"
Public Const S_MRUFILES As String = "MruFiles"
End Module
+1 -1
View File
@@ -347,7 +347,7 @@ Public Class DxfImportWindowVM
nId = EgtGetNextPart(nId)
End While
' Passo al contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
' Elimino eventuali precedenti pezzi vuoti
+3 -3
View File
@@ -292,7 +292,7 @@ Public Class VeinMatchingWindow
Dim bSelected As Boolean = False
Dim nOriId As Integer = GDB_ID.NULL
EgtGetInfo(m_nIdToSel, KEY_ORI_ID, nOriId)
If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
Dim nMachGrpId As Integer
If (OmagOFFICEMap.refNestingTabVM.SelectPart(nOriId, False, nMachGrpId)) Then
bSelected = True
@@ -317,7 +317,7 @@ Public Class VeinMatchingWindow
Dim bDeselected As Boolean = False
Dim nOriId As Integer = GDB_ID.NULL
EgtGetInfo(m_nIdToDesel, KEY_ORI_ID, nOriId)
If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
If (OmagOFFICEMap.refNestingTabVM.DeselectPart(nOriId, False)) Then
bDeselected = True
End If
@@ -957,7 +957,7 @@ Friend Module VeinMatching
' Salvo il contesto corrente
Dim nCurrCtx As Integer = EgtGetCurrentContext()
' Recupero il contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Imposto flag di modificato sul progetto principale
EgtSetModified()
' Ripristino il contesto originale
-48
View File
@@ -1,48 +0,0 @@
Imports EgtUILib
Public Class InstrumentPanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
#Region "ToolTip"
Public ReadOnly Property GetDistToolTip As String
Get
Return "Disposition"
End Get
End Property
#End Region ' ToolTip
Private m_GetDistIsChecked As Boolean
Public Property GetDistIsChecked As Boolean
Get
Return m_GetDistIsChecked
End Get
Set(value As Boolean)
If value <> m_GetDistIsChecked Then
m_GetDistIsChecked = value
If value Then
OmagOFFICEMap.refSceneHostV.GetDistanceON()
Else
OmagOFFICEMap.refSceneHostV.GetDistanceOFF()
OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.SetStatusNull()
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
End If
NotifyPropertyChanged("GetDistIsChecked")
End If
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
End Sub
#End Region ' CONSTRUCTOR
End Class
+11
View File
@@ -0,0 +1,11 @@
Imports EgtWPFLib5
Public Class MyInstrumentPanelVM
Inherits InstrumentPanelVM
Public Overrides Function OnPostGetDistIsChecked() As Boolean
OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull()
Return True
End Function
End Class
+6 -15
View File
@@ -17,7 +17,7 @@ Public Class MachinePanelVM
End Property
' Lista delle macchine disponibili
Private m_MachineList As ObservableCollection(Of Machine)
Private m_MachineList As New ObservableCollection(Of Machine)
Public Property MachineList As ObservableCollection(Of Machine)
Get
Return m_MachineList
@@ -37,12 +37,6 @@ Public Class MachinePanelVM
'EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
If EgtSetCurrMachine(value.Name) Then
m_SelectedMachine = value
'IniFile.m_sMachineName = m_SelectedMachine.Name
'IniFile.m_sCurrMachIniFilePath = m_SelectedMachine.MachineDirPath & "\" & m_SelectedMachine.Name & ".ini"
'IniFile.m_sCurrMachToolsDirPath = m_SelectedMachine.MachineDirPath & "\Tools"
'IniFile.m_sCurrMachSetUpDirPath = m_SelectedMachine.MachineDirPath & "\SetUp"
'IniFile.m_sCurrMachScriptsDirPath = m_SelectedMachine.MachineDirPath & "\Scripts"
'UpdateToolAndMachDbParamVisibility()
NotifyPropertyChanged("SelectedMachine")
End If
End If
@@ -114,12 +108,9 @@ Public Class MachinePanelVM
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefMachinePanelVM(Me)
' recupero cartella radice delle macchine
m_sMachinesRoot = OmagOFFICE.refMainWindowVM.MainWindowM.sMachinesRoot
m_sMachinesRoot = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot
' Carica macchine da cartella delle macchine
Dim MachineList As New List(Of Machine)
If Machine.MachineListInit(sMachinesRoot, MachineList) Then 'OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, MachineList) Then
m_MachineList = New ObservableCollection(Of Machine)(MachineList)
End If
Machine.MachineListInit(sMachinesRoot, MachineList)
' Inizializzo valori visibilità parametri Db utensili e lavorazioni
OmagOFFICETMDbParamVisibility.Init()
End Sub
@@ -157,7 +148,7 @@ Public Class MachinePanelVM
MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim ToolDbWindow As New ToolDbWindowV(Application.Current.MainWindow, New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()))
Dim ToolDbWindow As New ToolDbWindowV(Application.Current.MainWindow, New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()))
ToolDbWindow.Height = 640
ToolDbWindow.Width = 1024
ToolDbWindow.ShowDialog()
@@ -196,7 +187,7 @@ Public Class MachinePanelVM
MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim MachDbWindow As New MyMachiningDbWindowV(Application.Current.MainWindow, New MyMachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()))
Dim MachDbWindow As New MyMachiningDbWindowV(Application.Current.MainWindow, New MyMachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()))
MachDbWindow.Height = 614
MachDbWindow.Width = 1024
MachDbWindow.ShowDialog()
@@ -354,7 +345,7 @@ Public Class MachinePanelVM
MachOptionWindow.Height = 546
MachOptionWindow.Width = 546
MachOptionWindow.ShowDialog()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
End Sub
#End Region ' MachOptionsCommand
-2
View File
@@ -107,8 +107,6 @@ Public Class MainWindowM
Private Sub InitializeEgtEnvironment()
'' Abilito drag and drop
'Me.AllowDrop = True
'' Title
'Application.Msn.NotifyColleagues(Application.EMITTITLE)
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
+3 -3
View File
@@ -9,9 +9,9 @@
MinHeight="600" MinWidth="800"
AboutBoxCommand="{Binding AboutBoxCommand}" WindowStyle="None" ResizeMode="NoResize"
CloseCommand="{Binding CloseApplicationCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
<EgtWPFLib5:EgtCustomWindow.TitleUserControl>
<EgtWPFLib5:EgtCustomWindow.TitlePanel>
<OmagOFFICE:TopCommandBarV DataContext="{StaticResource TopCommandBarVM}"/>
</EgtWPFLib5:EgtCustomWindow.TitleUserControl>
</EgtWPFLib5:EgtCustomWindow.TitlePanel>
<!--Pannello principale -->
<DockPanel>
@@ -19,7 +19,7 @@
<!--StatusBar -->
<OmagOFFICE:StatusBarV DataContext="{StaticResource StatusBarVM}"
DockPanel.Dock="Bottom"/>
<!--Controllo che gestisce il progetto corrente -->
<!--Progetto corrente -->
<OmagOFFICE:ProjectV DataContext="{StaticResource ProjectVM}"/>
</DockPanel>
+3 -3
View File
@@ -82,7 +82,7 @@ Public Class MainWindowVM
m_VeinMatchingWnd.Show()
m_VeinMatchingWnd.Hide()
VeinMatching.m_nVeinCtx = m_VeinMatchingWnd.VeinMatchingScene.GetCtx()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
m_VeinMatchingWnd.AdjustPosition()
' Leggo dimensioni immagini esportate
Dim nImgWidth = GetMainPrivateProfileInt(S_VEINMATCHING, K_VEINMA_IMGWIDTH, 1600)
@@ -152,9 +152,9 @@ Public Class MainWindowVM
OmagOFFICEMap.refSimulTabVM.ResetSimulation()
End If
' Imposto contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Gestisco eventuale file corrente modificato
Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostV.Controller.ManageModified()
Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostVM.MainController.ManageModified()
' Se non confermata chiusura, esco
If Not bAllowClose Then Return
' Salvo nome ultimo file (per gestire bene multi istanza)
@@ -3,8 +3,8 @@ Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MachGroupPanelVM
Inherits EgtWPFLib5.EgtMachGroupPanelVM
Public Class MyMachGroupPanelVM
Inherits MachGroupPanelVM
#Region "CONSTRUCTOR"
@@ -54,7 +54,7 @@ Public Class MachGroupPanelVM
End Sub
Public Overrides Function OnPreNewMachGroup() As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
Return True
End Function
@@ -67,7 +67,7 @@ Public Class MachGroupPanelVM
Dim sDefaultSetUpName As String = String.Empty
Dim sCurrMachName As String = String.Empty
EgtGetCurrMachineName(sCurrMachName)
Dim sMachineIniPath As String = OmagOFFICE.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini"
Dim sMachineIniPath As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini"
EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, sMachineIniPath)
' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
If Not String.IsNullOrEmpty(sDefaultSetUpName) Then
@@ -94,7 +94,9 @@ Public Class MachGroupPanelVM
End Function
Public Overrides Function OnPreSetCurrMachGroup() As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Deseleziono tutto in Nesting e nel VeinMatching
OmagOFFICE.refNestingTabVM.DeselectAll(True)
' Deseleziono tutto in Nesting e nel VeinMatching
OmagOFFICE.refNestingTabVM.DeselectAll(True)
Return True
@@ -177,7 +179,7 @@ Public Class MachGroupPanelVM
End Function
Public Overrides Function OnPreRemoveCurrMachGroup() As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Parcheggio tutti i pezzi presenti nella lastra
Dim nPartId As Integer = EgtGetFirstPartInRawPart(GetRawId())
While nPartId <> GDB_ID.NULL
+1 -1
View File
@@ -44,7 +44,7 @@ Public Class MyMachiningDbWindowVM
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
''' </summary>
Public Overrides Sub LoadSelectedMachineMachinings()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
Dim ActiveMachiningsTypes() As MachiningsType = MachineUtility.ReadMachiningFamilies(CurrentMachine.sMachIniFile)
For Each MachiningsType In ActiveMachiningsTypes
Dim FamilyTreeView As New FamilyMachiningTreeViewItem(MachiningsType.Name, MachiningsType.Id, Nothing)
+2 -2
View File
@@ -137,7 +137,7 @@ Public Class MyMachiningTreeViewItem
Public Overrides Sub ReadMachiningParam()
MyBase.ReadMachiningParam()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, SystemNotes)
' Compilo lista materiali
m_MaterialList.Clear()
@@ -168,7 +168,7 @@ Public Class MyMachiningTreeViewItem
Public Overrides Sub WriteMachiningParam()
MyBase.WriteMachiningParam()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
EgtMdbSetCurrMachiningParam(MCH_MP.SYSNOTES, SystemNotes)
End Sub
+460
View File
@@ -0,0 +1,460 @@
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MySceneHostVM
Inherits EgtWPFLib5.SceneHostVM
#Region "CONSTRUCTOR"
Sub New()
MyBase.New()
AddHandler MainController.OnNewProject, AddressOf OnNewProject
AddHandler MainController.OnOpenProject, AddressOf OnOpenProject
AddHandler MainController.OnSavingProject, AddressOf OnSavingProject
AddHandler MainController.OnSavedProject, AddressOf OnSavedProject
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Overrides Sub InitScene()
InitSceneEvents()
' Inizializzazione Scena
PreInitializeScene()
If Not MainScene.Init() Then
EgtOutLog("Error in Project scene creation")
' Box di avviso chiave mancante
MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 2) & Environment.NewLine & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error)
' Chiudo il programma
End
' Verifico abilitazione prodotto
ElseIf Not OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then
MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 5), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error)
' Chiudo il programma
End
Else
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
' Recupero e imposto handle finestra principale
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
EgtSetMainWindowHandle(hMainWnd)
' inizializzo gestore lavorazioni
EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot)
End If
End Sub
Public Overrides Sub InitSceneEvents()
AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene
AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene
AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene
AddHandler MainScene.KeyDown, AddressOf OnKeyDownScene
AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos
AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance
AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
MainScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
MainScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
MainScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
MainScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
MainScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
MainScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
MainController.SetScene(MainScene)
' imposto tipo coordinate
MainScene.SetGridCursorPos(True)
' modo di visualizzazione
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
OmagOFFICEMap.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TXRMAXLINPIX, 16384)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' tipo snap point
MainScene.SetSnapPointType(SP.PT_SKETCH)
End Sub
#End Region ' METHODS
#Region "ProjectManager"
Public Overrides Sub NewProject()
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = MainController.NewProject()
' Eventuale reset VM
If bOk Then
VeinMatching.Clear()
End If
MainScene.SetStatusNull()
End Sub
Public Overrides Sub OpenProject(sFilePath As String)
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = False
If String.IsNullOrEmpty(sFilePath) Then
' Recupero cartella dell'ultimo progetto aperto
Dim sDir As String = MainController.GetCurrFile()
If String.IsNullOrWhiteSpace(sDir) Then
GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir)
End If
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
bOk = MainController.OpenProject(sDir)
Else
bOk = MainController.OpenProject(sFilePath, False)
End If
MainScene.SetStatusNull()
' Eventuale apertura file VM
Dim sFile As String = String.Empty
If bOk AndAlso EgtGetCurrFilePath(sFile) Then
Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme")
VeinMatching.Open(sVmFile)
End If
End Sub
Public Overrides Sub ExportProject()
EgtSetCurrentContext(MainScene.GetCtx())
' Verifico che il progetto sia salvato
If EgtGetModified() Then
MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 1), "", MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return
End If
' Scelta del direttorio di destinazione
Dim sLastExportDir As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, "", sLastExportDir)
Dim DirDlg As New System.Windows.Forms.FolderBrowserDialog
DirDlg.Description = EgtMsg(MSG_TOPCMDBAR + 2) ' Seleziona il direttorio di esportazione
DirDlg.SelectedPath = sLastExportDir
If DirDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return
WriteMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, DirDlg.SelectedPath)
' Eseguo esportazione
If Not ExecExport(DirDlg.SelectedPath) Then
' Errore nell'esportazione
MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 3), "", MessageBoxButton.OK, MessageBoxImage.Error)
End If
EgtSetCurrentContext(MainScene.GetCtx())
End Sub
Private Function ExecExport(sDirDest As String) As Boolean
' Path completa del progetto corrente
Dim sFilePath As String = String.Empty
EgtGetCurrFilePath(sFilePath)
' Preparo la lista dei gruppi di lavoro
Dim vMchGrps As New List(Of Integer)
Dim nGrpId = EgtGetFirstMachGroup()
While nGrpId <> GDB_ID.NULL
vMchGrps.Add(nGrpId)
nGrpId = EgtGetNextMachGroup(nGrpId)
End While
' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto
Dim nCurrCtx As Integer = EgtGetCurrentContext()
Dim nCtx As Integer = EgtInitContext()
EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot)
' Per ogni gruppo di lavoro
For Each nMchGrpId As Integer In vMchGrps
' Carico il progetto
EgtOpenFile(sFilePath)
' Recupero il nome del gruppo
Dim sMchGrp As String = String.Empty
EgtGetMachGroupName(nMchGrpId, sMchGrp)
' Recupero il nome della lastra
Dim sSlabName As String = String.Empty
EgtGetInfo(nMchGrpId, INFO_SLABNAME, sSlabName)
' Creo path del file di salvataggio
Dim sFileDest As String = sDirDest & "\" & Path.GetFileNameWithoutExtension(sFilePath) & "_" & If(String.IsNullOrEmpty(sSlabName), sMchGrp, sSlabName) & ".nge"
' Verifico se al gruppo è associata una foto
Dim nPhotoId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME & sMchGrp)
' Elimino le altre fotografie
Dim nPhId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP))
While nPhId <> GDB_ID.NULL
Dim nNextPhId As Integer = EgtGetNext(nPhId)
If nPhId <> nPhotoId Then
EgtErase(nPhId)
End If
nPhId = nNextPhId
End While
' Sistemo l'eventuale foto del gruppo
If nPhotoId <> GDB_ID.NULL Then
Dim sOriPath As String = String.Empty
EgtGetPhotoPath(nPhotoId, sOriPath)
Dim sNewPath As String = Path.ChangeExtension(sFileDest, Path.GetExtension(sOriPath))
EgtChangePhotoPath(nPhotoId, sNewPath)
File.Copy(sOriPath, sNewPath, True)
EgtSetName(nPhotoId, PHOTO_NAME)
End If
' Elimino gli altri gruppi di lavorazioni
For Each nMGrpId As Integer In vMchGrps
If nMGrpId <> nMchGrpId Then
EgtRemoveMachGroup(nMGrpId)
End If
Next
' Elimino i pezzi che non stanno nel gruppo corrente (sono ancora pezzi dopo averlo attivato)
EgtSetCurrMachGroup(nMchGrpId)
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
Dim nNextPartId As Integer = EgtGetNextPart(nPartId)
EgtErase(nPartId)
nPartId = nNextPartId
End While
EgtResetCurrMachGroup()
' Assegno nome standard OmagCUT al gruppo di lavoro
EgtSetName(nMchGrpId, MACH_GROUP)
' Definisco gruppo marcatore di OmagCUT
Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetName(nMarkId, NAME_PROJMARK)
EgtSetLevel(nMarkId, GDB_LV.SYSTEM)
Dim nReducedCut As Integer = 1
EgtGetInfo(nMchGrpId, INFO_REDUCEDCUT, nReducedCut)
EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut)
Dim nWash As Integer = 1
EgtGetInfo(nMchGrpId, INFO_WASHING, nWash)
EgtSetInfo(nMarkId, INFO_WASHING, nWash)
Dim nOrder As Integer = 0
EgtGetInfo(nMchGrpId, INFO_MACHORDER, nOrder)
EgtSetInfo(nMarkId, INFO_MACHORDER, nOrder)
Dim sMatName As String = String.Empty
EgtGetInfo(nMchGrpId, INFO_PROJMAT, sMatName)
EgtSetInfo(nMarkId, INFO_PROJMAT, sMatName)
' Salvo il file
EgtSaveFile(sFileDest, NGE.CMPTEXT)
Next
' Distruggo il contesto corrente e ripristino quello originale
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nCtx)
Return True
End Function
#End Region ' ProjectManager
#Region "EVENTS"
Private Sub OnNewProject(sender As Object, bOk As Boolean)
OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE"
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro)
If EgtGetMachGroupCount() = 0 Then bOk = False
' Procedo a seconda del risultato
If bOk Then
OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile)
Else
EgtNewFile()
OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE"
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
MainScene.SetStatusNull()
End Sub
Private Sub OnSavingProject(ByVal sender As Object, sFile As String)
' Recupero tutti i file di texture associabili ai gruppi di lavoro del progetto
Dim sDirToSearch As String = Path.GetDirectoryName(sFile)
Dim sFileToSearch As String = Path.GetFileNameWithoutExtension(sFile) & "." & PHOTO_NAME & "*"
Dim vsTxrFile As New List(Of String)
For Each sTxrFile In My.Computer.FileSystem.GetFiles(sDirToSearch, FileIO.SearchOption.SearchTopLevelOnly, sFileToSearch)
vsTxrFile.Add(sTxrFile)
Next
' Rinomino path di eventuali fotografie
Dim nPhotoId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP))
While nPhotoId <> GDB_ID.NULL
' Path originale
Dim sPhoto As String = String.Empty
If EgtGetPhotoPath(nPhotoId, sPhoto) Then
' Nome della foto
Dim sName As String = String.Empty
EgtGetName(nPhotoId, sName)
' Nuova path
Dim sNewPhoto As String = Path.GetDirectoryName(sFile) & "\" &
Path.GetFileNameWithoutExtension(sFile) & "." & sName &
Path.GetExtension(sPhoto)
' Se diverse, eseguo copia
If String.Compare(sPhoto, sNewPhoto, True) <> 0 Then
Try
' Eseguo copia
File.Copy(sPhoto, sNewPhoto, True)
' Notifico a foto il cambio di path
EgtChangePhotoPath(nPhotoId, sNewPhoto)
' Eventuale notifica a VeinMatching del cambio di path
VeinMatching.ChangePhotoPath(sPhoto, sNewPhoto)
Catch ex As Exception
End Try
End If
' Tolgo da lista file texture associabili, se presente
vsTxrFile.Remove(sNewPhoto)
End If
' passo alla successiva
nPhotoId = EgtGetNext(nPhotoId)
End While
' Se rimasti file associabili, li cancello
For Each sTxrFile In vsTxrFile
Try
My.Computer.FileSystem.DeleteFile(sTxrFile)
Catch
End Try
Next
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
' Se salvataggio non riuscito, esco subito
If Not bOk Then
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Return
End If
' Eventuale salvataggio VM
Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme")
VeinMatching.Save(sVmFile)
' Eventuale salvataggio CSV
CsvM.SaveCsvPartList()
' Aggiornamento titolo
OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
' Riabilito visualizzazione pezzi in parcheggio
EstCalc.ShowParkedParts()
' Inserisco nome in MRU
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile)
' Salvo nome ultimo file
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
End Sub
Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or Not MainScene.IsStatusNull() Then Return
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
OmagOFFICEMap.refMachiningTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseMoveScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseMoveScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseUpScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseUpScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs)
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnKeyDownScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
OmagOFFICEMap.refStatusBarVM.SetCurrPos(sCursorPos)
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sDistance)
End Sub
Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean)
Dim BtnColor As Brush
If bUser Then
BtnColor = New SolidColorBrush(SystemColors.ControlColor)
Else
BtnColor = Brushes.Bisque
End If
Select Case nSpType
Case SP.PT_SKETCH
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point
Case SP.PT_GRID
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point
Case SP.PT_END
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point
Case SP.PT_MID
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point
Case SP.CENTER
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center
Case SP.CENTROID
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid
Case SP.PT_NEAR
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point
Case SP.PT_INTERS
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point
Case SP.PT_TANGENT
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point
Case SP.PT_PERPENDICULAR
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point
Case SP.PT_MINDIST
OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point
Case Else
OmagOFFICEMap.refStatusBarVM.SetSnapPointType("---", BtnColor)
End Select
End Sub
#End Region ' EVENTS
End Class
+10 -12
View File
@@ -187,7 +187,8 @@
<Compile Include="EgtStoneLib\VeinMatchingWindow.xaml.vb">
<DependentUpon>VeinMatchingWindow.xaml</DependentUpon>
</Compile>
<Compile Include="MachGroupPanel\MachGroupPanelVM.vb" />
<Compile Include="InstrumentPanel\MyInstrumentPanelVM.vb" />
<Compile Include="MyMachGroupPanel\MachGroupPanelVM.vb" />
<Compile Include="MachinePanel\MachinePanelV.xaml.vb">
<DependentUpon>MachinePanelV.xaml</DependentUpon>
</Compile>
@@ -195,7 +196,6 @@
<Compile Include="InstrumentPanel\InstrumentPanelV.xaml.vb">
<DependentUpon>InstrumentPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="InstrumentPanel\InstrumentPanelVM.vb" />
<Compile Include="MyMachiningDbWindow\MyMachiningDbWindowVM.vb" />
<Compile Include="MyMachiningDbWindow\MyMachiningDbWindowV.xaml.vb">
<DependentUpon>MyMachiningDbWindowV.xaml</DependentUpon>
@@ -205,6 +205,7 @@
</Compile>
<Compile Include="MachOptionWindow\MachOptionWindowVM.vb" />
<Compile Include="MyMachiningDbWindow\MyMachiningTreeView.vb" />
<Compile Include="MySceneHost\MySceneHostVM.vb" />
<Compile Include="MySetUpWindow\MySetUpWindowVM.vb" />
<Compile Include="OptionPanel\MachiningTab\MachiningTabV.xaml.vb">
<DependentUpon>MachiningTabV.xaml</DependentUpon>
@@ -242,10 +243,12 @@
<Compile Include="DxfImportWindow\DxfImportSceneHostV.xaml.vb">
<DependentUpon>DxfImportSceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="SceneHost\SceneHostV.xaml.vb">
<DependentUpon>SceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="ShowPanel\ShowPanelV.xaml.vb">
<DependentUpon>ShowPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="ShowPanel\ShowPanelVM.vb" />
<Compile Include="SideEntityControl\SideEntityControlV.xaml.vb">
<DependentUpon>SideEntityControlV.xaml</DependentUpon>
</Compile>
@@ -260,13 +263,9 @@
<DependentUpon>ProjectV.xaml</DependentUpon>
</Compile>
<Compile Include="Project\ProjectVM.vb" />
<Compile Include="SceneHost\SceneHostV.xaml.vb">
<DependentUpon>SceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="StatusBar\StatusBarV.xaml.vb">
<DependentUpon>StatusBarV.xaml</DependentUpon>
</Compile>
<Compile Include="StatusBar\StatusBarVM.vb" />
<Compile Include="TopCommandBar\TopCommandBarV.xaml.vb">
<DependentUpon>TopCommandBarV.xaml</DependentUpon>
</Compile>
@@ -280,7 +279,6 @@
<Compile Include="ViewPanel\ViewPanelV.xaml.vb">
<DependentUpon>ViewPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="ViewPanel\ViewPanelVM.vb" />
<Page Include="AboutBoxWindow\AboutBoxV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -385,6 +383,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SceneHost\SceneHostV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ShowPanel\ShowPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -401,10 +403,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SceneHost\SceneHostV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="StatusBar\StatusBarV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+25 -25
View File
@@ -248,7 +248,7 @@ Public Class NestingTabVM
End Sub
Friend Function SelectPart(nPartId As Integer, bNotifyVM As Boolean, ByRef nOtherMgrpId As Integer) As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Determino se pezzo in tavola, in parcheggio o in altro gruppo
Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = EstCalc.GetRawId())
Dim bPartFree As Boolean = PartIsFree(nPartId)
@@ -275,7 +275,7 @@ Public Class NestingTabVM
End Function
Friend Function DeselectPart(nPartId As Integer, bNotifyVM As Boolean) As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Eseguo la deselezione
EgtDeselectObj(nPartId)
' Eventuale aggiornamento VeinMatching
@@ -288,7 +288,7 @@ Public Class NestingTabVM
End Function
Friend Function DeselectAllParts(bNotifyVM As Boolean) As Boolean
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Eseguo
EgtDeselectAll()
' Eventuale notifica al VeinMatching
@@ -326,7 +326,7 @@ Public Class NestingTabVM
Public Sub Draw(ByVal param As Object)
Dim CompoWindow As New CompoWindowV(Application.Current.MainWindow, New CompoWindowVM)
CompoWindow.ShowDialog()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
End Sub
#End Region ' DrawCommand
@@ -345,7 +345,7 @@ Public Class NestingTabVM
Public Sub ImportDxf(ByVal param As Object)
Dim DxfImportWindow As New DxfImportWindowV(Application.Current.MainWindow, New DxfImportWindowVM)
DxfImportWindow.ShowDialog()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
End Sub
#End Region ' ImportDxfCommand
@@ -362,7 +362,7 @@ Public Class NestingTabVM
End Property
Public Sub Up(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
@@ -404,7 +404,7 @@ Public Class NestingTabVM
End Property
Public Sub Left(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
@@ -446,7 +446,7 @@ Public Class NestingTabVM
End Property
Public Sub Right(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
@@ -488,7 +488,7 @@ Public Class NestingTabVM
End Property
Public Sub Down(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
@@ -530,7 +530,7 @@ Public Class NestingTabVM
End Property
Public Sub CClockwiseRot(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
RotateCluster(m_dRotationAngle)
EstCalc.ResetOrderMachiningFlag()
EgtDraw()
@@ -556,7 +556,7 @@ Public Class NestingTabVM
End Property
Public Sub ClockwiseRot(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
RotateCluster(-m_dRotationAngle)
EstCalc.ResetOrderMachiningFlag()
EgtDraw()
@@ -582,7 +582,7 @@ Public Class NestingTabVM
End Property
Public Sub InsertPart(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Ciclo di inserimento in tavola dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
@@ -620,7 +620,7 @@ Public Class NestingTabVM
End Property
Public Sub StorePart(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Ciclo di parcheggio dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
@@ -653,12 +653,12 @@ Public Class NestingTabVM
End Property
Public Sub RemovePart()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Se non ci sono pezzi selezionati, esco subito
If EgtGetFirstSelectedObj() = GDB_ID.NULL Then Return
' Chiedo conferma prima di procedere
If MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 21), "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then Return
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Verifico se ci sono pezzi provenienti da liste Csv
Dim bCsvParts As Boolean = False
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -674,14 +674,14 @@ Public Class NestingTabVM
If bCsvParts Then
' Vuoi cancellare anche i pezzi da lista Csv ?
Select Case MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 12), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Cancel
Return
Case MessageBoxResult.Yes
bEraseCsvParts = True
Case MessageBoxResult.No
bEraseCsvParts = False
Case MessageBoxResult.Cancel
Return
Case MessageBoxResult.Yes
bEraseCsvParts = True
Case MessageBoxResult.No
bEraseCsvParts = False
End Select
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
End If
' Ciclo di cancellazione dei pezzi selezionati
nId = EgtGetFirstSelectedObj()
@@ -698,7 +698,7 @@ Public Class NestingTabVM
EraseMachinings(nId)
' Cancello
EgtErase(nId)
' Altrimenti pezzo nel grezzo
' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = EstCalc.GetRawId() Then
If EgtRemovePartFromRawPart(nId) Then
' Eventuale notifica al VeinMatching
@@ -733,7 +733,7 @@ Public Class NestingTabVM
End Property
Public Sub SelectAll(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Numero dei pezzi in tavola
Dim nPartTab As Integer = EgtGetPartInRawPartCount(GetRawId())
' Se già selezionati in tavola o non ci sono selezionati e pezzi in tavola
@@ -795,7 +795,7 @@ Public Class NestingTabVM
End Property
Public Sub Reset(ByVal param As Object)
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Cancello eventuali messaggi
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
' Cancello tutte le lavorazioni
+1
View File
@@ -23,6 +23,7 @@
' Se non consentito passaggio ad altro tab interrompo l'evento
If Not OmagOFFICEMap.refOptionPanelVM.NestTabIsEnabled Then e.Handled = True
End Sub
#End Region ' EVENTS
End Class
+1 -1
View File
@@ -738,7 +738,7 @@ Public Class RawPartTabVM
Public ReadOnly Property PhotoToolTip As String
Get
Return "Importa fotografia"
Return EgtMsg(MSG_RAWPARTTAB + 2)
End Get
End Property
+1 -1
View File
@@ -29,7 +29,7 @@
IsRightDockable="False" IsFloating="False"/>
</EgtFloating:EgtFloatingTray>
<!--ContentControl che ospita la scena restituita sotto forma di WindowsFormsHost-->
<!--Scena restituita sotto forma di WindowsFormsHost-->
<OmagOFFICE:SceneHostV/>
</EgtFloating:EgtFloatingManager>
+5 -3
View File
@@ -1,8 +1,10 @@
<WindowsFormsHost x:Class="SceneHostV"
<UserControl x:Class="SceneHostV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtUILib="clr-namespace:EgtUILib;assembly=EgtUILib">
<EgtUILib:Scene x:Name="OmagOFFICEScene"/>
<WindowsFormsHost>
<EgtUILib:Scene x:Name="MainScene"/>
</WindowsFormsHost>
</WindowsFormsHost>
</UserControl>
+5 -532
View File
@@ -5,542 +5,15 @@ Imports EgtWPFLib5
Public Class SceneHostV
' Scene controller
Private WithEvents m_Controller As New Controller
Friend ReadOnly Property Controller As Controller
Get
Return m_Controller
End Get
End Property
Private m_SceneHostVM As MySceneHostVM
Sub New()
' This call is required by the designer.
InitializeComponent()
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefSceneHostV(Me)
' Inizializzazione Scena
PreInitializeScene()
If Not OmagOFFICEScene.Init() Then
EgtOutLog("Error in Project scene creation")
' Box di avviso chiave mancante
MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 2) & Environment.NewLine & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error)
' Chiudo il programma
End
' Verifico abilitazione prodotto
ElseIf Not OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then
MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 5), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error)
' Chiudo il programma
End
Else
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
OmagOFFICEScene.SetStatusNull()
' Recupero e imposto handle finestra principale
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
EgtSetMainWindowHandle(hMainWnd)
' inizializzo gestore lavorazioni
EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot)
End If
' Assegno al riferimento locale al VM il VM preso dal DataContext
Me.DataContext = New MySceneHostVM
m_SceneHostVM = DirectCast(Me.DataContext, MySceneHostVM)
m_SceneHostVM.SetMainScene(MainScene)
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
OmagOFFICEScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
OmagOFFICEScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
OmagOFFICEScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
OmagOFFICEScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
OmagOFFICEScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
OmagOFFICEScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
OmagOFFICEScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
m_Controller.SetScene(OmagOFFICEScene)
' imposto tipo coordinate
OmagOFFICEScene.SetGridCursorPos(True)
' modo di visualizzazione
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
OmagOFFICEMap.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TXRMAXLINPIX, 16384)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' tipo snap point
OmagOFFICEScene.SetSnapPointType(SP.PT_SKETCH)
End Sub
#Region "ProjectManager"
Friend Sub NewProject()
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
Dim bOk As Boolean = m_Controller.NewProject()
' Eventuale reset VM
If bOk Then
VeinMatching.Clear()
End If
OmagOFFICEScene.SetStatusNull()
End Sub
Friend Sub OpenProject(sFilePath As String)
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
Dim bOk As Boolean = False
If String.IsNullOrEmpty(sFilePath) Then
' Recupero cartella dell'ultimo progetto aperto
Dim sDir As String = m_Controller.GetCurrFile()
If String.IsNullOrWhiteSpace(sDir) Then
GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sDir)
End If
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
bOk = m_Controller.OpenProject(sDir)
Else
bOk = m_Controller.OpenProject(sFilePath, False)
End If
OmagOFFICEScene.SetStatusNull()
' Eventuale apertura file VM
Dim sFile As String = String.Empty
If bOk AndAlso EgtGetCurrFilePath(sFile) Then
Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme")
VeinMatching.Open(sVmFile)
End If
End Sub
Friend Sub SaveProject()
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
Dim nType As NGE = DirectCast(GetMainPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Dim sFile As String = m_Controller.GetCurrFile()
If Not String.IsNullOrWhiteSpace(sFile) Then
m_Controller.SaveProject(nType)
OmagOFFICEScene.SetStatusNull()
Else
GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sFile)
If Not String.IsNullOrWhiteSpace(sFile) Then
sFile = Path.GetDirectoryName(sFile)
End If
sFile.TrimEnd("\"c)
sFile += "\New.nge"
m_Controller.SaveAsProject(sFile, nType)
End If
End Sub
Friend Sub SaveAsProject()
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
Dim nType As NGE = DirectCast(GetMainPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Dim sFile As String = m_Controller.GetCurrFile()
If String.IsNullOrWhiteSpace(sFile) Then
GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sFile)
If Not String.IsNullOrWhiteSpace(sFile) Then
sFile = Path.GetDirectoryName(sFile)
End If
sFile.TrimEnd("\"c)
sFile += "\New.nge"
End If
m_Controller.SaveAsProject(sFile, nType)
OmagOFFICEScene.SetStatusNull()
End Sub
Friend Sub ExportProject()
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
' Verifico che il progetto sia salvato
If EgtGetModified() Then
MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 1), "", MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return
End If
' Scelta del direttorio di destinazione
Dim sLastExportDir As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, "", sLastExportDir)
Dim DirDlg As New System.Windows.Forms.FolderBrowserDialog
DirDlg.Description = EgtMsg(MSG_TOPCMDBAR + 2) ' Seleziona il direttorio di esportazione
DirDlg.SelectedPath = sLastExportDir
If DirDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return
WriteMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, DirDlg.SelectedPath)
' Eseguo esportazione
If Not ExecExport(DirDlg.SelectedPath) Then
' Errore nell'esportazione
MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 3), "", MessageBoxButton.OK, MessageBoxImage.Error)
End If
EgtSetCurrentContext(OmagOFFICEScene.GetCtx())
End Sub
Private Function ExecExport(sDirDest As String) As Boolean
' Path completa del progetto corrente
Dim sFilePath As String = String.Empty
EgtGetCurrFilePath(sFilePath)
' Preparo la lista dei gruppi di lavoro
Dim vMchGrps As New List(Of Integer)
Dim nGrpId = EgtGetFirstMachGroup()
While nGrpId <> GDB_ID.NULL
vMchGrps.Add(nGrpId)
nGrpId = EgtGetNextMachGroup(nGrpId)
End While
' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto
Dim nCurrCtx As Integer = EgtGetCurrentContext()
Dim nCtx As Integer = EgtInitContext()
EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot)
' Per ogni gruppo di lavoro
For Each nMchGrpId As Integer In vMchGrps
' Carico il progetto
EgtOpenFile(sFilePath)
' Recupero il nome del gruppo
Dim sMchGrp As String = String.Empty
EgtGetMachGroupName(nMchGrpId, sMchGrp)
' Recupero il nome della lastra
Dim sSlabName As String = String.Empty
EgtGetInfo(nMchGrpId, INFO_SLABNAME, sSlabName)
' Creo path del file di salvataggio
Dim sFileDest As String = sDirDest & "\" & Path.GetFileNameWithoutExtension(sFilePath) & "_" & If(String.IsNullOrEmpty(sSlabName), sMchGrp, sSlabName) & ".nge"
' Verifico se al gruppo è associata una foto
Dim nPhotoId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME & sMchGrp)
' Elimino le altre fotografie
Dim nPhId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP))
While nPhId <> GDB_ID.NULL
Dim nNextPhId As Integer = EgtGetNext(nPhId)
If nPhId <> nPhotoId Then
EgtErase(nPhId)
End If
nPhId = nNextPhId
End While
' Sistemo l'eventuale foto del gruppo
If nPhotoId <> GDB_ID.NULL Then
Dim sOriPath As String = String.Empty
EgtGetPhotoPath(nPhotoId, sOriPath)
Dim sNewPath As String = Path.ChangeExtension(sFileDest, Path.GetExtension(sOriPath))
EgtChangePhotoPath(nPhotoId, sNewPath)
File.Copy(sOriPath, sNewPath, True)
EgtSetName(nPhotoId, PHOTO_NAME)
End If
' Elimino gli altri gruppi di lavorazioni
For Each nMGrpId As Integer In vMchGrps
If nMGrpId <> nMchGrpId Then
EgtRemoveMachGroup(nMGrpId)
End If
Next
' Elimino i pezzi che non stanno nel gruppo corrente (sono ancora pezzi dopo averlo attivato)
EgtSetCurrMachGroup(nMchGrpId)
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
Dim nNextPartId As Integer = EgtGetNextPart(nPartId)
EgtErase(nPartId)
nPartId = nNextPartId
End While
EgtResetCurrMachGroup()
' Assegno nome standard OmagCUT al gruppo di lavoro
EgtSetName(nMchGrpId, MACH_GROUP)
' Definisco gruppo marcatore di OmagCUT
Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetName(nMarkId, NAME_PROJMARK)
EgtSetLevel(nMarkId, GDB_LV.SYSTEM)
Dim nReducedCut As Integer = 1
EgtGetInfo(nMchGrpId, INFO_REDUCEDCUT, nReducedCut)
EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut)
Dim nWash As Integer = 1
EgtGetInfo(nMchGrpId, INFO_WASHING, nWash)
EgtSetInfo(nMarkId, INFO_WASHING, nWash)
Dim nOrder As Integer = 0
EgtGetInfo(nMchGrpId, INFO_MACHORDER, nOrder)
EgtSetInfo(nMarkId, INFO_MACHORDER, nOrder)
Dim sMatName As String = String.Empty
EgtGetInfo(nMchGrpId, INFO_PROJMAT, sMatName)
EgtSetInfo(nMarkId, INFO_PROJMAT, sMatName)
' Salvo il file
EgtSaveFile(sFileDest, NGE.CMPTEXT)
Next
' Distruggo il contesto corrente e ripristino quello originale
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nCtx)
Return True
End Function
#End Region ' ProjectManager
#Region "ShowMode"
Friend Sub ShowMode(nType As SM)
Select Case nType
Case SM.WIREFRAME
OmagOFFICEScene.WireFrame()
Case SM.HIDDENLINE
OmagOFFICEScene.HiddenLine()
Case SM.SHADING
OmagOFFICEScene.Shading()
End Select
End Sub
#End Region ' ShowMode
#Region "Zoom"
Friend Sub ZoomMode(nType As ZM)
Select Case nType
Case ZM.ALL
OmagOFFICEScene.ZoomAll()
Case ZM.IN_
OmagOFFICEScene.ZoomIn()
Case ZM.OUT
OmagOFFICEScene.ZoomOut()
End Select
End Sub
#End Region ' Zoom
#Region "ViewMode"
Friend Sub ViewMode(nType As VT)
Select Case nType
Case VT.TOP
OmagOFFICEScene.TopView()
Case VT.FRONT
OmagOFFICEScene.FrontView()
Case VT.RIGHT
OmagOFFICEScene.RightView()
Case VT.BACK
OmagOFFICEScene.BackView()
Case VT.LEFT
OmagOFFICEScene.LeftView()
Case VT.BOTTOM
OmagOFFICEScene.BottomView()
Case VT.ISO_SW
OmagOFFICEScene.IsoViewSW()
Case VT.ISO_SE
OmagOFFICEScene.IsoViewSE()
Case VT.ISO_NE
OmagOFFICEScene.IsoViewNE()
Case VT.ISO_NW
OmagOFFICEScene.IsoViewNW()
End Select
End Sub
#End Region ' ViewMode
#Region "GetDistance"
Friend Sub GetDistanceON()
OmagOFFICEScene.SetStatusGetDistance()
End Sub
Friend Sub GetDistanceOFF()
OmagOFFICEScene.ResetStatusGetDistance()
End Sub
#End Region
#Region "EVENTS"
Private Sub OnNewProject(sender As Object, bOk As Boolean) Handles m_Controller.OnNewProject
OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE"
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) Handles m_Controller.OnOpenProject
' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro)
If EgtGetMachGroupCount() = 0 Then bOk = False
' Procedo a seconda del risultato
If bOk Then
OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile)
Else
EgtNewFile()
OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE"
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
End Sub
Private Sub OnSavingProject(ByVal sender As Object, sFile As String) Handles m_Controller.OnSavingProject
' Recupero tutti i file di texture associabili ai gruppi di lavoro del progetto
Dim sDirToSearch As String = Path.GetDirectoryName(sFile)
Dim sFileToSearch As String = Path.GetFileNameWithoutExtension(sFile) & "." & PHOTO_NAME & "*"
Dim vsTxrFile As New List(Of String)
For Each sTxrFile In My.Computer.FileSystem.GetFiles(sDirToSearch, FileIO.SearchOption.SearchTopLevelOnly, sFileToSearch)
vsTxrFile.Add(sTxrFile)
Next
' Rinomino path di eventuali fotografie
Dim nPhotoId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP))
While nPhotoId <> GDB_ID.NULL
' Path originale
Dim sPhoto As String = String.Empty
If EgtGetPhotoPath(nPhotoId, sPhoto) Then
' Nome della foto
Dim sName As String = String.Empty
EgtGetName(nPhotoId, sName)
' Nuova path
Dim sNewPhoto As String = Path.GetDirectoryName(sFile) & "\" &
Path.GetFileNameWithoutExtension(sFile) & "." & sName &
Path.GetExtension(sPhoto)
' Se diverse, eseguo copia
If String.Compare(sPhoto, sNewPhoto, True) <> 0 Then
Try
' Eseguo copia
File.Copy(sPhoto, sNewPhoto, True)
' Notifico a foto il cambio di path
EgtChangePhotoPath(nPhotoId, sNewPhoto)
' Eventuale notifica a VeinMatching del cambio di path
VeinMatching.ChangePhotoPath(sPhoto, sNewPhoto)
Catch ex As Exception
End Try
End If
' Tolgo da lista file texture associabili, se presente
vsTxrFile.Remove(sNewPhoto)
End If
' passo alla successiva
nPhotoId = EgtGetNext(nPhotoId)
End While
' Se rimasti file associabili, li cancello
For Each sTxrFile In vsTxrFile
Try
My.Computer.FileSystem.DeleteFile(sTxrFile)
Catch
End Try
Next
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject
' Se salvataggio non riuscito, esco subito
If Not bOk Then
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Return
End If
' Eventuale salvataggio VM
Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme")
VeinMatching.Save(sVmFile)
' Eventuale salvataggio CSV
CsvM.SaveCsvPartList()
' Aggiornamento titolo
OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
' Riabilito visualizzazione pezzi in parcheggio
EstCalc.ShowParkedParts()
' Inserisco nome in MRU
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile)
' Salvo nome ultimo file
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
End Sub
Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseDownScene
' Si può selezionare solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or Not OmagOFFICEScene.IsStatusNull() Then Return
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
OmagOFFICEMap.refMachiningTabVM.OnMouseDownScene(sender, e)
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseMoveScene
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseMoveScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseMoveScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseUpScene
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
OmagOFFICEMap.refRawPartTabVM.OnMouseUpScene(sender, e)
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnMouseUpScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles OmagOFFICEScene.KeyDown
' Chiamo l'opportuno gestore
Select Case OmagOFFICEMap.refOptionPanelVM.SelItem
Case OptionPanelVM.Tabs.RAWPART
Case OptionPanelVM.Tabs.NESTING
OmagOFFICEMap.refNestingTabVM.OnKeyDownScene(sender, e)
Case OptionPanelVM.Tabs.MACHINING
Case OptionPanelVM.Tabs.SIMUL
End Select
End Sub
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles OmagOFFICEScene.OnCursorPos
OmagOFFICEMap.refStatusBarVM.SetCurrPos(sCursorPos)
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles OmagOFFICEScene.OnShowDistance
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sDistance)
End Sub
Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) Handles OmagOFFICEScene.OnChangedSnapPointType
If bUser Then
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeBackground(New SolidColorBrush(SystemColors.ControlColor))
Else
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeBackground(Brushes.Bisque)
End If
Select Case nSpType
Case SP.PT_SKETCH
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1102)) 'Sketch Point
Case SP.PT_GRID
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1104)) 'Grid Point
Case SP.PT_END
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1106)) 'End Point
Case SP.PT_MID
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1108)) 'Mid Point
Case SP.CENTER
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1110)) 'Center
Case SP.CENTROID
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1112)) 'Centroid
Case SP.PT_NEAR
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1114)) 'Near Point
Case SP.PT_INTERS
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1116)) 'Inters Point
Case SP.PT_TANGENT
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1118)) 'Tang Point
Case SP.PT_PERPENDICULAR
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1120)) 'Perp Point
Case SP.PT_MINDIST
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1122)) 'MinDist Point
Case Else
OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText("---")
End Select
End Sub
#End Region ' EVENTS
End Class
-110
View File
@@ -1,110 +0,0 @@
Imports EgtUILib
Public Class ShowPanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdWireframe As ICommand
Private m_cmdHiddenLine As ICommand
Private m_cmdShading As ICommand
Private m_cmdCurveDir As ICommand
#Region "ToolTip"
Public ReadOnly Property RenderingWFToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 1)
End Get
End Property
Public ReadOnly Property RenderingHLToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 2)
End Get
End Property
Public ReadOnly Property RenderingSHToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 3)
End Get
End Property
#End Region
Private m_WireframeIsChecked As Boolean
Public Property WireframeIsChecked As Boolean
Get
Return m_WireframeIsChecked
End Get
Set(value As Boolean)
If value <> m_WireframeIsChecked Then
m_WireframeIsChecked = value
If value Then
OmagOFFICEMap.refSceneHostV.ShowMode(SM.WIREFRAME)
NotifyPropertyChanged("WireframeIsChecked")
End If
End If
End Set
End Property
Private m_HiddenLineIsChecked As Boolean
Public Property HiddenLineIsChecked As Boolean
Get
Return m_HiddenLineIsChecked
End Get
Set(value As Boolean)
If value <> m_HiddenLineIsChecked Then
m_HiddenLineIsChecked = value
If value Then
OmagOFFICEMap.refSceneHostV.ShowMode(SM.HIDDENLINE)
NotifyPropertyChanged("HiddenLineIsChecked")
End If
End If
End Set
End Property
Private m_ShadingIsChecked As Boolean
Public Property ShadingIsChecked As Boolean
Get
Return m_ShadingIsChecked
End Get
Set(value As Boolean)
If value <> m_ShadingIsChecked Then
m_ShadingIsChecked = value
If value Then
OmagOFFICEMap.refSceneHostV.ShowMode(SM.SHADING)
NotifyPropertyChanged("ShadingIsChecked")
End If
End If
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefShowPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetShowMode(nShowModeType As SM)
Select Case nShowModeType
Case SM.WIREFRAME
WireframeIsChecked = True
Case SM.HIDDENLINE
HiddenLineIsChecked = True
Case SM.SHADING
ShadingIsChecked = True
End Select
End Sub
#End Region
End Class
+15 -6
View File
@@ -14,24 +14,33 @@
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
</StatusBar.ItemsPanel>
<!--Stringa di output messaggi-->
<StatusBarItem Grid.Column="0">
<TextBlock Text="{Binding OutputMessage}" Foreground="{Binding MsgColor}"/>
<TextBlock Text="{Binding OutputMessage}"
Foreground="{Binding OutputMessage_Foreground}"/>
</StatusBarItem>
<!--Indica il tipo di punto notevole selezionato-->
<StatusBarItem Grid.Column="1">
<Button Content="{Binding SnapPointTypeText}"
Background="{Binding SnapPointTypeBackground}" Width="80"/>
<Button Content="{Binding SnapPointType}"
Background="{Binding SnapPointType_Background}"
Width="80"/>
</StatusBarItem>
<!--Indica la posizione del mouse quando è sulla scena-->
<StatusBarItem Grid.Column="2">
<TextBlock Text="{Binding CurrPos}" Foreground="{StaticResource Omag_Black}"/>
<TextBlock Text="{Binding CurrPos}"
TextAlignment="Right"
Foreground="{StaticResource Omag_Black}"
Width="250"/>
</StatusBarItem>
<!--Indica l'unità di misura-->
<StatusBarItem Grid.Column="3">
<TextBlock Text="{Binding MeasureUnit}" Foreground="{StaticResource Omag_Black}"
<TextBlock Text="{Binding MeasureUnit}"
Foreground="{StaticResource Omag_Black}"
Width="35"/>
</StatusBarItem>
-160
View File
@@ -1,160 +0,0 @@
Imports EgtWPFLib5
Public Class StatusBarVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private WithEvents OutputMessageTimer As New System.Windows.Threading.DispatcherTimer
' GRAPHICAL ELEMENTS
Private m_OutputMessage As String
Public Property OutputMessage As String
Get
Return m_OutputMessage
End Get
Set(value As String)
m_OutputMessage = value
'NotifyPropertyChanged("OutputMessage")
End Set
End Property
Private m_MsgColor As Brush = Brushes.Black
Public Property MsgColor As Brush
Get
Return m_MsgColor
End Get
Set(value As Brush)
m_MsgColor = value
'NotifyPropertyChanged("MsgColor")
End Set
End Property
Private m_MeasureUnit As String
Public Property MeasureUnit As String
Get
Return m_MeasureUnit
End Get
Set(value As String)
m_MeasureUnit = value
'NotifyPropertyChanged("SelMeasureUnit")
End Set
End Property
Private m_CurrPos As String
Public Property CurrPos As String
Get
Return m_CurrPos
End Get
Set(value As String)
m_CurrPos = value
'NotifyPropertyChanged("StatusCurrPos")
End Set
End Property
Private m_SnapPointTypeText As String
Public Property SnapPointTypeText As String
Get
Return m_SnapPointTypeText
End Get
Set(value As String)
m_SnapPointTypeText = value
'NotifyPropertyChanged("SnapPointTypeText")
End Set
End Property
Private m_SnapPointTypeBackground As SolidColorBrush
Public Property SnapPointTypeBackground As SolidColorBrush
Get
Return m_SnapPointTypeBackground
End Get
Set(value As SolidColorBrush)
m_SnapPointTypeBackground = value
'NotifyPropertyChanged("SnapPointTypeBackground")
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefStatusBarVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Overloads Sub SetOutputMessage(sMessage As String, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
SetMsgColor(nMsgType)
m_OutputMessage = sMessage
NotifyPropertyChanged("OutputMessage")
End Sub
Friend Overloads Sub SetOutputMessage(sMessage As String, nTime As Integer, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
SetMsgColor(nMsgType)
m_OutputMessage = sMessage
NotifyPropertyChanged("OutputMessage")
OutputMessageTimer.Interval = TimeSpan.FromSeconds(nTime)
OutputMessageTimer.IsEnabled = True
OutputMessageTimer.Start()
End Sub
Friend Sub ClearOutputMessage()
m_MsgColor = Brushes.Black
NotifyPropertyChanged("MsgColor")
m_OutputMessage = String.Empty
NotifyPropertyChanged("OutputMessage")
If OutputMessageTimer.IsEnabled Then
OutputMessageTimer.Stop()
OutputMessageTimer.IsEnabled = False
End If
End Sub
Friend Sub SetMeasureUnit(nMeasureUnit As Integer)
m_MeasureUnit = If(nMeasureUnit = 0, "in", "mm")
NotifyPropertyChanged("MeasureUnit")
End Sub
Friend Overloads Sub SetCurrPos(sCurrPos As String)
m_CurrPos = sCurrPos
NotifyPropertyChanged("CurrPos")
End Sub
Private Sub SetMsgColor(nMsgType As MSG_TYPE)
Select Case nMsgType
Case MSG_TYPE.INFO
m_MsgColor = Brushes.Black
Case MSG_TYPE.WARNING
m_MsgColor = Brushes.SaddleBrown
Case MSG_TYPE.ERROR_
m_MsgColor = Brushes.Red
End Select
NotifyPropertyChanged("MsgColor")
End Sub
Friend Sub SetSnapPointTypeText(sSnapPntTypeText As String)
m_SnapPointTypeText = sSnapPntTypeText
NotifyPropertyChanged("SnapPointTypeText")
End Sub
Friend Sub SetSnapPointTypeBackground(SnapPntTypeBackground As SolidColorBrush)
m_SnapPointTypeBackground = SnapPntTypeBackground
NotifyPropertyChanged("SnapPointTypeBackground")
End Sub
#End Region ' METHODS
#Region "EVENTS"
Private Sub OutputMessageTimer_Tick(source As Object, e As EventArgs) Handles OutputMessageTimer.Tick
ClearOutputMessage()
OutputMessageTimer.Stop()
OutputMessageTimer.IsEnabled = False
End Sub
#End Region ' EVENTS
End Class
+56 -58
View File
@@ -1,60 +1,58 @@
<UserControl x:Class="TopCommandBarV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel x:Class="TopCommandBarV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Horizontal">
<!--Barra superiore dei comandi-->
<StackPanel Orientation="Horizontal">
<Button Command="{Binding NewCommand}"
ToolTip="{Binding NewToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OpenCommand}"
ToolTip="{Binding OpenToolTip}"
IsEnabled="{Binding IsEnabled}"
ContextMenuService.Placement="Bottom"
Tag="{Binding}">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruFileNames}">
<ContextMenu.Resources>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
Value="{Binding PlacementTarget.Tag.OpenMruFileCommand,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=ContextMenu}}"/>
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
</ContextMenu.Resources>
</ContextMenu>
</Button.ContextMenu>
<Image Source="/Resources/TopCommandBar/Open.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveAsCommand}"
ToolTip="{Binding SaveAsToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding ExportCommand}"
ToolTip="{Binding ExportToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OptionsCommand}"
ToolTip="{Binding OptionsToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}"
ToolTip="{Binding SendFeedbackToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
</StackPanel>
</UserControl>
<Button Command="{Binding NewCommand}"
ToolTip="{Binding NewToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OpenCommand}"
ToolTip="{Binding OpenToolTip}"
IsEnabled="{Binding IsEnabled}"
ContextMenuService.Placement="Bottom"
Tag="{Binding}">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruFileNames}">
<ContextMenu.Resources>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
Value="{Binding PlacementTarget.Tag.OpenMruFileCommand,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=ContextMenu}}"/>
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
</ContextMenu.Resources>
</ContextMenu>
</Button.ContextMenu>
<Image Source="/Resources/TopCommandBar/Open.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveAsCommand}"
ToolTip="{Binding SaveAsToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding ExportCommand}"
ToolTip="{Binding ExportToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OptionsCommand}"
ToolTip="{Binding OptionsToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}"
ToolTip="{Binding SendFeedbackToolTip}"
IsEnabled="{Binding IsEnabled}">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
</StackPanel>
+7 -7
View File
@@ -122,7 +122,7 @@ Public Class TopCommandBarVM
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Friend Sub NewCmd(Optional bUseDefaults As Boolean = False)
OmagOFFICEMap.refSceneHostV.NewProject()
OmagOFFICEMap.refSceneHostVM.NewProject()
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(bUseDefaults)
End Sub
@@ -150,7 +150,7 @@ Public Class TopCommandBarVM
End Sub
Friend Sub OpenProject(sFilePath As String)
OmagOFFICEMap.refSceneHostV.OpenProject(sFilePath)
OmagOFFICEMap.refSceneHostVM.OpenProject(sFilePath)
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList()
End Sub
@@ -197,7 +197,7 @@ Public Class TopCommandBarVM
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Save(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.SaveProject()
OmagOFFICEMap.refSceneHostVM.SaveProject()
End Sub
#End Region ' SaveCommand
@@ -220,7 +220,7 @@ Public Class TopCommandBarVM
''' Execute the SaveAs. This method is invoked by the SaveAsCommand.
''' </summary>
Public Sub SaveAs(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.SaveAsProject()
OmagOFFICEMap.refSceneHostVM.SaveAsProject()
End Sub
#End Region ' SaveAsCommand
@@ -243,7 +243,7 @@ Public Class TopCommandBarVM
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub Export(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ExportProject()
OmagOFFICEMap.refSceneHostVM.ExportProject()
End Sub
#End Region ' ExportCommand
@@ -311,14 +311,14 @@ Public Class TopCommandBarVM
' se nome file vuoto, chiedo se si vuole salvare
If String.IsNullOrWhiteSpace(sCurrProject) Then
If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
OmagOFFICEMap.refSceneHostV.SaveProject()
OmagOFFICEMap.refSceneHostVM.SaveProject()
End If
EgtGetCurrFilePath(sCurrProject)
' se modificato, chiedo se si vuole salvare
Else
If EgtGetModified() Then
If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
OmagOFFICEMap.refSceneHostV.SaveProject()
OmagOFFICEMap.refSceneHostVM.SaveProject()
End If
End If
End If
+6 -5
View File
@@ -10,12 +10,13 @@
it in xaml file(ProjectView.xaml).
-->
<OmagOFFICE:MainWindowVM x:Key="MainWindowVM"/>
<OmagOFFICE:MySceneHostVM x:Key="MySceneHostVM"/>
<OmagOFFICE:TopCommandBarVM x:Key="TopCommandBarVM"/>
<OmagOFFICE:StatusBarVM x:Key="StatusBarVM"/>
<EgtWPFLib5:StatusBarVM x:Key="StatusBarVM"/>
<OmagOFFICE:ProjectVM x:Key="ProjectVM"/>
<OmagOFFICE:ShowPanelVM x:Key="ShowPanelVM"/>
<OmagOFFICE:ViewPanelVM x:Key="ViewPanelVM"/>
<OmagOFFICE:InstrumentPanelVM x:Key="InstrumentPanelVM"/>
<EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/>
<EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/>
<EgtWPFLib5:InstrumentPanelVM x:Key="InstrumentPanelVM"/>
<OmagOFFICE:MachinePanelVM x:Key="MachinePanelVM"/>
<OmagOFFICE:VeinMatchPanelVM x:Key="VeinMatchPanelVM"/>
<OmagOFFICE:OptionPanelVM x:Key="OptionPanelVM"/>
@@ -23,7 +24,7 @@
<OmagOFFICE:NestingTabVM x:Key="NestingTabVM"/>
<OmagOFFICE:MachiningTabVM x:Key="MachiningTabVM"/>
<OmagOFFICE:SimulTabVM x:Key="SimulTabVM"/>
<OmagOFFICE:MachGroupPanelVM x:Key="MachGroupPanelVM"/>
<OmagOFFICE:MyMachGroupPanelVM x:Key="MachGroupPanelVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="Omag_Blue" Color="#FF095CA8" />
+2
View File
@@ -1,5 +1,7 @@
Public Class OmagOFFICEDictionary
Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
#Region "Colors"
Private m_Omag_Red As SolidColorBrush = Brushes.Red
+23 -26
View File
@@ -3,14 +3,10 @@
Module OmagOFFICEMap
Private m_refMainWindowVM As MainWindowVM
Private m_refStatusBarVM As StatusBarVM
Private m_refTopCommandBarVM As TopCommandBarVM
Private m_refProjectVM As ProjectVM
Private m_refSceneHostV As SceneHostV
Private m_refShowPanelVM As ShowPanelVM
Private m_refVeinMatchPanelVM As VeinMatchPanelVM
Private m_refMachinePanelVM As MachinePanelVM
Private m_refMachGroupPanelVM As MachGroupPanelVM
Private m_refOptionPanelVM As OptionPanelVM
Private m_refRawPartTabVM As RawPartTabVM
Private m_refNestingTabVM As NestingTabVM
@@ -29,7 +25,7 @@ Module OmagOFFICEMap
Public ReadOnly Property refStatusBarVM As StatusBarVM
Get
Return m_refStatusBarVM
Return LibMap.refStatusBarVM
End Get
End Property
@@ -45,19 +41,19 @@ Module OmagOFFICEMap
End Get
End Property
Public ReadOnly Property refSceneHostV As SceneHostV
Public ReadOnly Property refSceneHostVM As SceneHostVM
Get
Return m_refSceneHostV
Return LibMap.refSceneHostVM
End Get
End Property
Public ReadOnly Property refShowPanelVM As ShowPanelVM
Get
Return m_refShowPanelVM
Return LibMap.refShowPanelVM
End Get
End Property
Public ReadOnly Property refVeinMatchPanelVM As VeinMatchPanelVM
Public ReadOnly Property refVeinMatchPanelVM As VeinMatchPanelVM
Get
Return m_refVeinMatchPanelVM
End Get
@@ -69,9 +65,9 @@ Module OmagOFFICEMap
End Get
End Property
Public ReadOnly Property refMachGroupPanelVM As MachGroupPanelVM
Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
Get
Return m_refMachGroupPanelVM
Return LibMap.refMachGroupPanelVM
End Get
End Property
@@ -122,8 +118,8 @@ Module OmagOFFICEMap
#Region "Set"
Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
m_refStatusBarVM = StatusBarVM
Return Not IsNothing(m_refStatusBarVM)
LibMap.SetRefStatusBarVM(StatusBarVM)
Return Not IsNothing(LibMap.refStatusBarVM)
End Function
Friend Function SetRefTopCommandBarVM(TopCommandBarVM As TopCommandBarVM) As Boolean
@@ -136,17 +132,17 @@ Module OmagOFFICEMap
Return Not IsNothing(m_refProjectVM)
End Function
Friend Function SetRefSceneHostV(SceneHostV As SceneHostV) As Boolean
m_refSceneHostV = SceneHostV
Return Not IsNothing(m_refSceneHostV)
Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
LibMap.SetRefSceneHostVM(SceneHostVM)
Return Not IsNothing(LibMap.refSceneHostVM)
End Function
Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
m_refShowPanelVM = ShowPanelVM
Return Not IsNothing(m_refShowPanelVM)
LibMap.SetRefShowPanelVM(ShowPanelVM)
Return Not IsNothing(LibMap.refShowPanelVM)
End Function
Friend Function SetRefVeinMatchPanelVM(VeinMatchPanelVM As VeinMatchPanelVM) As Boolean
Friend Function SetRefVeinMatchPanelVM(VeinMatchPanelVM As VeinMatchPanelVM) As Boolean
m_refVeinMatchPanelVM = VeinMatchPanelVM
Return Not IsNothing(m_refVeinMatchPanelVM)
End Function
@@ -156,9 +152,9 @@ Module OmagOFFICEMap
Return Not IsNothing(m_refMachinePanelVM)
End Function
Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MachGroupPanelVM) As Boolean
m_refMachGroupPanelVM = MachGroupPanelVM
Return Not IsNothing(m_refMachGroupPanelVM)
Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
LibMap.setrefMachGroupPanelVM(MachGroupPanelVM)
Return Not IsNothing(LibMap.refMachGroupPanelVM)
End Function
Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
@@ -207,13 +203,14 @@ Module OmagOFFICEMap
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
Not IsNothing(m_refStatusBarVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso
Not IsNothing(m_refSceneHostV) AndAlso Not IsNothing(m_refShowPanelVM) AndAlso
Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso
Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
Not IsNothing(m_refVeinMatchPanelVM) AndAlso
Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(m_refMachGroupPanelVM) AndAlso
Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso
Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
Not IsNothing(m_refMachiningTabVM)
Not IsNothing(m_refMachiningTabVM) AndAlso
LibMap.EndInit()
End Function
#End Region ' Init
+1 -1
View File
@@ -21,7 +21,7 @@ Public Class VeinMatchPanelVM
Else
VeinMatchingWnd.Hide()
End If
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
End Set
End Property
+1 -1
View File
@@ -1,3 +1,3 @@
Public Class GridViewPanelV
Public Class ViewPanelV
End Class
-231
View File
@@ -1,231 +0,0 @@
Imports EgtUILib
Public Class ViewPanelVM
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdZoomAll As ICommand
Private m_cmdTopView As ICommand
Private m_cmdFrontView As ICommand
Private m_cmdLeftView As ICommand
Private m_cmdBackView As ICommand
Private m_cmdRightView As ICommand
Private m_cmdIsoViewSW As ICommand
#Region "ToolTip"
Public ReadOnly Property ZoomAllToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 4)
End Get
End Property
Public ReadOnly Property LookFromTopToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 7)
End Get
End Property
Public ReadOnly Property LookFromFrontToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 8)
End Get
End Property
Public ReadOnly Property LookFromLeftToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 9)
End Get
End Property
Public ReadOnly Property LookFromBackToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 10)
End Get
End Property
Public ReadOnly Property LookFromRightToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 11)
End Get
End Property
Public ReadOnly Property LookFromIso_SWToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 12)
End Get
End Property
#End Region ' ToolTip
#End Region ' FIELDS & PROPERTIES
#Region "COMMANDS"
#Region "ZoomAllCommand"
''' <summary>
''' Returns a command that do ZoomAll.
''' </summary>
Public ReadOnly Property ZoomAllCommand As ICommand
Get
If m_cmdZoomAll Is Nothing Then
m_cmdZoomAll = New Command(AddressOf ZoomAll)
End If
Return m_cmdZoomAll
End Get
End Property
''' <summary>
''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand.
''' </summary>
Public Sub ZoomAll(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ZoomMode(ZM.ALL)
End Sub
#End Region ' ZoomAllCommand
#Region "TopViewCommand"
''' <summary>
''' Returns a command that do TopView.
''' </summary>
Public ReadOnly Property TopViewCommand As ICommand
Get
If m_cmdTopView Is Nothing Then
m_cmdTopView = New Command(AddressOf TopView)
End If
Return m_cmdTopView
End Get
End Property
''' <summary>
''' Execute the TopView. This method is invoked by the TopViewCommand.
''' </summary>
Public Sub TopView(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.TOP)
End Sub
#End Region ' TopViewCommand
#Region "FrontViewCommand"
''' <summary>
''' Returns a command that do FrontView.
''' </summary>
Public ReadOnly Property FrontViewCommand As ICommand
Get
If m_cmdFrontView Is Nothing Then
m_cmdFrontView = New Command(AddressOf FrontView)
End If
Return m_cmdFrontView
End Get
End Property
''' <summary>
''' Execute the FrontView. This method is invoked by the FrontViewCommand.
''' </summary>
Public Sub FrontView(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.FRONT)
End Sub
#End Region ' FrontViewCommand
#Region "LeftViewCommand"
''' <summary>
''' Returns a command that do LeftView.
''' </summary>
Public ReadOnly Property LeftViewCommand As ICommand
Get
If m_cmdLeftView Is Nothing Then
m_cmdLeftView = New Command(AddressOf LeftView)
End If
Return m_cmdLeftView
End Get
End Property
''' <summary>
''' Execute the LeftView. This method is invoked by the LeftViewCommand.
''' </summary>
Public Sub LeftView(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.LEFT)
End Sub
#End Region ' LeftViewCommand
#Region "BackViewCommand"
''' <summary>
''' Returns a command that do BackView.
''' </summary>
Public ReadOnly Property BackViewCommand As ICommand
Get
If m_cmdBackView Is Nothing Then
m_cmdBackView = New Command(AddressOf BackView)
End If
Return m_cmdBackView
End Get
End Property
''' <summary>
''' Execute the BackView. This method is invoked by the BackViewCommand.
''' </summary>
Public Sub BackView(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.BACK)
End Sub
#End Region ' BackViewCommand
#Region "RightViewCommand"
''' <summary>
''' Returns a command that do RightView.
''' </summary>
Public ReadOnly Property RightViewCommand As ICommand
Get
If m_cmdRightView Is Nothing Then
m_cmdRightView = New Command(AddressOf RightView)
End If
Return m_cmdRightView
End Get
End Property
''' <summary>
''' Execute the RightView. This method is invoked by the RightViewCommand.
''' </summary>
Public Sub RightView(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.RIGHT)
End Sub
#End Region ' RightViewCommand
#Region "IsoViewSWCommand"
''' <summary>
''' Returns a command that do IsoViewSW.
''' </summary>
Public ReadOnly Property IsoViewSWCommand As ICommand
Get
If m_cmdIsoViewSW Is Nothing Then
m_cmdIsoViewSW = New Command(AddressOf IsoViewSW)
End If
Return m_cmdIsoViewSW
End Get
End Property
''' <summary>
''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand.
''' </summary>
Public Sub IsoViewSW(ByVal param As Object)
OmagOFFICEMap.refSceneHostV.ViewMode(VT.ISO_SW)
End Sub
#End Region ' IsoViewSWCommand
#End Region ' COMMANDS
End Class