jellyfin-rich-presence/WindowsFormsApplication2/Form1.cs
2025-04-21 17:54:03 -06:00

87 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 form = new AboutBox1();
form.Show();
}
private void quitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void serverConfigToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigForm form = new ConfigForm();
form.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
minimiseToTrayToolStripMenuItem.Checked = ConfigManager.GetEntry("MinimiseToTray", "False") == "False";
closeToTrayToolStripMenuItem.Checked = ConfigManager.GetEntry("CloseToTray", "False") == "False";
ConfigManager.GetEntry("ApiKey", "");
ConfigManager.GetEntry("ServerURL", "");
ConfigManager.GetEntry("UserID", "");
ConfigManager.GetEntry("JellyfinToken", "");
if (ConfigManager.GetEntry("JellyfinToken") == "" && ConfigManager.GetEntry("ApiKey") == "")
{
ConfigForm form = new ConfigForm();
form.Show();
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
Form1 form = new Form1();
form.Show();
}
private void Form1_Resize(object sender, EventArgs e)
{
if (ConfigManager.GetEntry("MinimiseToTray") == "True")
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(3000);
this.ShowInTaskbar = false;
}
}
}
private void minimiseToTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ConfigManager.GetEntry("MinimiseToTray") == "True")
{
ConfigManager.SetEntry("MinimiseToTray", "False");
}
if (ConfigManager.GetEntry("MinimiseToTray") == "False")
{
ConfigManager.SetEntry("MinimiseToTray", "True");
}
}
}
}