From 45aacda576bbbc95b04876e4e2b18d5b4bf03949 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Thu, 23 Jan 2025 17:05:46 +0100 Subject: [PATCH] -inserimento toppanelbutton --- Application.xaml.vb | 14 ++-- Constants/ConstEgtStone3D.vb | 1 + MainWindow/MainWindowVM.vb | 9 +++ SceneButton/SceneButtonV.xaml.vb | 2 +- SceneButton/SceneButtonVM.vb | 89 +++++++++++++++++++++- SecondaryWindow/SecondaryWindowVM.vb | 2 + TopPanel/TopPanelButtonV.xaml | 110 +++++++++------------------ TopPanel/TopPanelButtonV.xaml.vb | 21 +++++ TopPanel/TopPanelV.xaml | 27 ++++++- TopPanel/TopPanelVM.vb | 6 ++ Utility/EgtStone3DDefaultStyle.xaml | 1 + 11 files changed, 191 insertions(+), 91 deletions(-) diff --git a/Application.xaml.vb b/Application.xaml.vb index 5290da7..ec665b9 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -12,13 +12,13 @@ Protected Overrides Sub OnStartup(e As StartupEventArgs) MyBase.OnStartup(e) ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose - If e.Args.Count = 0 Then - ' creo finestra SplashScreen - Dim SplashScreen As New SplashScreenV - Me.MainWindow = SplashScreen - Me.MainWindow.Show() - Map.SetRefSplashScreen(SplashScreen) - End If + 'If e.Args.Count = 0 Then + ' ' creo finestra SplashScreen + ' Dim SplashScreen As New SplashScreenV + ' Me.MainWindow = SplashScreen + ' Me.MainWindow.Show() + ' Map.SetRefSplashScreen(SplashScreen) + 'End If ' Creo la View principale Me.MainWindow = New MainWindowV ' Mostro la View principale diff --git a/Constants/ConstEgtStone3D.vb b/Constants/ConstEgtStone3D.vb index 2c52e31..7afbf5e 100644 --- a/Constants/ConstEgtStone3D.vb +++ b/Constants/ConstEgtStone3D.vb @@ -43,6 +43,7 @@ Public Const RIGHTLIST_BTN As String = "RightListBtn" Public Const BOTTOMLIST_BTN As String = "BottomListBtn" Public Const BOTTOMCENTERLIST_BTN As String = "BottomCenterListBtn" + Public Const TOPPANELLIST_BTN As String = "TopPanelListBtn" Public Const UTILITY_FOLDER As String = "Utility" diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index ad4ed2b..bc91366 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -21,6 +21,13 @@ Public Class MainWindowVM End Get End Property + Private m_SceneButtonVM As SceneButtonVM + Friend ReadOnly Property SceneButtonVM As SceneButtonVM + Get + Return m_SceneButtonVM + End Get + End Property + ' Definizione Comandi Private m_cmdAboutBox As ICommand Private m_cmdCloseApplication As ICommand @@ -36,6 +43,8 @@ Public Class MainWindowVM m_MainWindowM = New MainWindowM ' Creo Option m_OptionWindowVM = New OptionWindowVM + ' Creo SceneButton + m_SceneButtonVM = New SceneButtonVM End Sub #End Region ' Constructor diff --git a/SceneButton/SceneButtonV.xaml.vb b/SceneButton/SceneButtonV.xaml.vb index fe988f8..0bca6ba 100644 --- a/SceneButton/SceneButtonV.xaml.vb +++ b/SceneButton/SceneButtonV.xaml.vb @@ -18,7 +18,7 @@ InitializeComponent() ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). - m_refSceneButtonVM = New SceneButtonVM() + m_refSceneButtonVM = Map.refSceneButtonVM Map.SetRefSceneButtonVM(m_refSceneButtonVM) SolidManagerM.ManageUndoRedo() Me.DataContext = m_refSceneButtonVM diff --git a/SceneButton/SceneButtonVM.vb b/SceneButton/SceneButtonVM.vb index bc0b519..538425c 100644 --- a/SceneButton/SceneButtonVM.vb +++ b/SceneButton/SceneButtonVM.vb @@ -2,9 +2,13 @@ Imports EgtUILib Imports EgtWPFLib5 Public Class SceneButtonVM + Inherits VMBase #Region "FIELDS & PROPERTIES" + Public Shared m_nIndexList As Integer = 0 + Public Shared m_nIndexListConverter As Integer = 0 + Private m_TopListBtn As New List(Of SceneBtn) Public Property TopListBtn As List(Of SceneBtn) Get @@ -55,11 +59,14 @@ Public Class SceneButtonVM End Set End Property - Private m_TopPanelVM As TopPanelVM - Friend ReadOnly Property TopPanelVM As TopPanelVM + Private m_TopPanelListGroupBtn As New List(Of GroupSceneBtn) + Public Property TopPanelListGroupBtn As List(Of GroupSceneBtn) Get - Return m_TopPanelVM + Return m_TopPanelListGroupBtn End Get + Set(value As List(Of GroupSceneBtn)) + m_TopPanelListGroupBtn = value + End Set End Property #End Region ' Fields & Properties @@ -67,7 +74,9 @@ Public Class SceneButtonVM #Region "CONSTRUCTOR" Sub New() + Map.SetRefSceneButtonVM(Me) LoadButtons() + LoadGroupButtons() End Sub #End Region ' Constructor @@ -85,6 +94,17 @@ Public Class SceneButtonVM SetButtonsLocation(BOTTOMCENTERLIST_BTN, m_BottomCenterListBtn) End Sub + Private Sub LoadGroupButtons() + Dim Index As Integer = 1 + Dim SubTitle As String = String.Empty + Dim sKeyTitle As String = TOPPANELLIST_BTN & "_" & Index.ToString() + While GetMainPrivateProfileString(sKeyTitle, "SubTitle", "", SubTitle) > 0 + SetGroupButtonsLocation(sKeyTitle, m_TopPanelListGroupBtn) + Index += 1 + sKeyTitle = TOPPANELLIST_BTN & "_" & Index.ToString() + End While + End Sub + ''' ''' Funzione che permette di posizionare i bottoni letti da file ini ''' @@ -116,6 +136,14 @@ Public Class SceneButtonVM End While End Sub + Private Sub SetGroupButtonsLocation(PositionList As String, ListGroupBtn As List(Of GroupSceneBtn)) + Dim LocalListSceneBtn As New List(Of SceneBtn) + Dim SubTitle As String = String.Empty + SetButtonsLocation(PositionList, LocalListSceneBtn) + GetMainPrivateProfileString(PositionList, "SubTitle", "", SubTitle) + ListGroupBtn.Add(New GroupSceneBtn(LocalListSceneBtn, SubTitle)) + End Sub + Public Function IsTgBtnChecked(Flag As String) As Boolean ' cerco il bottone con il flag richiesto Dim Btn As _ToggleButton = m_BottomListBtn.FirstOrDefault(Function(x) x.Flag = Flag) @@ -151,6 +179,43 @@ Public Class SceneButtonVM End Class +Public Class GroupSceneBtn + +#Region "FIELDS & PROPERTIES" + + Private m_SubTitle As String + Public Property SubTitle As String + Get + Return m_SubTitle + End Get + Set(value As String) + m_SubTitle = value + End Set + End Property + + Private m_TopPanelListBtn As New List(Of SceneBtn) + Public Property TopPanelListBtn As List(Of SceneBtn) + Get + Return m_TopPanelListBtn + End Get + Set(value As List(Of SceneBtn)) + m_TopPanelListBtn = value + End Set + End Property + +#End Region ' Fields & Properties + +#Region "CONSTRUCTOR" + + Sub New(TopPanelListBtn As List(Of SceneBtn), sSubTitle As String) + m_TopPanelListBtn = TopPanelListBtn + m_SubTitle = sSubTitle + End Sub + +#End Region ' Constructor + +End Class + Public Class SceneBtn Inherits VMBase @@ -414,4 +479,20 @@ Module SceneCmd #End Region ' Methods -End Module \ No newline at end of file +End Module + +Public Class SplitConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert + Dim dValue As Double = CDbl(value) + Dim dParam As Double = Map.refSceneButtonVM.TopPanelListGroupBtn(SceneButtonVM.m_nIndexListConverter).TopPanelListBtn.Count + SceneButtonVM.m_nIndexListConverter += 1 + Return (Math.Floor(dParam / 2) + 1) * 35 + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException + End Function + +End Class \ No newline at end of file diff --git a/SecondaryWindow/SecondaryWindowVM.vb b/SecondaryWindow/SecondaryWindowVM.vb index a7ed37d..5914938 100644 --- a/SecondaryWindow/SecondaryWindowVM.vb +++ b/SecondaryWindow/SecondaryWindowVM.vb @@ -30,6 +30,7 @@ Public Class SecondaryWindowVM End Get End Property + Private m_SceneButtonVM As SceneButtonVM Public ReadOnly Property sProjectPath As String Get Dim sFilePath As String = "" @@ -73,6 +74,7 @@ Public Class SecondaryWindowVM EgtResetModified() ' segno su contatore splashscreen render finito m_WaitAfterRender = 1 + ' End Sub Private Sub SplashScreenTimer_Tick() diff --git a/TopPanel/TopPanelButtonV.xaml b/TopPanel/TopPanelButtonV.xaml index 7e6b456..025acf2 100644 --- a/TopPanel/TopPanelButtonV.xaml +++ b/TopPanel/TopPanelButtonV.xaml @@ -1,84 +1,44 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:EgtStone3D="clr-namespace:EgtStone3D" Margin="15,-5,0,0" + x:Name="GridTopPanelButton"> + + + - - - + + - - - - - - - - + + + + + + + + -