예제 #1
0
        private void generalToolStripMenuItem_Click(object sender, EventArgs e2)
        {
            SettingsForm a = new SettingsForm();

            a.saved += (o, e) =>
            {
                generalSettings = TwitchSettings.Interpret(JsonConvert.DeserializeObject <dynamic>(File.ReadAllText("settings.json")));
            };
            a.Show();
        }
예제 #2
0
        public MainForm()
        {
            InitializeComponent();
            CheckGeneralSettings();
            //Emojis.Init();
            generalSettings = TwitchSettings.Interpret(JsonConvert.DeserializeObject <dynamic>(File.ReadAllText("settings.json")));
            if (Directory.Exists("./.AutoUpdater"))
            {
                string fileName = "./.AutoUpdater/AutoUpdater.exe";
                File.Delete("./AutoUpdater.exe");
                File.Copy(fileName, "./AutoUpdater.exe");
                File.Delete(fileName);
                Directory.Delete("./.AutoUpdater");
                MessageBox.Show("Update Complete!");
            }
            new Thread(() =>
            {
                Emojis.codeToEmoji.ToString();
            }).Start();
#if !DEBUG
            using (WebClient client = new WebClient())
            {
                string v = "";
                try
                {
                    v = client.DownloadString("http://blog.detolly.no/version.txt");
                }
                catch
                {
                    v = version;
                    MessageBox.Show("Internet connection not present. Please connect to the internet to use this application.");
                }
                if (v != version)
                {
                    DialogResult result = MessageBox.Show("New update available. \nNew update version: " + v + "\n Want to update?", "Update", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        Process.Start("AutoUpdater.exe", "--url=\"http://blog.detolly.no/TwitchChat-" + v + ".zip");
                        Process.GetCurrentProcess().Kill();
                    }
                }
            }
#endif
            Fontlabel.Text = defaultFont.Name + ", " + defaultFont.Size;
            radios         = new RadioButton[] {
                radioButton1,
                radioButton2,
                radioButton3,
                radioButton4,
                radioButton5,
                radioButton6
            };
            amountOfThings   = radios.Length;
            chatFormSettings = new ChatFormSettings[amountOfThings];
            for (int i = 0; i < amountOfThings; i++)
            {
                chatFormSettings[i] = ChatFormSettings.Default();
            }
            foreach (var s in (ChatModes[])Enum.GetValues(typeof(ChatModes)))
            {
                ChatmodeBox.Items.Add(s);
            }
            foreach (var s in (FormBorderStyle[])Enum.GetValues(typeof(FormBorderStyle)))
            {
                BorderstyleBox.Items.Add(s);
            }
            radioButton1.Checked = true;
        }