Added themes

This commit is contained in:
2024-05-27 20:10:52 +03:00
parent d3dd29f4bf
commit 83115d72a4
8 changed files with 261 additions and 22 deletions

View File

@@ -30,12 +30,13 @@
{
menuStrip1 = new MenuStrip();
pluginListToolStripMenuItem = new ToolStripMenuItem();
themesToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.Items.AddRange(new ToolStripItem[] { pluginListToolStripMenuItem });
menuStrip1.Items.AddRange(new ToolStripItem[] { pluginListToolStripMenuItem, themesToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(800, 24);
@@ -48,6 +49,12 @@
pluginListToolStripMenuItem.Size = new Size(74, 20);
pluginListToolStripMenuItem.Text = "Plugin List";
//
// themesToolStripMenuItem
//
themesToolStripMenuItem.Name = "themesToolStripMenuItem";
themesToolStripMenuItem.Size = new Size(60, 20);
themesToolStripMenuItem.Text = "Themes";
//
// MainWindow
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -67,5 +74,6 @@
private MenuStrip menuStrip1;
private ToolStripMenuItem pluginListToolStripMenuItem;
private ToolStripMenuItem themesToolStripMenuItem;
}
}

View File

@@ -1,27 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DiscordBotUI_Windows.WindowsForms
namespace DiscordBotUI_Windows.WindowsForms
{
public partial class MainWindow : Form
{
public MainWindow()
internal MainWindow()
{
InitializeComponent();
Load += (_, _) => MainWindowLoad();
FormClosed += async (_, _) =>
{
await Config.ApplicationSettings.SaveToFile();
};
}
private void MainWindowLoad()
{
pluginListToolStripMenuItem.Click += (_, _) => new PluginListWindow().Show();
pluginListToolStripMenuItem.Click += (_, _) =>
{
var form = new PluginListWindow();
Config.ThemeManager.SetFormTheme(Config.ThemeManager.CurrentTheme, form);
form.Show();
};
themesToolStripMenuItem.Click += (_, _) => {
themesToolStripMenuItem.DropDownItems.Clear();
foreach(var theme in Config.ThemeManager._InstalledThemes)
{
themesToolStripMenuItem.DropDownItems.Add(theme.Name, null, (_, _) => Config.ThemeManager.SetFormTheme(theme, this));
}
};
}
}
}