Add files via upload

Added dark mode to the About box
This commit is contained in:
Richard Mwewa
2023-08-07 02:27:51 +02:00
committed by GitHub
parent 4c86206d0f
commit 5d144fcd00
10 changed files with 346 additions and 220 deletions

View File

@@ -23,99 +23,103 @@ Partial Class AboutBox
<System.Diagnostics.DebuggerStepThrough()> _
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

View File

@@ -118,10 +118,10 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="PictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="PictureBoxLogo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAN
0wAADdMBvdUcagAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAFPuSURBVHhe7d0J
0AAADdABEGw9BwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAFPuSURBVHhe7d0J
nBxVvTZ+ExbZVPTPX0Svonjd5b0qV0UEARXR60Xvq2yyi4DsskR2QfZNEEE2gbAIAgEEAgQIS4BAQEh6
uqfXmUkySaYHbyCsCXuSep9fJyOdzjMz3dW1nKp++Hy+H+AH6e4659T5nao6dc57PM8TERGRDkODIiIi
km40KCIiIulGgyIiIpJuNCgiIiLpRoMiIiKSbjQoIiIi6UaDIiIikm40KCIiIulGgyIiIpJuNCgiIiLp

View File

@@ -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,
''' <summary>
''' Handles the Load event for the AboutBox form.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
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
''' <summary>
''' Handles the LinkClicked event for the LinkLabelReadtheWiki control.
''' Opens the Wiki URL in the default browser.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
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
End Class

View File

@@ -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

View File

@@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@@ -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

View File

@@ -13,11 +13,11 @@
<PackageProjectUrl>https://github.com/bellingcat/reddit-post-scraping-tool</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/bellingcat/reddit-post-scraping-tool</RepositoryUrl>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<FileVersion>1.4.0.0</FileVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<FileVersion>1.4.1.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>1.4.0</Version>
<Version>1.4.1</Version>
<PackageTags>reddit;scraper;reddit-scraper;osint</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
<AnalysisLevel>6.0-recommended</AnalysisLevel>

View File

@@ -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
''' <summary>
''' Represents the Dark Mode property.
''' Indicates whether the dark mode is enabled or disabled.
''' </summary>
Public Property DarkMode As Boolean
Private ReadOnly settingsFilePath As String = Path.Combine(Environment.CurrentDirectory, "settings.json")
' Load settings from the 'settings.json' file
''' <summary>
''' Loads application settings from the 'settings.json' file.
''' If the settings file doesn't exist, it creates a new file with default settings.
''' </summary>
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
''' <summary>
''' Toggles the Dark Mode setting on or off based on the provided parameter.
''' </summary>
''' <param name="enabled">A Boolean indicating if Dark Mode should be enabled or not.</param>
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
''' <summary>
''' Saves the provided settings to the 'settings.json' file.
''' </summary>
''' <param name="settings">An instance of the SettingsManager containing the configurations to be saved.</param>
Private Sub SaveSettings(settings)
Dim jsonOutput = Text.Json.JsonSerializer.Serialize(settings)
File.WriteAllText(settingsFilePath, jsonOutput)
End Sub
' Apply theme
''' <summary>
''' 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.
''' </summary>
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'
''' <summary>
''' Retrieves the Dark Mode setting value from 'settings.json'.
''' If the settings file doesn't exist, defaults to returning 'False' (Dark Mode off).
''' </summary>
''' <returns>A Boolean indicating if Dark Mode is enabled or not.</returns>
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

View File

@@ -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

View File

@@ -35,12 +35,12 @@ Public Class StartForm
''' <summary>
''' Event handler for the 'About' menu item click.
''' It shows the 'About' dialog box.
''' It shows the 'About' box.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
AboutBox.ShowDialog()
AboutBox.Show()
End Sub
''' <summary>