using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Http;

namespace JellyfinRPC
{
    public partial class ConfigForm : Form
    {
        public ConfigForm()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            ConfigManager.SetEntry("ServerURL", textBox1.Text);
            ConfigManager.SetEntry("APIKey", maskedTextBox1.Text);
            ConfigManager.SetEntry("UserID", textBox2.Text);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        static string quickConnectLabel;
        private async void ConfigForm_Load(object sender, EventArgs e)
        {
            textBox1.Text = ConfigManager.GetEntry("ServerURL");
            textBox2.Text = ConfigManager.GetEntry("UserID");
            maskedTextBox1.Text = ConfigManager.GetEntry("APIKey");
            textBox4.Text = ConfigManager.GetEntry("ServerURL");
            textBox5.Text = ConfigManager.GetEntry("ServerURL");
            quickConnectLabel = await JellyfinAPI.SendQuickConnectRequest();
            label9.Text = quickConnectLabel;
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click_1(object sender, EventArgs e)
        {

        }

        private void tabPage2_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            ConfigManager.SetEntry("ServerURL", textBox4.Text); 
        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {
            ConfigManager.SetEntry("ServerURL", textBox5.Text);
        }
    }
}
