From bbf5d257beb7ca5170dcc78ac999cb45e4e1327b Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 5 Nov 2024 10:11:52 +0100 Subject: [PATCH] Inizio creazione nuovo tema --- Application.xaml | 14 +- Application.xaml.vb | 16 + EgtDOORCreator.vbproj | 4 + EgtDOORCreatorDarkDictionary.xaml | 55 ++ EgtDOORCreatorDictionary.xaml | 818 +++++++++++++++--------------- MainWindow/MainWindowV.xaml.vb | 5 + MainWindow/MainWindowVM.vb | 11 + SceneManager/SceneManagerV.xaml | 2 +- 8 files changed, 518 insertions(+), 407 deletions(-) create mode 100644 EgtDOORCreatorDarkDictionary.xaml diff --git a/Application.xaml b/Application.xaml index 12dcf9b..9893640 100644 --- a/Application.xaml +++ b/Application.xaml @@ -2,9 +2,19 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShutdownMode="OnMainWindowClose"> - + - + + + + + + + + + + + diff --git a/Application.xaml.vb b/Application.xaml.vb index d15b2f6..3485136 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -20,4 +20,20 @@ Class Application 'Me.MainWindow.Show() End Sub + Public Property ThemeDictionary As ResourceDictionary + ' You could probably get it via its name with some query logic as well. + Get + Return Resources.MergedDictionaries(0) + End Get + Set(value As ResourceDictionary) + End Set + End Property + + Public Sub ChangeTheme(uri As Uri) + ThemeDictionary.MergedDictionaries.Clear() + Dim rd As ResourceDictionary = New ResourceDictionary() + rd.Source = uri + ThemeDictionary.MergedDictionaries.Add(rd) ' New ResourceDictionary()) ' Source:=uri)) + End Sub + End Class diff --git a/EgtDOORCreator.vbproj b/EgtDOORCreator.vbproj index efeab80..80a64ec 100644 --- a/EgtDOORCreator.vbproj +++ b/EgtDOORCreator.vbproj @@ -278,6 +278,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/EgtDOORCreatorDarkDictionary.xaml b/EgtDOORCreatorDarkDictionary.xaml new file mode 100644 index 0000000..106e9a7 --- /dev/null +++ b/EgtDOORCreatorDarkDictionary.xaml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EgtDOORCreatorDictionary.xaml b/EgtDOORCreatorDictionary.xaml index 6609fa5..7b463fd 100644 --- a/EgtDOORCreatorDictionary.xaml +++ b/EgtDOORCreatorDictionary.xaml @@ -5,208 +5,214 @@ xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator" xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"> - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - + 0.7 + + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - - - - - - - - - - - + + + + + + + + + + + + @@ -219,133 +225,133 @@ - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - + - - - + + + + + + + + + + + - + - + - + - + - + - + - - - + + + + + + + - + - + - + - + + + + + diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb index 3cc422a..b0b6c16 100644 --- a/MainWindow/MainWindowV.xaml.vb +++ b/MainWindow/MainWindowV.xaml.vb @@ -20,6 +20,11 @@ Class MainWindowV End Sub + Private Sub MainWindowV_Init(sender As Object, e As EventArgs) Handles Me.Initialized + ' Carico il tema del programma + Map.refMainWindowVM.Themes_StartUp() + End Sub + Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded ' Carico e imposto posizione finestra WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me) diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index c0b6edb..ac1eeea 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -239,6 +239,17 @@ Public Class MainWindowVM End If End Sub + Public Sub Themes_StartUp() + Dim app As Application = CType(Application.Current, Application) + Dim nIndexTheme As Integer = 1 + If nIndexTheme = 0 Then + app.ChangeTheme(New Uri("/EgtDOORCreator;component/EgtDOORCreatorDictionary.xaml", UriKind.Relative)) + End If + If nIndexTheme = 1 Then + app.ChangeTheme(New Uri("/EgtDOORCreator;component/EgtDOORCreatorDarkDictionary.xaml", UriKind.Relative)) + End If + End Sub + #End Region ' Methods #Region "Watcher" diff --git a/SceneManager/SceneManagerV.xaml b/SceneManager/SceneManagerV.xaml index baa5723..36d4bde 100644 --- a/SceneManager/SceneManagerV.xaml +++ b/SceneManager/SceneManagerV.xaml @@ -11,7 +11,7 @@ - +