From e70d6b1c7078692b209c5e91dc33a2e0f8332b60 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Fri, 22 Nov 2024 11:11:29 +0100 Subject: [PATCH] Salvo nel file ini il tema selezionato --- Constants/ConstIni.vb | 1 + OptionsWindow/OptionModule.vb | 5 +++++ OptionsWindow/OptionsViewModel.vb | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 4b307a2..12e26e8 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -42,6 +42,7 @@ Module ConstIni Public Const K_EGTCAMEXE As String = "EgtCam5Exe" Public Const K_REFRESHTIME As String = "RefreshTime" Public Const K_DDFVERSION As String = "DDFVersion" + Public Const K_THEMA As String = "Thema" Public Const S_LANGUAGES As String = "Languages" Public Const K_LANGUAGE As String = "Language" diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index d29a8ab..693a89d 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -7,6 +7,9 @@ Friend Module OptionModule ' flag per modalità di visualizzazione file (solo lettura) Friend ReadOnlyDDF As Boolean = False + ' selezione tema (default=0) + Friend m_SelectedThema As Integer = 0 + ' flag per forzare l'aggiornamento delle dimensioni anta dei file DDT Friend AdjustDDT As Boolean = False Friend FileNameFromArgs As String = String.Empty @@ -376,6 +379,8 @@ Friend Module OptionModule m_AskMeAgainConfirm = If(GetMainPrivateProfileInt(S_GENERAL, K_ASKMEAGAINCONFIRM, 1) = 1, True, False) + m_SelectedThema = GetMainPrivateProfileInt(S_GENERAL, K_THEMA, 0) + ' leggo il tipo di Bevel selezionato DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELU_INI, m_bBevelUp) DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELD_INI, m_bBevelDown) diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb index b9893ec..56e20d0 100644 --- a/OptionsWindow/OptionsViewModel.vb +++ b/OptionsWindow/OptionsViewModel.vb @@ -35,9 +35,22 @@ Public Class OptionsVM Set(value As ThemeM) m_ThemesDataService.SetTheme(value) m_SelectedTheme = value + ' salvo in file ini la scelta del tema corrente + Dim IndexThema As Integer = Themes.IndexOf(m_SelectedTheme) + If IndexThema < 0 Then + IndexThema = 0 + End If + WriteMainPrivateProfileString(S_GENERALINI, K_THEMA, IndexThema.ToString) + m_SelectedThema = IndexThema End Set End Property + Public Sub SetThema(IndexThema As Integer) + If m_Themes.Count > 0 Then + m_ThemesDataService.SetTheme(m_Themes(IndexThema)) + End If + End Sub + #End Region #Region "HARDWARE PART" @@ -2073,7 +2086,10 @@ Public Class OptionsVM .Name = "Dark", .Path = "EgtDOORCreatorDarkDictionary.xaml" }) - m_SelectedTheme = m_Themes(0) + ' seleziono elemento in ComboBox + m_SelectedTheme = m_Themes(OptionModule.m_SelectedThema) + ' attivo il tema letto sopra + SetThema(OptionModule.m_SelectedThema) End Sub #Region "COMMANDS"