//public FormCredits(FormOptions formOptions)
        //{
        //    InitializeComponent();
        //    _formOptions = formOptions;
        //}
        //public void SetCredits(string credits)
        //{
        //    richTextBox1.Rtf = credits;
        //}
        public void GetAndShowCredits(string selectedItem, FormOptions formOptions)
        {
            try
            {
                _selectedPack = selectedItem;
                _formOptions = formOptions;
                CreditsThread = new Thread(new ThreadStart(this.DoWorkCreditInfo));

                CreditsThread.Start();
                while (!CreditsThread.IsAlive) ;
            }
            catch (Exception ex)
            {
                (ParentForm as FormMain).ErrorReporting(ex, false);
            }
        }
        //Events
        private void FormMain_Load(object sender, EventArgs e)
        {
            try
            {
            #if(DEBUG)
                buttonDebug.Visible = true;
                textBoxDebug.Visible = true;
            #endif

                _globalPackDir = Application.StartupPath + "\\Minecraft Packs";

                GenerateTweetList();
                StartCheckingServers();

                _formOptions = new FormOptions(this);

                _loadingSettings = true;

                foreach (string folder in Directory.GetDirectories(_globalPackDir))
                    comboBoxPackSelect.Items.Add(folder.Replace(_globalPackDir + "\\", ""));
                if (comboBoxPackSelect.Items.Count > 0)
                    comboBoxPackSelect.SelectedIndex = 0;

                for (int i = 0; i < comboBoxPackSelect.Items.Count; i++)
                {
                    if (comboBoxPackSelect.Items[i].ToString() == _formOptions.Settings.LastPlayedServer)
                    {
                        comboBoxPackSelect.SelectedIndex = i;
                        break;
                    }
                }

                if (_formOptions.Settings.RememberLogin)
                {

                    textBoxPassword.Text = _formOptions.Settings.Password;
                    textBoxUsername.Text = _formOptions.Settings.Username;
                    checkBoxRememberLoginInfo.Checked = _formOptions.Settings.RememberLogin;

                }

                _loadingSettings = false;

                if (_updateFinished)
                {
                    //_formOptions.GetClientUpdateInfo().UpdateNews
                    if (IsNetworkAvailable())
                    {
                        if (_formNews == null || _formNews.IsDisposed)
                            _formNews = new FormNews(_formOptions.GetClientUpdateInfo().UpdateNews);
                        _formNews.Show();
                        _formNews.Focus();
                    }
                    else
                    {
                        MessageBox.Show("Could not find a valid internet connection." + Environment.NewLine + "Please check that you have access to the internet on this machine, and try again", "ClientUpdate News skipped: No internet found", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    if (IsNetworkAvailable())
                    {
                        updateThread = new Thread(new ThreadStart(CheckForClientUpdate));
                        updateThread.Start();
                        while (!updateThread.IsAlive) ;
                    }
                    else
                    {
                        MessageBox.Show("Could not find a valid internet connection." + Environment.NewLine + "Please check that you have access to the internet on this machine, and try again", "ClientUpdate check skipped: No internet found", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

            }
            catch (Exception ex)
            {
                //List<string> information = new List<string>();
                //information.Add("Error: " + ex.Message);
                //ErrorReporting("FormMain_Load()", information, true);

                ErrorReporting(ex, true);
                //MessageBox.Show("Program initialization failed." + Environment.NewLine + "Error message: " + ex.Message, "An error occurred :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //check for new client version

            //if(File.Exists(Application.StartupPath + "\\KBG Minecraft Launcher2.exe"))
            //{
            //    //File.Delete(Application.StartupPath + "\\KBG Minecraft Launcher2.exe");
            //    File.Copy(Application.StartupPath + "\\KBG Minecraft Launcher2.exe", Application.StartupPath + "\\KBG Minecraft Launcher.exe", true);
            //    File.Delete(Application.StartupPath + "\\KBG Minecraft Launcher2.exe");
            //}

            //if (_formOptions.GetClientVersion() < _formOptions.GetClientUpdateInfo().Version)
            //{
            //    if (MessageBox.Show("A new version of the client is avalible. Update now?", "New update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
            //    {
            //        DownloadFile(new Uri(_formOptions.KBGClientUpdateUrl), Application.StartupPath + "\\KBG Minecraft Launcher2.exe");
            //        MessageBox.Show("The update was downloaded. The client will now restart!");
            //        Process.Start(Application.StartupPath + "\\KBG Minecraft Launcher2.exe");
            //        this.Close();
            //    }
            //}
        }
        private void buttonOptions_Click(object sender, EventArgs e)
        {
            try
            {
                if (_formOptions == null || _formOptions.IsDisposed)
                    _formOptions = new FormOptions(this);
                else
                {
                    _formOptions.WindowState = FormWindowState.Normal;
                    _formOptions.Activate();
                }
                _formOptions.Show();
            }
            catch (Exception ex)
            {
                ErrorReporting(ex, false);

            }
        }