public ChatForm(ChatFormSettings chatFormSettings)
 {
     InitializeComponent();
     this.chatFormSettings = chatFormSettings;
     coroutineManager.Init();
     Text = chatFormSettings.Channel;
     coroutineManager.StartCoroutine(Init());
 }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int index = selectedIndex;

            radios[index].Text = textBox1.Text;
            button1.Enabled    = false;
            chatFormSettings[index].Channel = textBox1.Text;

            Thread t = new Thread(() =>
            {
                var settings = chatFormSettings[index];
                var a        = new ChatForm(settings);
                chatFormSettings[index].Current = a;
                a.ChangedEvent(this, new EventArgs());
                a.Show();
                while (true)
                {
                    if (a.hasClosed)
                    {
                        break;
                    }
                    Application.DoEvents();
                    a.CustomUpdate();
                    Thread.Sleep(1);
                }
                a.Dispose();
                GC.Collect();
                chatFormSettings[index] = ChatFormSettings.Default();
                radios[index].Invoke((MethodInvoker)(() => radios[index].Text = "Empty"));
                if (radios[index].Checked)
                {
                    button1.Invoke((MethodInvoker)(() => button1.Enabled = true));
                }
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            textBox1.Text = "";
        }
Exemple #3
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;
        }