From 5eecf956b52381aa1d5ee623caa4cc90daff4b75 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Tue, 18 Oct 2016 15:51:58 +0000 Subject: [PATCH] =?UTF-8?q?EgtCAM5=20:=20-=20Tradotti=20un=20po'=20di=20me?= =?UTF-8?q?ssaggi=20in=20italiano.=20-=20Aggiunta=20possibilit=C3=A0=20in?= =?UTF-8?q?=20Db=20utensili=20e=20lavorazioni=20di=20annullare=20le=20modi?= =?UTF-8?q?fiche=20apportate=20ad=20un=20elemento=20premendo=20il=20tasto?= =?UTF-8?q?=20Esc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Constants/ConstIni.vb | 3 + Constants/ConstMsg.vb | 1 + IniFile.vb | 19 +++++- MachiningsDbWindow/MachiningsDbView.xaml | 5 +- MachiningsDbWindow/MachiningsDbViewModel.vb | 32 ++++++++++ MainWindow/MainWindowViewModel.vb | 20 ++++++- OptionsWindow/OptionsView.xaml | 5 +- OptionsWindow/OptionsViewModel.vb | 21 ++++++- ProjectPage/DbPanel/DbPanelView.xaml | 8 +-- ProjectPage/DbPanel/DbPanelViewModel.vb | 30 ++++++++++ ProjectPage/DrawPanel/DrawPanelView.xaml | 21 +++++-- ProjectPage/DrawPanel/DrawPanelViewModel.vb | 25 ++++++++ .../InfoExpander/InfoExpanderView.xaml | 5 +- .../InfoExpander/InfoExpanderViewModel.vb | 10 ++++ .../InputExpander/InputExpanderViewModel.vb | 11 +--- .../ManageLayerExpanderView.xaml | 55 +++++++++++++---- .../ManageLayerExpanderViewModel.vb | 60 +++++++++++++++++++ .../OperationExpanderView.xaml | 6 +- .../OperationExpanderViewModel.vb | 19 +++++- .../SimulationExpanderView.xaml | 16 +++-- .../SimulationExpanderViewModel.vb | 35 +++++++++++ ProjectPage/ProjectViewModel.vb | 2 +- ToolsDbWindow/ToolsDbView.xaml | 4 ++ ToolsDbWindow/ToolsDbViewModel.vb | 32 ++++++++++ TopCommandBar/TopCommandBarView.xaml | 4 +- TopCommandBar/TopCommandBarViewModel.vb | 15 +++++ Utility.vb | 31 ++++++++++ 27 files changed, 446 insertions(+), 49 deletions(-) diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index a0e22e5..d7f9594 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -36,6 +36,9 @@ Module ConstIni Public Const K_TRANSFORM As String = "Transform" Public Const K_ONLYDRAW As String = "OnlyDraw" + Public Const S_LANGUAGES As String = "Languages" + Public Const K_LANGUAGE As String = "Language" + Public Const S_LUA As String = "Lua" Public Const K_LIBSDIR As String = "LibsDir" Public Const K_BASELIB As String = "BaseLib" diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb index 113a448..16ac167 100644 --- a/Constants/ConstMsg.vb +++ b/Constants/ConstMsg.vb @@ -9,6 +9,7 @@ Public Const MSG_DRAWPANEL As Integer = MSG_EGTCAM5 + 200 Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTCAM5 + 250 Public Const MSG_SIMULATION As Integer = MSG_EGTCAM5 + 300 + Public Const MSG_DRAWOPTION As Integer = MSG_EGTCAM5 + 350 Public Const MSG_OPERATION As Integer = MSG_EGTCAM5 + 400 Public Const MSG_DISPOSITION As Integer = MSG_EGTCAM5 + 430 Public Const MSG_DISPOSITIONERRORS As Integer = MSG_EGTCAM5 + 460 diff --git a/IniFile.vb b/IniFile.vb index e7dd651..b99be4a 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -1,4 +1,5 @@ -Imports EgtUILib +Imports System.Collections.ObjectModel +Imports EgtUILib Module IniFile @@ -34,6 +35,8 @@ Module IniFile Friend m_bDrawShowGrid As Boolean Friend m_bMachiningShowGrid As Boolean = False Friend m_bShowGridFrame As Boolean + Friend m_LanguageList As New ObservableCollection(Of Language) + Friend m_SelectedLanguage As Language ' Project Page Friend m_ProjectSceneContext As Integer = 0 Friend m_bScriptRunning As Boolean = False @@ -103,6 +106,20 @@ Module IniFile Return False End Function + Public Function GetPrivateProfileLanguage( + ByVal lpAppName As String, + ByVal lpKeyName As String) As Language + + Dim sVal As String = String.Empty + GetPrivateProfileString(lpAppName, lpKeyName, "", sVal) + Dim sItems() As String = sVal.Split(",".ToCharArray) + If sItems.Count() = 2 Then + Return New Language(sItems(0), sItems(1)) + End If + Return Nothing + + End Function + Public Function WritePrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile) End Function diff --git a/MachiningsDbWindow/MachiningsDbView.xaml b/MachiningsDbWindow/MachiningsDbView.xaml index 4a28e33..a92a44b 100644 --- a/MachiningsDbWindow/MachiningsDbView.xaml +++ b/MachiningsDbWindow/MachiningsDbView.xaml @@ -12,7 +12,10 @@ IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" CloseCommand="{Binding CloseMachiningsDbCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" CloseCommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"> - + + + diff --git a/MachiningsDbWindow/MachiningsDbViewModel.vb b/MachiningsDbWindow/MachiningsDbViewModel.vb index eb8fec5..cef83c5 100644 --- a/MachiningsDbWindow/MachiningsDbViewModel.vb +++ b/MachiningsDbWindow/MachiningsDbViewModel.vb @@ -32,6 +32,7 @@ Namespace EgtCAM5 Private m_cmdNew As ICommand Private m_cmdSave As ICommand Private m_cmdRemove As ICommand + Private m_cmdReloadMachining As ICommand Private m_cmdCloseMachiningsDb As ICommand #Region "MESSAGES" @@ -581,6 +582,37 @@ Namespace EgtCAM5 #End Region ' RemoveCommand +#Region "ReloadMachiningCommand" + + ''' + ''' Returns a command that reload the current selected tool. + ''' + Public ReadOnly Property ReloadMachiningCommand() As ICommand + Get + If m_cmdReloadMachining Is Nothing Then + m_cmdReloadMachining = New RelayCommand(AddressOf ReloadMachining) + End If + Return m_cmdReloadMachining + End Get + End Property + + ''' + ''' Reload the current selected tools. This method is invoked by the RemoveCommand. + ''' + Public Sub ReloadMachining(ByVal param As Object) + If TypeOf param Is FamilyMachiningTreeViewItem Then + Return + ' Verifico se sia selezionato un utensile + ElseIf TypeOf param Is MachiningTreeViewItem Then + Dim MachiningToReload As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + MachiningToReload.ReadMachiningParam() + MachiningToReload.IsModifiedReset() + End If + End Sub + +#End Region ' ReloadMachiningCommand + #Region "CloseMachiningsDbCommand" ''' diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb index 273fab7..a744b04 100644 --- a/MainWindow/MainWindowViewModel.vb +++ b/MainWindow/MainWindowViewModel.vb @@ -339,10 +339,24 @@ Namespace EgtCAM5 If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then sMsgDir = m_sConfigDir End If + ' Leggo elenco lingue disponibili da file ini + Dim nIndex As Integer = 1 + Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex) + While Not IsNothing(ReadLanguage) + IniFile.m_LanguageList.Add(ReadLanguage) + nIndex += 1 + ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex) + End While ' Leggo file messaggi - Dim sMsgFile As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgFile) - Dim sMsgFilePath As String = sMsgDir & "\" & sMsgFile + Dim sMsgName As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName) + Dim sMsgFilePath As String = sMsgDir & "\EgalTechIta.txt" + For Each Language In IniFile.m_LanguageList + If Language.Name = sMsgName Then + IniFile.m_SelectedLanguage = Language + sMsgFilePath = sMsgDir & "\" & Language.FilePath + End If + Next If Not EgtLoadMessages(sMsgFilePath) Then EgtOutLog("Error in EgtLoadMessages") End If diff --git a/OptionsWindow/OptionsView.xaml b/OptionsWindow/OptionsView.xaml index 65052ec..3241e19 100644 --- a/OptionsWindow/OptionsView.xaml +++ b/OptionsWindow/OptionsView.xaml @@ -10,7 +10,10 @@ CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> - + + diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb index 7759fe5..ec71b40 100644 --- a/OptionsWindow/OptionsViewModel.vb +++ b/OptionsWindow/OptionsViewModel.vb @@ -1,9 +1,28 @@ -Imports EgtUILib +Imports System.Collections.ObjectModel +Imports EgtUILib Namespace EgtCAM5 Public Class OptionsViewModel + Public ReadOnly Property LanguageList As ObservableCollection(Of Language) + Get + Return IniFile.m_LanguageList + End Get + End Property + + Public Property SelectedLanguage As Language + Get + Return IniFile.m_SelectedLanguage + End Get + Set(value As Language) + If value IsNot IniFile.m_SelectedLanguage Then + IniFile.m_SelectedLanguage = value + WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name) + End If + End Set + End Property + Private m_Title As String Public ReadOnly Property Title As String Get diff --git a/ProjectPage/DbPanel/DbPanelView.xaml b/ProjectPage/DbPanel/DbPanelView.xaml index ff630b4..c951abe 100644 --- a/ProjectPage/DbPanel/DbPanelView.xaml +++ b/ProjectPage/DbPanel/DbPanelView.xaml @@ -3,10 +3,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - - + + + + - - - - + + diff --git a/TopCommandBar/TopCommandBarViewModel.vb b/TopCommandBar/TopCommandBarViewModel.vb index ba69b79..41564f6 100644 --- a/TopCommandBar/TopCommandBarViewModel.vb +++ b/TopCommandBar/TopCommandBarViewModel.vb @@ -25,6 +25,21 @@ Namespace EgtCAM5 Private m_cmdExport As ICommand Private m_cmdOptions As ICommand +#Region "Messages" + + Public ReadOnly Property DrawMsg As String + Get + Return EgtMsg(MSG_MAINWINDOW + 1) + End Get + End Property + Public ReadOnly Property MachiningMsg As String + Get + Return EgtMsg(MSG_MAINWINDOW + 2) + End Get + End Property + +#End Region ' Messages + #Region "ToolTip" 'Proprietà ToolTip diff --git a/Utility.vb b/Utility.vb index 1aa8d44..02a8945 100644 --- a/Utility.vb +++ b/Utility.vb @@ -122,4 +122,35 @@ Public Module Utility #End Region + Public Class Language + + Private m_sName As String + Private m_sFilePath As String + + Public Property Name As String + Get + Return m_sName + End Get + Set(value As String) + m_sName = value + End Set + End Property + + Public Property FilePath As String + Get + Return m_sFilePath + End Get + Set(value As String) + m_sFilePath = value + End Set + End Property + + Sub New(sName As String, sFilePath As String) + Me.Name = sName + Me.FilePath = sFilePath + End Sub + + End Class + + End Module