quite a bit, too much to summarize here

This commit is contained in:
random() 2025-04-29 11:52:21 -06:00
parent 24845b6b52
commit 5f22d25559
336 changed files with 171740 additions and 351 deletions

View file

@ -8,7 +8,7 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
namespace JellyfinRPC
{
public partial class Form1 : Form
{
@ -35,53 +35,156 @@ namespace WindowsFormsApplication2
form.Show();
}
private static System.Timers.Timer consoleTimer;
private void Form1_Load(object sender, EventArgs e)
{
minimiseToTrayToolStripMenuItem.Checked = ConfigManager.GetEntry("MinimiseToTray", "False") == "False";
closeToTrayToolStripMenuItem.Checked = ConfigManager.GetEntry("CloseToTray", "False") == "False";
minimiseToTrayToolStripMenuItem.Checked = bool.Parse(ConfigManager.GetEntry("MinimiseToTray", "False"));
closeToTrayToolStripMenuItem.Checked = bool.Parse(ConfigManager.GetEntry("CloseToTray", "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();
}
openToTrayToolStripMenuItem.Checked = bool.Parse(ConfigManager.GetEntry("OpenToTray", "False"));
ConfigManager.GetEntry("JellyfinToken", "");
ConfigManager.GetEntry("DeviceID", $"{JellyfinAPI.DeviceID()}");
SetTimer();
JellyfinAPI.Jellyfin();
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
//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();
}
public void SetTimer()
{
consoleTimer = new System.Timers.Timer(5);
consoleTimer.Elapsed += ConsoleTimer_Elapsed;
consoleTimer.AutoReset = true;
consoleTimer.Enabled = true;
}
private void ConsoleTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
if (!listBox1.Items.Contains((object)ConsoleManager.lineToWrite))
{
listBox1.BeginInvoke((MethodInvoker)delegate
{
listBox1.Items.Add(ConsoleManager.lineToWrite);
});
}
}
catch (ArgumentNullException)
{
return;
}
}
private void Form1_Resize(object sender, EventArgs e)
{
if (ConfigManager.GetEntry("MinimiseToTray") == "True")
{
if (this.WindowState == FormWindowState.Minimized)
{
Hide();
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(3000);
this.ShowInTaskbar = false;
notifyIcon1.ShowBalloonTip(5000);
}
}
}
private void minimiseToTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ConfigManager.GetEntry("MinimiseToTray") == "True")
{
ConfigManager.SetEntry("MinimiseToTray", "False");
}
ConfigManager.SetEntry("MinimiseToTray", minimiseToTrayToolStripMenuItem.Checked.ToString());
}
if (ConfigManager.GetEntry("MinimiseToTray") == "False")
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void showToolStripMenuItem_Click(object sender, EventArgs e)
{
Show();
notifyIcon1.Visible = false;
}
private void notifyIcon1_Click(object sender, EventArgs e)
{
Show();
}
private void quitToolStripMenuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void openToTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigManager.SetEntry("OpenToTray", openToTrayToolStripMenuItem.Checked.ToString());
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (ConfigManager.GetEntry("CloseToTray") == "True")
{
ConfigManager.SetEntry("MinimiseToTray", "True");
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(5000);
}
}
else
{
Application.Exit();
}
}
private void closeToTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigManager.SetEntry("CloseToTray", closeToTrayToolStripMenuItem.Checked.ToString());
}
private void rPCSettingsToolStripMenuItem_Click(object sender, EventArgs e)
{
Form3 form = new Form3();
form.Show();
}
private void testConsoleToolStripMenuItem_Click(object sender, EventArgs e)
{
ConsoleManager.WriteToConsole("Testing Console...");
}
private void writeLabelToolStripMenuItem_Click(object sender, EventArgs e)
{
StatusManager.WriteStatusLine("Testing Status...");
}
private void checkBox1_Click(object sender, EventArgs e)
{
listBox1.Enabled = checkBox1.Checked;
}
}
}