From 180bfa730eb2ce65a816dbd9991f29773c398817 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Tue, 21 Jan 2025 15:37:59 +0100 Subject: [PATCH] -piccole modifiche -aggiunto cambio colore testo -sistemato salva --- EgtStone3D.vbproj | 4 +++ MainWindow/MainWindowV.xaml.vb | 1 + MainWindow/MainWindowVM.vb | 5 +-- Move/MoveVM.vb | 32 +++++++++-------- OptionsWindow/OptionWindowVM.vb | 2 +- Pair/PairVM.vb | 46 +++++++++++++----------- Rotate/RotateVM.vb | 1 + SceneHost/MySceneHostVM.vb | 18 ++++++++-- SceneHost/SceneHostV.xaml.vb | 13 ++++--- SceneUserControl/SceneUserControlV.xaml | 1 + SceneUserControl/SceneUserControlVM.vb | 41 ++++++++++++++++++++- SecondaryWindow/SecondaryWindowV.xaml.vb | 5 +++ SecondaryWindow/SecondaryWindowVM.vb | 4 +-- 13 files changed, 123 insertions(+), 50 deletions(-) diff --git a/EgtStone3D.vbproj b/EgtStone3D.vbproj index 77208ed..e853253 100644 --- a/EgtStone3D.vbproj +++ b/EgtStone3D.vbproj @@ -69,6 +69,10 @@ x86 true + + + + ..\..\..\EgtProg\Dll32\EgtUILib.dll diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb index c0d7483..6acda0d 100644 --- a/MainWindow/MainWindowV.xaml.vb +++ b/MainWindow/MainWindowV.xaml.vb @@ -20,6 +20,7 @@ Class MainWindowV ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). Me.DataContext = m_MainWindowVM ' creo finestra della scena + AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered AddHandler Me.Loaded, AddressOf MainWindowV_Loaded Map.SetRefMainWindowV(Me) diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index 6f13989..ad4ed2b 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -1,4 +1,5 @@ -Imports EgtWPFLib5 +Imports EgtUILib.EgtInterface +Imports EgtWPFLib5 Public Class MainWindowVM Inherits VMBase @@ -42,7 +43,7 @@ Public Class MainWindowVM #Region "METHODS" Friend Sub ContentRendered() - + EgtSetView(VT.ISO_SE, False) End Sub Friend Sub CloseApplication() diff --git a/Move/MoveVM.vb b/Move/MoveVM.vb index e71fad8..7b72d84 100644 --- a/Move/MoveVM.vb +++ b/Move/MoveVM.vb @@ -5,21 +5,6 @@ Public Class MoveVM #Region "FIELDS & PROPERTIES" -#Region "Messages" - Public ReadOnly Property TopBar_Msg_Stg0 As String - Get - Return EgtMsg(110023) - End Get - End Property - - Public ReadOnly Property TopBar_Msg_Stg1 As String - Get - Return EgtMsg(110025) - End Get - End Property - -#End Region ' Messages - Private m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1}) Public ReadOnly Property MsgList As List(Of String) Get @@ -35,9 +20,26 @@ Public Class MoveVM Set(value As MoveStage) m_Stage = value DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage) + ChangeTextColor() End Set End Property +#Region "Messages" + + Public ReadOnly Property TopBar_Msg_Stg0 As String + Get + Return EgtMsg(110023) + End Get + End Property + + Public ReadOnly Property TopBar_Msg_Stg1 As String + Get + Return EgtMsg(110025) + End Get + End Property + +#End Region ' Messages + #End Region ' Fields & properties #Region "CONTRUCTOR" diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb index 2dbf332..61b5678 100644 --- a/OptionsWindow/OptionWindowVM.vb +++ b/OptionsWindow/OptionWindowVM.vb @@ -371,7 +371,7 @@ Public Class OptionWindowVM Public Sub UpdateLicenceCmd() ' Apro dialogo per richiesta file licenza Dim LicDlg As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { - .Title = EgtMsg(110020), + .Title = EgtMsg(110026), .InitialDirectory = Map.refMainWindowVM.MainWindowM.sConfigDir, .Filter = "Licences (.lic)|*.lic", .FilterIndex = 1, diff --git a/Pair/PairVM.vb b/Pair/PairVM.vb index d6a5283..87554a1 100644 --- a/Pair/PairVM.vb +++ b/Pair/PairVM.vb @@ -1,11 +1,31 @@ -Imports EgtUILib -Imports EgtWPFLib5 +Imports System.Windows.Threading +Imports EgtUILib Public Class PairVM Inherits SceneUserControlVM #Region "FIELDS & PROPERTIES" + Private m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2}) + Public ReadOnly Property MsgList As List(Of String) + Get + Return m_MsgList + End Get + End Property + + Private m_Stage As PairStage = PairStage.FirstLine + Private Property Stage As PairStage + Get + Return m_Stage + End Get + Set(value As PairStage) + m_Stage = value + DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage) + ChangeTextColor() + If m_Stage = PairStage.FacePair Then SetAllVisible() + End Set + End Property + #Region "Messages" Public ReadOnly Property TopBar_Msg_Stg0 As String @@ -13,11 +33,13 @@ Public Class PairVM Return EgtMsg(110000) End Get End Property + Public ReadOnly Property TopBar_Msg_Stg1 As String Get Return EgtMsg(110020) End Get End Property + Public ReadOnly Property TopBar_Msg_Stg2 As String Get Return EgtMsg(110021) @@ -38,25 +60,6 @@ Public Class PairVM #End Region ' Messages - Private m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2}) - Public ReadOnly Property MsgList As List(Of String) - Get - Return m_MsgList - End Get - End Property - - Private m_Stage As PairStage = PairStage.FirstLine - Private Property Stage As PairStage - Get - Return m_Stage - End Get - Set(value As PairStage) - m_Stage = value - DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage) - If m_Stage = PairStage.FacePair Then SetAllVisible() - End Set - End Property - #End Region ' Fields & Properties #Region "CONSTRUCTOR" @@ -172,6 +175,7 @@ NoSecondLine: ParamList(2).nVisibility = Visibility.Visible ParamList(3).nVisibility = Visibility.Visible End Sub + Public Overrides Sub OnCheckboxCheckedChanged(sender As Object, checkedState As Boolean) Dim CheckBox As _CheckBoxParam = DirectCast(sender, _CheckBoxParam) Select Case CheckBox.Name diff --git a/Rotate/RotateVM.vb b/Rotate/RotateVM.vb index 27bd468..88e7bd3 100644 --- a/Rotate/RotateVM.vb +++ b/Rotate/RotateVM.vb @@ -61,6 +61,7 @@ Public Class RotateVM DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage) If m_Stage = RotateStage.SelectAxis Then ShowAxis() If m_Stage = RotateStage.InsertAngle Then DirectCast(ParamList(1), _TextBoxParam).IsEnabled = True + ChangeTextColor() End Set End Property diff --git a/SceneHost/MySceneHostVM.vb b/SceneHost/MySceneHostVM.vb index 5bc59aa..0986178 100644 --- a/SceneHost/MySceneHostVM.vb +++ b/SceneHost/MySceneHostVM.vb @@ -65,7 +65,7 @@ Public Class MySceneHostVM If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then ' Apro dialogo per richiesta file licenza Dim LicDlg As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { - .Title = EgtMsg(110020), + .Title = EgtMsg(110026), .Filter = "Licences (.lic)|*.lic", .CheckFileExists = True, .ValidateNames = True @@ -232,6 +232,8 @@ Public Class MySceneHostVM Public Overrides Function SaveAsProject() As Boolean m_bIsSaveAs = True Dim sFile As String = "" + Dim sFileName As String = "" + Dim sFilter As String() = Nothing EgtGetCurrFilePath(sFile) Dim bOk As Boolean = False ' Se nome vuoto, assegno "New" @@ -245,12 +247,20 @@ Public Class MySceneHostVM If Not String.IsNullOrWhiteSpace(sDir) Then sDir = Path.GetDirectoryName(sDir) End If + Dim sFilterIndex As String = String.Empty + If String.IsNullOrWhiteSpace(sFilterIndex) Then + GetMainPrivateProfileString(S_GENERAL, "LastExstensionSave", "1", sFilterIndex) + End If + Dim nFilterIndex As Integer = 1 + If IsNumeric(sFilterIndex) Then + nFilterIndex = CInt(sFilterIndex) + End If ' Assegnazione nome file con dialogo Dim SaveFileDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { .Title = EgtMsg(110013), .Filter = "New geometry EgalTech(*.nge)|*.nge" & "|vme files (*.vme)|*.vme", - .FilterIndex = 2, + .FilterIndex = nFilterIndex, .FileName = sFile, .InitialDirectory = sDir, .ValidateNames = False, @@ -258,11 +268,13 @@ Public Class MySceneHostVM .Mode = 1 } If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then - Dim sFileName As String = SaveFileDialog.FileName + sFilter = SaveFileDialog.Filter.Split("|"c) + sFileName = SaveFileDialog.FileName & sFilter(nFilterIndex + 1).Trim("*"c) EgtSetCurrFilePath(sFileName) ' Salvataggio standard bOk = MainController.SaveProject() End If + WriteMainPrivateProfileString(S_GENERAL, "LastExstensionSave", SaveFileDialog.FilterIndex.ToString()) m_bIsSaveAs = False ' Imposto stato gestione mouse diretto della scena a nessuno MainScene.SetStatusNull() diff --git a/SceneHost/SceneHostV.xaml.vb b/SceneHost/SceneHostV.xaml.vb index f667e49..9a3b0ac 100644 --- a/SceneHost/SceneHostV.xaml.vb +++ b/SceneHost/SceneHostV.xaml.vb @@ -95,6 +95,10 @@ Public Class SceneHostV 'debug AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene + AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene + AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene + AddHandler MainScene.KeyDown, AddressOf ShiftKey_Down + AddHandler MainScene.KeyUp, AddressOf ShiftKey_Up End Sub #End Region ' Constructor @@ -226,7 +230,7 @@ Public Class SceneHostV EgtDraw() End Sub - Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles MainScene.OnMouseDownScene + Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs) If e.Button = Windows.Forms.MouseButtons.Right Then Map.refSceneButtonV.MenuSelType.IsOpen = Not Map.refSceneButtonV.MenuSelType.IsOpen Return @@ -533,7 +537,7 @@ Line1: End While End Sub - Private Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles MainScene.OnMouseUpScene + Private Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) ' Se abilitata modifica If m_bEnableEdit Then ' Se eseguito drag @@ -711,7 +715,8 @@ Line1: EgtDraw() End Sub - Private Sub ShiftKey_Down(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles MainScene.KeyDown + + Private Sub ShiftKey_Down(sender As Object, e As System.Windows.Forms.KeyEventArgs) If e.Shift Then Dim TgBtn As SceneBtn = Map.refSceneButtonVM.GetButton("Pair") If TypeOf (TgBtn) Is _ToggleButton And DirectCast(TgBtn, _ToggleButton).IsChecked Then @@ -721,7 +726,7 @@ Line1: End If End Sub - Private Sub ShiftKey_Up(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles MainScene.KeyUp + Private Sub ShiftKey_Up(sender As Object, e As System.Windows.Forms.KeyEventArgs) If Not e.Shift Then Dim TgBtn As SceneBtn = Map.refSceneButtonVM.GetButton("Pair") If TypeOf (TgBtn) Is _ToggleButton And DirectCast(TgBtn, _ToggleButton).IsChecked Then diff --git a/SceneUserControl/SceneUserControlV.xaml b/SceneUserControl/SceneUserControlV.xaml index 05bb1a2..5102298 100644 --- a/SceneUserControl/SceneUserControlV.xaml +++ b/SceneUserControl/SceneUserControlV.xaml @@ -34,6 +34,7 @@ diff --git a/SceneUserControl/SceneUserControlVM.vb b/SceneUserControl/SceneUserControlVM.vb index 7fc4aec..199b072 100644 --- a/SceneUserControl/SceneUserControlVM.vb +++ b/SceneUserControl/SceneUserControlVM.vb @@ -1,11 +1,15 @@ Imports EgtWPFLib5 Imports EgtUILib +Imports System.Windows.Threading Public Class SceneUserControlVM Inherits VMBase #Region "FIELDS & PROPERTIES" + Public m_Color_Timer As New DispatcherTimer + Public m_WaitAfterRender As Integer = 0 + Private m_Title As String Public Property Title As String Get @@ -80,6 +84,30 @@ Public Class SceneUserControlVM ParamList.Add(Control) End Sub + Public Sub ColorTimer_Tick() + If m_WaitAfterRender > 1 Then + DirectCast(ParamList(0), _TextBlockParam).Foreground_TxBl = Brushes.Black + m_Color_Timer.Stop() + ElseIf m_WaitAfterRender > 0 Then + m_WaitAfterRender += 1 + End If + End Sub + + ''' + ''' Funzione che permette di cambiare colore al foreground della textblock + ''' + Public Sub ChangeTextColor() + DirectCast(ParamList(0), _TextBlockParam).Foreground_TxBl = Brushes.Blue + m_Color_Timer.Interval = New TimeSpan(0, 0, 0, 2, 0) + AddHandler m_Color_Timer.Tick, AddressOf ColorTimer_Tick + m_WaitAfterRender = 1 + m_Color_Timer.Start() + End Sub + +#End Region ' Methods + +#Region "EVENTS" + ' Event handler for checkbox CheckedChanged Public Overridable Sub OnCheckboxCheckedChanged(sender As Object, CheckState As Boolean) End Sub @@ -90,7 +118,7 @@ Public Class SceneUserControlVM Public Overridable Sub OnTextboxTextChanged(sender As Object, Text As String) End Sub -#End Region ' Methods +#End Region ' Events #Region "COMMANDS" @@ -246,6 +274,17 @@ Public Class _TextBlockParam End Set End Property + Private m_Foreground_TxBl As Brush = Brushes.Black + Public Property Foreground_TxBl As Brush + Get + Return m_Foreground_TxBl + End Get + Set(value As Brush) + m_Foreground_TxBl = value + NotifyPropertyChanged(NameOf(Foreground_TxBl)) + End Set + End Property + #End Region ' Fields & Properties #Region "CONSTRUCTOR" diff --git a/SecondaryWindow/SecondaryWindowV.xaml.vb b/SecondaryWindow/SecondaryWindowV.xaml.vb index 81161c9..9b8e049 100644 --- a/SecondaryWindow/SecondaryWindowV.xaml.vb +++ b/SecondaryWindow/SecondaryWindowV.xaml.vb @@ -19,6 +19,7 @@ Public Class SecondaryWindowV ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). m_SecondaryWindowVM = New SecondaryWindowVM Me.DataContext = m_SecondaryWindowVM + AddHandler Me.ContentRendered, AddressOf SecondaryWindowV_ContentRendered AddHandler Me.Loaded, AddressOf SecondaryWindowV_Loaded AddHandler Me.Closing, AddressOf SecondaryWindowV_Closing AddHandler Me.LocationChanged, AddressOf SecondaryWindowV_LocationChanged @@ -35,6 +36,10 @@ Public Class SecondaryWindowV WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me) End Sub + Private Sub SecondaryWindowV_ContentRendered(sender As Object, e As EventArgs) + m_SecondaryWindowVM.ContentRendered() + End Sub + Private Sub SecondaryWindowV_LocationChanged(sender As Object, e As EventArgs) Application.Current.MainWindow.Top = Me.Top Application.Current.MainWindow.Left = Me.Left diff --git a/SecondaryWindow/SecondaryWindowVM.vb b/SecondaryWindow/SecondaryWindowVM.vb index 7eaf80b..a7ed37d 100644 --- a/SecondaryWindow/SecondaryWindowVM.vb +++ b/SecondaryWindow/SecondaryWindowVM.vb @@ -55,8 +55,6 @@ Public Class SecondaryWindowVM AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick If Not IsNothing(Map.refSplashScreen) Then m_SplashScreen_Timer.Start() - ' segno su contatore splashscreen render finito - m_WaitAfterRender = 1 End If End Sub @@ -65,7 +63,7 @@ Public Class SecondaryWindowVM #Region "METHODS" Friend Sub ContentRendered() - EgtSetView(VT.ISO_SW, False) + EgtSetView(VT.ISO_SE, False) ' provo a caricare progetto da linea di comando If Not ProcessCommandLine() Then ' altrimenti creo nuovo progetto di partenza