bfd3f21e25
- Aggiunti Dizionari per i temi e ComboBox in OptionsPageUC per il cambio dei temi. Questa versione di OmagCUT funziona esattamente come la precedente, come se non ci fossero i temi, perché la scelta dei temi è nascosta (ThemesGpBx.Visibility = Windows.Visibility.Collapsed in OptionsPageUC.xaml.vb)
64 lines
2.2 KiB
VB.net
64 lines
2.2 KiB
VB.net
Imports System.Windows.Forms
|
|
|
|
Class Application
|
|
|
|
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
|
|
' can be handled in this file.
|
|
|
|
'Protected Overrides Sub OnStartup(e As StartupEventArgs)
|
|
' MyBase.OnStartup(e)
|
|
' Dim mainWindow As New MainWindow
|
|
' Dim thisDpiWidthFactor As Double
|
|
' Dim thisDpiHeightFactor As Double
|
|
' mainWindow.Show()
|
|
' 'Controllo che abbia creato la finestra per evitare crash se non c'è la chiave
|
|
' If (IsNothing(Application.Current)) Then
|
|
' Exit Sub
|
|
' End If
|
|
' CalculateDpiFactors(mainWindow, thisDpiWidthFactor, thisDpiHeightFactor)
|
|
|
|
|
|
' If (Screen.AllScreens.Length > 1) Then
|
|
' Dim s2 As Screen = Screen.AllScreens(1)
|
|
' Dim r2 As System.Drawing.Rectangle = s2.WorkingArea
|
|
|
|
' mainWindow.Top = r2.Top / thisDpiHeightFactor
|
|
' mainWindow.Left = r2.Left / thisDpiWidthFactor
|
|
|
|
|
|
' Else
|
|
' Dim s1 As Screen = Screen.AllScreens(0)
|
|
' Dim r1 As System.Drawing.Rectangle = s1.WorkingArea
|
|
' mainWindow.Top = r1.Top
|
|
' mainWindow.Left = r1.Left
|
|
|
|
|
|
' End If
|
|
'End Sub
|
|
|
|
'Private Shared Sub CalculateDpiFactors(ByRef mainwindow As Window, ByRef thisDpiWidthFactor As Double, ByRef thisDpiHeightFactor As Double)
|
|
' Dim MainWindowPresentationSource As PresentationSource = PresentationSource.FromVisual(Application.Current.MainWindow)
|
|
' Dim m As New Matrix
|
|
' m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice
|
|
' thisDpiWidthFactor = m.M11
|
|
' thisDpiHeightFactor = m.M22
|
|
'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
|