Skip to content

Commit

Permalink
Goodbye, My.Settings and My.Computer
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmartinez committed Nov 23, 2020
1 parent 4d072d8 commit 4380c83
Show file tree
Hide file tree
Showing 50 changed files with 778 additions and 905 deletions.
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 12.0 (TBD, 2021)
• Move from RTF-based files to HTML-based files
• Convert remaining code to C#
• Port to .NET 5

Version 11.1 (June 14, 2020)
• Bug Fix: https:// URLs in the website field wouldn't open
• Bug Fix: Character files imported from the character editor weren't imported correctly
Expand Down
11 changes: 1 addition & 10 deletions src/LangPad/AppInstance.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,13 @@ Module AppInstance
''' </summary>
Public ApplicationTheme As Theme

''' <summary>
''' The local characters as a string array.
''' </summary>
Public ReadOnly Property AppLocalCharacters As String()
Get
Return Lines.Get(My.Settings.CustomCharacters)
End Get
End Property

''' <summary>
''' Get the icon resolution set by the user.
''' </summary>
'''
''' <returns>The user's icon resolution.</returns>
Public Function GetIconResolution() As IconResolution
If My.Settings.HiDPI Then
If Config.HiDPI Then
Return IconResolution.HiDPI
Else
Return IconResolution.Normal
Expand Down
11 changes: 3 additions & 8 deletions src/LangPad/AppLoad.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ Module AppLoad
''' Load the application.
''' </summary>
Public Sub LoadApplication()
Config.LoadSettingsFile()
Dim Settings = Config.Test
Config.Test = "new value"

SplashScreenForm.Show()

BeginOperation(MainForm)
BeginOperation(CharEditWindow)

Expand Down Expand Up @@ -81,19 +76,19 @@ Module AppLoad
Next

UpdateSplash(80, "Loading Local Custom Characters...")
For Each LocalCharacter As String In AppLocalCharacters
For Each LocalCharacter As String In Config.LocalChars
CharEditWindow.CharEdit.InsertCharacterButton(LocalCharacter, CharEditWindow.CharEdit.LocalPanel)
Next

UpdateSplash(90, "Loading Smart Replace...")
If My.Settings.SmartReplace = True Then
If Config.SmartReplace = True Then
SplashScreenForm.LoadingLabel.Text = "Loading Smart Replace..."
For Each pair As KeyValuePair(Of String, String) In KeyValue.Read(My.Resources.SmartReplace)
SmartReplaceList.Add(pair.Key, pair.Value)
Next
End If

If My.Settings.Updates = True Then
If Config.UpdateOnStartup = True Then
UpdateSplash(95, "Checking for Updates...")
SplashScreenForm.LoadingLabel.Text = "Checking for updates..."
CheckForUpdates()
Expand Down
5 changes: 3 additions & 2 deletions src/LangPad/AppTheme.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Imports LangPadUI
Imports LangPadData
Imports LangPadUI
Imports LangPadUI.Theming

''' <summary>
Expand Down Expand Up @@ -27,7 +28,7 @@ Module AppTheme
InitCharEditTheme()

' Get saved theme
Dim SavedTheme = Themer.GetTheme(My.Settings.Theme)
Dim SavedTheme = Themer.GetTheme(Config.Theme)
' Default to light theme if none found
If SavedTheme Is Nothing Then
SavedTheme = New Themes.DefaultTheme()
Expand Down
2 changes: 1 addition & 1 deletion src/LangPad/AutoUpdater.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Module AutoUpdater
''' Check for updates and display a dialog if there are any
''' </summary>
Public Sub CheckForUpdates()
Dim ScreenSize = My.Computer.Screen.Bounds.Size
Dim ScreenSize = Screen.PrimaryScreen.Bounds
Dim OldSize = AutoUpdaterDotNET.AutoUpdater.UpdateFormSize
AutoUpdaterDotNET.AutoUpdater.UpdateFormSize = New Size(ScreenSize.Width / 2, If(OldSize Is Nothing, ScreenSize.Height / 2, OldSize.Value.Height))
AutoUpdaterDotNET.AutoUpdater.Start("https://raw.githubusercontent.com/ianmartinez/LangPad/master/update/update.xml")
Expand Down
17 changes: 9 additions & 8 deletions src/LangPad/Dialogs/SettingsDialog.vb
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Public Class SettingsDialog
Imports LangPadData

Public Class SettingsDialog
Private Sub SettingsDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
UpdatesOnStartupCheck.Checked = My.Settings.Updates
LargeIconsCheck.Checked = My.Settings.HiDPI
ShowCharEditCheck.Checked = My.Settings.ShowCharacterEditorOnStartup
UpdatesOnStartupCheck.Checked = Config.UpdateOnStartup
LargeIconsCheck.Checked = Config.HiDPI
ShowCharEditCheck.Checked = Config.ShowCharacterEditorOnStartup
End Sub

Private Sub OkDialogButton_Click(sender As Object, e As EventArgs) Handles OkDialogButton.Click
My.Settings.Updates = UpdatesOnStartupCheck.Checked
My.Settings.HiDPI = LargeIconsCheck.Checked
My.Settings.ShowCharacterEditorOnStartup = ShowCharEditCheck.Checked
My.Settings.Save()
Config.UpdateOnStartup = UpdatesOnStartupCheck.Checked
Config.HiDPI = LargeIconsCheck.Checked
Config.ShowCharacterEditorOnStartup = ShowCharEditCheck.Checked

' Refresh icons to DPI setting
MainForm.SetIcons()
Expand Down
Loading

0 comments on commit 4380c83

Please sign in to comment.