From 5d144fcd00a375a4c79e05ec50baeee2722fbbff Mon Sep 17 00:00:00 2001 From: Richard Mwewa <74001397+rly0nheart@users.noreply.github.com> Date: Mon, 7 Aug 2023 02:27:51 +0200 Subject: [PATCH] Add files via upload Added dark mode to the About box --- RPST GUI/RPST/AboutBox.Designer.vb | 171 ++++++++++++------------ RPST GUI/RPST/AboutBox.resx | 4 +- RPST GUI/RPST/AboutBox.vb | 35 +++-- RPST GUI/RPST/DeveloperForm.Designer.vb | 37 ++--- RPST GUI/RPST/DeveloperForm.resx | 62 ++++++++- RPST GUI/RPST/DeveloperForm.vb | 4 +- RPST GUI/RPST/RPST.vbproj | 6 +- RPST GUI/RPST/Settings.vb | 111 ++++++++++----- RPST GUI/RPST/StartForm.Designer.vb | 132 +++++++++--------- RPST GUI/RPST/StartForm.vb | 4 +- 10 files changed, 346 insertions(+), 220 deletions(-) diff --git a/RPST GUI/RPST/AboutBox.Designer.vb b/RPST GUI/RPST/AboutBox.Designer.vb index c2095fb..80efaa0 100644 --- a/RPST GUI/RPST/AboutBox.Designer.vb +++ b/RPST GUI/RPST/AboutBox.Designer.vb @@ -23,99 +23,103 @@ Partial Class AboutBox _ Private Sub InitializeComponent() Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(AboutBox)) - PictureBox1 = New PictureBox() + PictureBoxLogo = New PictureBox() + LabelProgramName = New Label() + LabelProgramDescription = New Label() + LabelVersion = New Label() + LinkLabelReadtheWiki = New LinkLabel() + Panel1 = New Panel() LicenseRichTextBox = New RichTextBox() - LicenseLabel = New Label() - ProgramNameLabel = New Label() - DescriptionLabel = New Label() - VersionLabel = New Label() - WikiLinkLabel = New LinkLabel() - CType(PictureBox1, ComponentModel.ISupportInitialize).BeginInit() + CType(PictureBoxLogo, ComponentModel.ISupportInitialize).BeginInit() + Panel1.SuspendLayout() SuspendLayout() ' - ' PictureBox1 + ' PictureBoxLogo ' - PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), Image) - PictureBox1.Location = New Point(28, 38) - PictureBox1.Name = "PictureBox1" - PictureBox1.Size = New Size(82, 88) - PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage - PictureBox1.TabIndex = 0 - PictureBox1.TabStop = False + PictureBoxLogo.BackColor = Color.Transparent + PictureBoxLogo.Image = CType(resources.GetObject("PictureBoxLogo.Image"), Image) + PictureBoxLogo.Location = New Point(12, 12) + PictureBoxLogo.Name = "PictureBoxLogo" + PictureBoxLogo.Size = New Size(99, 111) + PictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage + PictureBoxLogo.TabIndex = 0 + PictureBoxLogo.TabStop = False + ' + ' LabelProgramName + ' + LabelProgramName.AutoSize = True + LabelProgramName.Font = New Font("Ink Free", 14.25F, FontStyle.Bold, GraphicsUnit.Point) + LabelProgramName.ForeColor = SystemColors.ControlText + LabelProgramName.Location = New Point(4, 11) + LabelProgramName.Name = "LabelProgramName" + LabelProgramName.Size = New Size(60, 23) + LabelProgramName.TabIndex = 3 + LabelProgramName.Text = "Name" + ' + ' LabelProgramDescription + ' + LabelProgramDescription.AutoSize = True + LabelProgramDescription.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point) + LabelProgramDescription.ForeColor = SystemColors.ControlText + LabelProgramDescription.Location = New Point(4, 54) + LabelProgramDescription.Name = "LabelProgramDescription" + LabelProgramDescription.Size = New Size(73, 17) + LabelProgramDescription.TabIndex = 4 + LabelProgramDescription.Text = "Description" + ' + ' LabelVersion + ' + LabelVersion.AutoSize = True + LabelVersion.Font = New Font("Comic Sans MS", 9F, FontStyle.Underline, GraphicsUnit.Point) + LabelVersion.ForeColor = SystemColors.ControlText + LabelVersion.Location = New Point(372, 17) + LabelVersion.Name = "LabelVersion" + LabelVersion.Size = New Size(50, 17) + LabelVersion.TabIndex = 5 + LabelVersion.Text = "Version" + ' + ' LinkLabelReadtheWiki + ' + LinkLabelReadtheWiki.AutoSize = True + LinkLabelReadtheWiki.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point) + LinkLabelReadtheWiki.Location = New Point(337, 54) + LinkLabelReadtheWiki.Name = "LinkLabelReadtheWiki" + LinkLabelReadtheWiki.Size = New Size(85, 17) + LinkLabelReadtheWiki.TabIndex = 6 + LinkLabelReadtheWiki.TabStop = True + LinkLabelReadtheWiki.Text = "Read the Wiki" + ' + ' Panel1 + ' + Panel1.BackColor = SystemColors.Control + Panel1.Controls.Add(LabelProgramDescription) + Panel1.Controls.Add(LabelProgramName) + Panel1.Controls.Add(LinkLabelReadtheWiki) + Panel1.Controls.Add(LabelVersion) + Panel1.Location = New Point(117, 12) + Panel1.Name = "Panel1" + Panel1.Size = New Size(440, 111) + Panel1.TabIndex = 7 ' ' LicenseRichTextBox ' - LicenseRichTextBox.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold, GraphicsUnit.Point) - LicenseRichTextBox.Location = New Point(28, 170) + LicenseRichTextBox.Font = New Font("Cambria", 9.75F, FontStyle.Regular, GraphicsUnit.Point) + LicenseRichTextBox.Location = New Point(12, 135) LicenseRichTextBox.Name = "LicenseRichTextBox" LicenseRichTextBox.ReadOnly = True - LicenseRichTextBox.Size = New Size(513, 342) + LicenseRichTextBox.Size = New Size(545, 305) LicenseRichTextBox.TabIndex = 1 LicenseRichTextBox.Text = "License notice" ' - ' LicenseLabel - ' - LicenseLabel.AutoSize = True - LicenseLabel.Font = New Font("Microsoft JhengHei UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point) - LicenseLabel.Location = New Point(28, 150) - LicenseLabel.Name = "LicenseLabel" - LicenseLabel.Size = New Size(52, 17) - LicenseLabel.TabIndex = 2 - LicenseLabel.Text = "License" - ' - ' ProgramNameLabel - ' - ProgramNameLabel.AutoSize = True - ProgramNameLabel.Font = New Font("Microsoft JhengHei", 14.25F, FontStyle.Bold, GraphicsUnit.Point) - ProgramNameLabel.Location = New Point(126, 47) - ProgramNameLabel.Name = "ProgramNameLabel" - ProgramNameLabel.Size = New Size(66, 24) - ProgramNameLabel.TabIndex = 3 - ProgramNameLabel.Text = "Name" - ' - ' DescriptionLabel - ' - DescriptionLabel.AutoSize = True - DescriptionLabel.Font = New Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point) - DescriptionLabel.Location = New Point(126, 81) - DescriptionLabel.Name = "DescriptionLabel" - DescriptionLabel.Size = New Size(67, 15) - DescriptionLabel.TabIndex = 4 - DescriptionLabel.Text = "Description" - ' - ' VersionLabel - ' - VersionLabel.AutoSize = True - VersionLabel.Font = New Font("Segoe UI", 9F, FontStyle.Italic, GraphicsUnit.Point) - VersionLabel.Location = New Point(500, 54) - VersionLabel.Name = "VersionLabel" - VersionLabel.Size = New Size(46, 15) - VersionLabel.TabIndex = 5 - VersionLabel.Text = "Version" - ' - ' WikiLinkLabel - ' - WikiLinkLabel.AutoSize = True - WikiLinkLabel.Location = New Point(511, 81) - WikiLinkLabel.Name = "WikiLinkLabel" - WikiLinkLabel.Size = New Size(30, 15) - WikiLinkLabel.TabIndex = 6 - WikiLinkLabel.TabStop = True - WikiLinkLabel.Text = "Wiki" - ' ' AboutBox ' AutoScaleDimensions = New SizeF(7F, 15F) AutoScaleMode = AutoScaleMode.Font BackColor = Color.Gainsboro - ClientSize = New Size(569, 541) - Controls.Add(WikiLinkLabel) - Controls.Add(VersionLabel) - Controls.Add(DescriptionLabel) - Controls.Add(ProgramNameLabel) - Controls.Add(LicenseLabel) + ClientSize = New Size(569, 454) Controls.Add(LicenseRichTextBox) - Controls.Add(PictureBox1) + Controls.Add(Panel1) + Controls.Add(PictureBoxLogo) FormBorderStyle = FormBorderStyle.FixedSingle Icon = CType(resources.GetObject("$this.Icon"), Icon) MaximizeBox = False @@ -124,16 +128,17 @@ Partial Class AboutBox ShowInTaskbar = False StartPosition = FormStartPosition.CenterScreen Text = "About" - CType(PictureBox1, ComponentModel.ISupportInitialize).EndInit() + CType(PictureBoxLogo, ComponentModel.ISupportInitialize).EndInit() + Panel1.ResumeLayout(False) + Panel1.PerformLayout() ResumeLayout(False) - PerformLayout() End Sub - Friend WithEvents PictureBox1 As PictureBox + Friend WithEvents PictureBoxLogo As PictureBox + Friend WithEvents LabelProgramName As Label + Friend WithEvents LabelProgramDescription As Label + Friend WithEvents LabelVersion As Label + Friend WithEvents LinkLabelReadtheWiki As LinkLabel + Friend WithEvents Panel1 As Panel Friend WithEvents LicenseRichTextBox As RichTextBox - Friend WithEvents LicenseLabel As Label - Friend WithEvents ProgramNameLabel As Label - Friend WithEvents DescriptionLabel As Label - Friend WithEvents VersionLabel As Label - Friend WithEvents WikiLinkLabel As LinkLabel End Class diff --git a/RPST GUI/RPST/AboutBox.resx b/RPST GUI/RPST/AboutBox.resx index ba2c572..2e258c3 100644 --- a/RPST GUI/RPST/AboutBox.resx +++ b/RPST GUI/RPST/AboutBox.resx @@ -118,10 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAN - 0wAADdMBvdUcagAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAFPuSURBVHhe7d0J + 0AAADdABEGw9BwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAFPuSURBVHhe7d0J nBxVvTZ+ExbZVPTPX0Svonjd5b0qV0UEARXR60Xvq2yyi4DsskR2QfZNEEE2gbAIAgEEAgQIS4BAQEh6 uqfXmUkySaYHbyCsCXuSep9fJyOdzjMz3dW1nKp++Hy+H+AH6e4659T5nao6dc57PM8TERGRDkODIiIi km40KCIiIulGgyIiIpJuNCgiIiLpRoMiIiKSbjQoIiIi6UaDIiIikm40KCIiIulGgyIiIpJuNCgiIiLp diff --git a/RPST GUI/RPST/AboutBox.vb b/RPST GUI/RPST/AboutBox.vb index a8ebb19..94e4242 100644 --- a/RPST GUI/RPST/AboutBox.vb +++ b/RPST GUI/RPST/AboutBox.vb @@ -1,7 +1,10 @@ -Public Class AboutBox - Public Property LicenseText As String = "MIT License +Imports System.Runtime -Copyright (c) 2023-2024 Richard Mwewa +Public Class AboutBox + ReadOnly settings As New SettingsManager() + Public Property LicenseText As String = $"MIT License + +{My.Application.Info.Copyright} Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal @@ -21,16 +24,30 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." - Private Sub AboutForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load - ProgramNameLabel.Text = My.Application.Info.AssemblyName - DescriptionLabel.Text = "Given a subreddit name and a keyword, + ''' + ''' Handles the Load event for the AboutBox form. + ''' + ''' The source of the event. + ''' The event data. + Private Sub AboutBox_Load(sender As Object, e As EventArgs) Handles MyBase.Load + settings.LoadSettings() + settings.ToggleDarkMode(settings.DarkMode) + + LabelProgramName.Text = My.Application.Info.AssemblyName + LabelProgramDescription.Text = "Given a subreddit name and a keyword, RPST returns all top posts (by default) that contain the specified keyword." - VersionLabel.Text = $"v{My.Application.Info.Version}" + LabelVersion.Text = $"v{My.Application.Info.Version}" LicenseRichTextBox.Text = LicenseText End Sub - Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles WikiLinkLabel.LinkClicked + ''' + ''' Handles the LinkClicked event for the LinkLabelReadtheWiki control. + ''' Opens the Wiki URL in the default browser. + ''' + ''' The source of the event. + ''' The event data. + Private Sub LinkLabelReadtheWiki_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabelReadtheWiki.LinkClicked Shell("cmd /c start https://github.com/bellingcat/reddit-post-scraping-tool/wiki") End Sub -End Class \ No newline at end of file +End Class diff --git a/RPST GUI/RPST/DeveloperForm.Designer.vb b/RPST GUI/RPST/DeveloperForm.Designer.vb index db4173f..e09b593 100644 --- a/RPST GUI/RPST/DeveloperForm.Designer.vb +++ b/RPST GUI/RPST/DeveloperForm.Designer.vb @@ -24,7 +24,7 @@ Partial Class DeveloperForm Private Sub InitializeComponent() Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(DeveloperForm)) AboutMeLinkLabel = New LinkLabel() - BuyMeACoffeeLinkLabel = New LinkLabel() + LinkLabelBuyMeACoffee = New LinkLabel() GreetingLabel = New Label() SuspendLayout() ' @@ -32,37 +32,42 @@ Partial Class DeveloperForm ' AboutMeLinkLabel.AutoSize = True AboutMeLinkLabel.BackColor = Color.White + AboutMeLinkLabel.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point) AboutMeLinkLabel.Location = New Point(33, 426) AboutMeLinkLabel.Name = "AboutMeLinkLabel" - AboutMeLinkLabel.Size = New Size(60, 15) + AboutMeLinkLabel.Size = New Size(57, 17) AboutMeLinkLabel.TabIndex = 0 AboutMeLinkLabel.TabStop = True - AboutMeLinkLabel.Text = "About.me"' - ' BuyMeACoffeeLinkLabel + AboutMeLinkLabel.Text = "About.me" + ' + ' LinkLabelBuyMeACoffee + ' + LinkLabelBuyMeACoffee.AutoSize = True + LinkLabelBuyMeACoffee.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point) + LinkLabelBuyMeACoffee.Location = New Point(33, 451) + LinkLabelBuyMeACoffee.Name = "LinkLabelBuyMeACoffee" + LinkLabelBuyMeACoffee.Size = New Size(101, 17) + LinkLabelBuyMeACoffee.TabIndex = 1 + LinkLabelBuyMeACoffee.TabStop = True + LinkLabelBuyMeACoffee.Text = "Buy Me A Coffee" ' - BuyMeACoffeeLinkLabel.AutoSize = True - BuyMeACoffeeLinkLabel.Location = New Point(33, 451) - BuyMeACoffeeLinkLabel.Name = "BuyMeACoffeeLinkLabel" - BuyMeACoffeeLinkLabel.Size = New Size(96, 15) - BuyMeACoffeeLinkLabel.TabIndex = 1 - BuyMeACoffeeLinkLabel.TabStop = True - BuyMeACoffeeLinkLabel.Text = "Buy Me A Coffee"' ' GreetingLabel ' GreetingLabel.AutoSize = True - GreetingLabel.Font = New Font("Verdana", 27.75F, FontStyle.Bold, GraphicsUnit.Point) + GreetingLabel.Font = New Font("Ink Free", 27.75F, FontStyle.Bold, GraphicsUnit.Point) GreetingLabel.Location = New Point(62, 22) GreetingLabel.Name = "GreetingLabel" - GreetingLabel.Size = New Size(382, 45) + GreetingLabel.Size = New Size(355, 46) GreetingLabel.TabIndex = 3 - GreetingLabel.Text = "Hello, I'm Ritchie"' + GreetingLabel.Text = "👋🏾Hello, I'm Ritchie" + ' ' DeveloperForm ' AutoScaleDimensions = New SizeF(7F, 15F) AutoScaleMode = AutoScaleMode.Font BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), Image) ClientSize = New Size(510, 510) - Controls.Add(BuyMeACoffeeLinkLabel) + Controls.Add(LinkLabelBuyMeACoffee) Controls.Add(AboutMeLinkLabel) Controls.Add(GreetingLabel) FormBorderStyle = FormBorderStyle.FixedSingle @@ -78,7 +83,7 @@ Partial Class DeveloperForm End Sub Friend WithEvents AboutMeLinkLabel As LinkLabel - Friend WithEvents BuyMeACoffeeLinkLabel As LinkLabel + Friend WithEvents LinkLabelBuyMeACoffee As LinkLabel Friend WithEvents PictureBox1 As PictureBox Friend WithEvents GreetingLabel As Label End Class diff --git a/RPST GUI/RPST/DeveloperForm.resx b/RPST GUI/RPST/DeveloperForm.resx index 64172ac..c13c1d9 100644 --- a/RPST GUI/RPST/DeveloperForm.resx +++ b/RPST GUI/RPST/DeveloperForm.resx @@ -1,4 +1,64 @@ - + + + diff --git a/RPST GUI/RPST/DeveloperForm.vb b/RPST GUI/RPST/DeveloperForm.vb index 007cc52..0e879d7 100644 --- a/RPST GUI/RPST/DeveloperForm.vb +++ b/RPST GUI/RPST/DeveloperForm.vb @@ -2,7 +2,7 @@ Private Sub DeveloperForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load GreetingLabel.BackColor = Color.Transparent AboutMeLinkLabel.BackColor = Color.Transparent - BuyMeACoffeeLinkLabel.BackColor = Color.Transparent + LinkLabelBuyMeACoffee.BackColor = Color.Transparent End Sub Private Sub AboutMeLinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles AboutMeLinkLabel.LinkClicked @@ -11,7 +11,7 @@ Shell("cmd /c start https://about.me/rly0nheart") End Sub - Private Sub BuyMeACoffeeLinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles BuyMeACoffeeLinkLabel.LinkClicked + Private Sub BuyMeACoffeeLinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabelBuyMeACoffee.LinkClicked Shell("cmd /c start https://buymeacoffee.com/_rly0nheart") End Sub End Class \ No newline at end of file diff --git a/RPST GUI/RPST/RPST.vbproj b/RPST GUI/RPST/RPST.vbproj index 0c08e75..557fe79 100644 --- a/RPST GUI/RPST/RPST.vbproj +++ b/RPST GUI/RPST/RPST.vbproj @@ -13,11 +13,11 @@ https://github.com/bellingcat/reddit-post-scraping-tool README.md https://github.com/bellingcat/reddit-post-scraping-tool - 1.4.0.0 - 1.4.0.0 + 1.4.1.0 + 1.4.1.0 LICENSE True - 1.4.0 + 1.4.1 reddit;scraper;reddit-scraper;osint 6.0-recommended diff --git a/RPST GUI/RPST/Settings.vb b/RPST GUI/RPST/Settings.vb index 7230860..ef310e1 100644 --- a/RPST GUI/RPST/Settings.vb +++ b/RPST GUI/RPST/Settings.vb @@ -1,16 +1,22 @@ -Imports Newtonsoft.Json -Imports Newtonsoft.Json.Linq -Imports System.IO -Imports System.Runtime +Imports System.IO Imports System.Text.Json +Imports Newtonsoft.Json.Linq + Public Class SettingsManager + ''' + ''' Represents the Dark Mode property. + ''' Indicates whether the dark mode is enabled or disabled. + ''' Public Property DarkMode As Boolean + Private ReadOnly settingsFilePath As String = Path.Combine(Environment.CurrentDirectory, "settings.json") - - ' Load settings from the 'settings.json' file + ''' + ''' Loads application settings from the 'settings.json' file. + ''' If the settings file doesn't exist, it creates a new file with default settings. + ''' Public Sub LoadSettings() ' Check if the settings.json file exists ' and load the configurations from it @@ -33,7 +39,10 @@ Public Class SettingsManager End Sub - ' Toggle Dark mode + ''' + ''' Toggles the Dark Mode setting on or off based on the provided parameter. + ''' + ''' A Boolean indicating if Dark Mode should be enabled or not. Public Sub ToggleDarkMode(enabled As Boolean) Dim json As String = File.ReadAllText(settingsFilePath) Dim options As New JsonSerializerOptions With {.PropertyNameCaseInsensitive = True} @@ -43,69 +52,99 @@ Public Class SettingsManager ApplyTheme() End Sub - - ' Save current settings to settings.json + ''' + ''' Saves the provided settings to the 'settings.json' file. + ''' + ''' An instance of the SettingsManager containing the configurations to be saved. Private Sub SaveSettings(settings) Dim jsonOutput = Text.Json.JsonSerializer.Serialize(settings) File.WriteAllText(settingsFilePath, jsonOutput) End Sub - ' Apply theme + ''' + ''' Applies the visual theme based on the Dark Mode setting. + ''' If Dark Mode is enabled, a dark theme is applied. If it's disabled, a light theme is set. + ''' Public Sub ApplyTheme() Dim DarkMode As Boolean = GetDarkMode() If DarkMode Then + ' Enable dark mode for the Main form StartForm.BackColor = ColorTranslator.FromHtml("#FF121212") StartForm.ToolsToolStripMenuTools.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") StartForm.KeywordTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.KeywordTextBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.KeywordTextBox.ForeColor = SystemColors.Control StartForm.SubredditTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.SubredditTextBox.ForeColor = SystemColors.Control StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control StartForm.ListingComboBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.ListingComboBox.ForeColor = SystemColors.Control StartForm.TimeframeComboBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") - StartForm.TimeframeComboBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") - StartForm.Label1.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") - StartForm.Label2.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") - StartForm.Label3.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") - StartForm.Label4.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") - StartForm.Label5.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.TimeframeComboBox.ForeColor = SystemColors.Control + StartForm.LabelKeyword.ForeColor = SystemColors.Control + StartForm.LabelSubreddit.ForeColor = SystemColors.Control + StartForm.LabelLimit.ForeColor = SystemColors.Control + StartForm.LabelListing.ForeColor = SystemColors.Control + StartForm.LabelTimeframe.ForeColor = SystemColors.Control + + ' Enable dark mode for the About box + AboutBox.BackColor = ColorTranslator.FromHtml("#FF121212") + AboutBox.ForeColor = SystemColors.Control + AboutBox.LicenseRichTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E") + AboutBox.LicenseRichTextBox.ForeColor = SystemColors.Control + AboutBox.Panel1.BackColor = ColorTranslator.FromHtml("#FF121212") + AboutBox.LabelProgramName.ForeColor = SystemColors.Control + AboutBox.LabelProgramDescription.ForeColor = SystemColors.Control + AboutBox.LabelVersion.ForeColor = SystemColors.Control Else - StartForm.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.BackColor = SystemColors.Control StartForm.ToolsToolStripMenuTools.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.KeywordTextBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.KeywordTextBox.BackColor = SystemColors.Control StartForm.KeywordTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.SubredditTextBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.SubredditTextBox.BackColor = SystemColors.Control StartForm.SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.LimitNumericUpDown.BackColor = SystemColors.Control StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.LimitNumericUpDown.BackColor = SystemColors.Control StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.ListingComboBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.ListingComboBox.BackColor = SystemColors.Control StartForm.ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.TimeframeComboBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF") + StartForm.TimeframeComboBox.BackColor = SystemColors.Control StartForm.TimeframeComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.Label1.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.Label2.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.Label3.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.Label4.ForeColor = ColorTranslator.FromHtml("#FF121212") - StartForm.Label5.ForeColor = ColorTranslator.FromHtml("#FF121212") + StartForm.LabelKeyword.ForeColor = ColorTranslator.FromHtml("#FF121212") + StartForm.LabelSubreddit.ForeColor = ColorTranslator.FromHtml("#FF121212") + StartForm.LabelLimit.ForeColor = ColorTranslator.FromHtml("#FF121212") + StartForm.LabelListing.ForeColor = ColorTranslator.FromHtml("#FF121212") + StartForm.LabelTimeframe.ForeColor = ColorTranslator.FromHtml("#FF121212") + + ' Disable dark mode for the About box + AboutBox.BackColor = Color.Gainsboro + AboutBox.ForeColor = SystemColors.WindowText + AboutBox.LicenseRichTextBox.BackColor = SystemColors.Control + AboutBox.LicenseRichTextBox.ForeColor = SystemColors.WindowText + AboutBox.Panel1.BackColor = Color.Gainsboro + AboutBox.Panel1.ForeColor = SystemColors.WindowText + AboutBox.LabelProgramName.ForeColor = SystemColors.WindowText + AboutBox.LabelProgramDescription.ForeColor = SystemColors.WindowText + AboutBox.LabelVersion.ForeColor = SystemColors.WindowText End If End Sub - ' Get dark mode state from settings.json's key 'DarkMode' + ''' + ''' Retrieves the Dark Mode setting value from 'settings.json'. + ''' If the settings file doesn't exist, defaults to returning 'False' (Dark Mode off). + ''' + ''' A Boolean indicating if Dark Mode is enabled or not. Private Function GetDarkMode() As Boolean If File.Exists(settingsFilePath) Then Dim json As String = File.ReadAllText(settingsFilePath) Dim settings As JObject = JObject.Parse(json) - Return settings("DarkMode").ToObject(Of Boolean)() + Return settings(NameOf(DarkMode)).ToObject(Of Boolean)() Else Return False End If End Function - End Class \ No newline at end of file diff --git a/RPST GUI/RPST/StartForm.Designer.vb b/RPST GUI/RPST/StartForm.Designer.vb index 03a6051..8a28c27 100644 --- a/RPST GUI/RPST/StartForm.Designer.vb +++ b/RPST GUI/RPST/StartForm.Designer.vb @@ -29,11 +29,11 @@ Partial Class StartForm ScrapeButton = New Button() TimeframeComboBox = New ComboBox() ListingComboBox = New ComboBox() - Label1 = New Label() - Label2 = New Label() - Label3 = New Label() - Label4 = New Label() - Label5 = New Label() + LabelKeyword = New Label() + LabelSubreddit = New Label() + LabelLimit = New Label() + LabelListing = New Label() + LabelTimeframe = New Label() ContextMenuStrip1 = New ContextMenuStrip(components) SaveResultsStripMenuItem = New ToolStripMenuItem() JSONToolStripMenuItem = New ToolStripMenuItem() @@ -100,60 +100,60 @@ Partial Class StartForm ListingComboBox.TabIndex = 9 ListingComboBox.Text = "Top" ' - ' Label1 + ' LabelKeyword ' - Label1.AutoEllipsis = True - Label1.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point) - Label1.ForeColor = Color.Black - Label1.Location = New Point(12, 60) - Label1.Name = "Label1" - Label1.Size = New Size(56, 23) - Label1.TabIndex = 10 - Label1.Text = "Keyword" + LabelKeyword.AutoEllipsis = True + LabelKeyword.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point) + LabelKeyword.ForeColor = Color.Black + LabelKeyword.Location = New Point(12, 60) + LabelKeyword.Name = "LabelKeyword" + LabelKeyword.Size = New Size(56, 23) + LabelKeyword.TabIndex = 10 + LabelKeyword.Text = "Keyword" ' - ' Label2 + ' LabelSubreddit ' - Label2.AutoEllipsis = True - Label2.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point) - Label2.ForeColor = Color.Black - Label2.Location = New Point(12, 92) - Label2.Name = "Label2" - Label2.Size = New Size(63, 23) - Label2.TabIndex = 11 - Label2.Text = "Subreddit" + LabelSubreddit.AutoEllipsis = True + LabelSubreddit.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point) + LabelSubreddit.ForeColor = Color.Black + LabelSubreddit.Location = New Point(12, 92) + LabelSubreddit.Name = "LabelSubreddit" + LabelSubreddit.Size = New Size(63, 23) + LabelSubreddit.TabIndex = 11 + LabelSubreddit.Text = "Subreddit" ' - ' Label3 + ' LabelLimit ' - Label3.AutoEllipsis = True - Label3.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) - Label3.ForeColor = Color.Black - Label3.Location = New Point(12, 125) - Label3.Name = "Label3" - Label3.Size = New Size(56, 23) - Label3.TabIndex = 12 - Label3.Text = "Limit" + LabelLimit.AutoEllipsis = True + LabelLimit.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) + LabelLimit.ForeColor = Color.Black + LabelLimit.Location = New Point(12, 125) + LabelLimit.Name = "LabelLimit" + LabelLimit.Size = New Size(56, 23) + LabelLimit.TabIndex = 12 + LabelLimit.Text = "Limit" ' - ' Label4 + ' LabelListing ' - Label4.AutoEllipsis = True - Label4.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) - Label4.ForeColor = Color.Black - Label4.Location = New Point(12, 157) - Label4.Name = "Label4" - Label4.Size = New Size(56, 23) - Label4.TabIndex = 13 - Label4.Text = "Listing" + LabelListing.AutoEllipsis = True + LabelListing.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) + LabelListing.ForeColor = Color.Black + LabelListing.Location = New Point(12, 157) + LabelListing.Name = "LabelListing" + LabelListing.Size = New Size(56, 23) + LabelListing.TabIndex = 13 + LabelListing.Text = "Listing" ' - ' Label5 + ' LabelTimeframe ' - Label5.AutoEllipsis = True - Label5.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) - Label5.ForeColor = Color.Black - Label5.Location = New Point(12, 191) - Label5.Name = "Label5" - Label5.Size = New Size(71, 23) - Label5.TabIndex = 14 - Label5.Text = "Timeframe" + LabelTimeframe.AutoEllipsis = True + LabelTimeframe.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point) + LabelTimeframe.ForeColor = Color.Black + LabelTimeframe.Location = New Point(12, 191) + LabelTimeframe.Name = "LabelTimeframe" + LabelTimeframe.Size = New Size(71, 23) + LabelTimeframe.TabIndex = 14 + LabelTimeframe.Text = "Timeframe" ' ' ContextMenuStrip1 ' @@ -221,7 +221,7 @@ Partial Class StartForm AboutToolStripMenuItem.AutoToolTip = True AboutToolStripMenuItem.Image = CType(resources.GetObject("AboutToolStripMenuItem.Image"), Image) AboutToolStripMenuItem.Name = "AboutToolStripMenuItem" - AboutToolStripMenuItem.Size = New Size(180, 22) + AboutToolStripMenuItem.Size = New Size(152, 22) AboutToolStripMenuItem.Text = "About" ' ' DeveloperToolStripMenuItem @@ -229,7 +229,7 @@ Partial Class StartForm DeveloperToolStripMenuItem.AutoToolTip = True DeveloperToolStripMenuItem.Image = CType(resources.GetObject("DeveloperToolStripMenuItem.Image"), Image) DeveloperToolStripMenuItem.Name = "DeveloperToolStripMenuItem" - DeveloperToolStripMenuItem.Size = New Size(180, 22) + DeveloperToolStripMenuItem.Size = New Size(152, 22) DeveloperToolStripMenuItem.Text = "Developer" ' ' CheckUpdatesToolStripMenuItem @@ -237,20 +237,20 @@ Partial Class StartForm CheckUpdatesToolStripMenuItem.AutoToolTip = True CheckUpdatesToolStripMenuItem.Image = CType(resources.GetObject("CheckUpdatesToolStripMenuItem.Image"), Image) CheckUpdatesToolStripMenuItem.Name = "CheckUpdatesToolStripMenuItem" - CheckUpdatesToolStripMenuItem.Size = New Size(180, 22) + CheckUpdatesToolStripMenuItem.Size = New Size(152, 22) CheckUpdatesToolStripMenuItem.Text = "Check updates" ' ' ToolStripSeparator2 ' ToolStripSeparator2.Name = "ToolStripSeparator2" - ToolStripSeparator2.Size = New Size(177, 6) + ToolStripSeparator2.Size = New Size(149, 6) ' ' QuitToolStripMenuItem ' QuitToolStripMenuItem.AutoToolTip = True QuitToolStripMenuItem.Image = CType(resources.GetObject("QuitToolStripMenuItem.Image"), Image) QuitToolStripMenuItem.Name = "QuitToolStripMenuItem" - QuitToolStripMenuItem.Size = New Size(180, 22) + QuitToolStripMenuItem.Size = New Size(152, 22) QuitToolStripMenuItem.Text = "Quit" ' ' LimitNumericUpDown @@ -267,16 +267,16 @@ Partial Class StartForm ' AutoScaleDimensions = New SizeF(7F, 15F) AutoScaleMode = AutoScaleMode.Font - BackColor = Color.White + BackColor = SystemColors.Control ClientSize = New Size(355, 255) ContextMenuStrip = ContextMenuStrip1 Controls.Add(LimitNumericUpDown) Controls.Add(FileMenuStrip) - Controls.Add(Label5) - Controls.Add(Label4) - Controls.Add(Label3) - Controls.Add(Label2) - Controls.Add(Label1) + Controls.Add(LabelTimeframe) + Controls.Add(LabelListing) + Controls.Add(LabelLimit) + Controls.Add(LabelSubreddit) + Controls.Add(LabelKeyword) Controls.Add(ListingComboBox) Controls.Add(TimeframeComboBox) Controls.Add(SubredditTextBox) @@ -302,11 +302,11 @@ Partial Class StartForm Friend WithEvents ScrapeButton As Button Friend WithEvents TimeframeComboBox As ComboBox Friend WithEvents ListingComboBox As ComboBox - Friend WithEvents Label1 As Label - Friend WithEvents Label2 As Label - Friend WithEvents Label3 As Label - Friend WithEvents Label4 As Label - Friend WithEvents Label5 As Label + Friend WithEvents LabelKeyword As Label + Friend WithEvents LabelSubreddit As Label + Friend WithEvents LabelLimit As Label + Friend WithEvents LabelListing As Label + Friend WithEvents LabelTimeframe As Label Friend WithEvents ContextMenuStrip1 As ContextMenuStrip Friend WithEvents FileMenuStrip As MenuStrip Friend WithEvents ToolsToolStripMenuTools As ToolStripMenuItem diff --git a/RPST GUI/RPST/StartForm.vb b/RPST GUI/RPST/StartForm.vb index 5619bba..9b78ecb 100644 --- a/RPST GUI/RPST/StartForm.vb +++ b/RPST GUI/RPST/StartForm.vb @@ -35,12 +35,12 @@ Public Class StartForm ''' ''' Event handler for the 'About' menu item click. - ''' It shows the 'About' dialog box. + ''' It shows the 'About' box. ''' ''' The source of the event. ''' An EventArgs that contains the event data. Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click - AboutBox.ShowDialog() + AboutBox.Show() End Sub '''