private void MainForm_Load(object sender, EventArgs e)
        {
            int btnCtr = 0;

            if (!string.IsNullOrEmpty(Settings.Default.WebsiteUrl))
            {

                CataButton btn = new CataButton();
                btn.Size = new Size(97, 39);
                btn.Name = "webButton";
                btn.ButtonText = "Website";
                btn.Location = new Point((97 * btnCtr) + 25, 469);
                btn.Click += (s, args) => Process.Start(Settings.Default.WebsiteUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;

            }

            if (!string.IsNullOrEmpty(Settings.Default.ForumsUrl))
            {

                CataButton btn = new CataButton();
                btn.Size = new Size(97, 39);
                btn.Name = "frmButton";
                btn.ButtonText = "Forums";
                btn.Location = new Point((97 * btnCtr) + 25, 469);
                btn.Click += (s, args) => Process.Start(Settings.Default.ForumsUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;

            }

            if (!string.IsNullOrEmpty(Settings.Default.VoteUrl))
            {

                CataButton btn = new CataButton();
                btn.Size = new Size(97, 39);
                btn.Name = "voteBtn";
                btn.ButtonText = "Vote";
                btn.Location = new Point((97 * btnCtr) + 25, 469);
                btn.Click += (s, args) => Process.Start(Settings.Default.VoteUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;

            }

            if (!string.IsNullOrEmpty(Settings.Default.DonateUrl))
            {

                CataButton btn = new CataButton();
                btn.Size = new Size(97, 39);
                btn.Name = "donateBtn";
                btn.ButtonText = "Donate";
                btn.Location = new Point((97 * btnCtr) + 25, 469);
                btn.Click += (s, args) => Process.Start(Settings.Default.DonateUrl);

                Controls.Add(btn);

                btn.BringToFront();

            }

            if (string.IsNullOrEmpty(Settings.Default.WowLocation) || !Directory.Exists(Settings.Default.WowLocation))
            {

                if (!string.IsNullOrEmpty(WoW.Directory))
                {
                    Settings.Default.WowLocation = WoW.Directory;
                    Settings.Default.Save();
                }
                else
                {
                    using (SettingsForm form = new SettingsForm())
                        form.ShowDialog();
                }

            }

            TransparencyKey = Color.Lime;

            downloadBar1.BarState = DownloadBar.DownloadBarState.Setup;

            checkServerStatusBackgroundWorker.RunWorkerAsync();

            try
            {

                string path = WoW.RealmListLocation;

                if (!string.IsNullOrEmpty(path) && File.Exists(path))
                {
                    using (StreamWriter writer = new StreamWriter(path))
                    {

                        writer.WriteLine(Settings.Default.realmlist);
                        writer.Flush();

                        writer.Close();

                    }
                }

                if (Settings.Default.patchDownloadURL != String.Empty)
                    startDownloadBackgroundWorker.RunWorkerAsync();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cata Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (SettingsForm sForm = new SettingsForm())
     {
         sForm.ShowDialog();
     }
 }
Exemple #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            playButtonPictureBox.Image   = Properties.Resources.play_disabled;
            playButtonPictureBox.Enabled = false;

            int btnCtr = 0;

            if (!string.IsNullOrEmpty(Settings.Default.WebsiteUrl))
            {
                CataButton btn = new CataButton();
                btn.Size       = new Size(97, 39);
                btn.Name       = "webButton";
                btn.ButtonText = "Homepage";
                btn.Location   = new Point((97 * btnCtr) + 50, 469);
                btn.Click     += (s, args) => Process.Start(Settings.Default.WebsiteUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;
            }

            if (!string.IsNullOrEmpty(Settings.Default.ForumsUrl))
            {
                CataButton btn = new CataButton();
                btn.Size       = new Size(97, 39);
                btn.Name       = "frmButton";
                btn.ButtonText = "Forum";
                btn.Location   = new Point((97 * btnCtr) + 50, 469);
                btn.Click     += (s, args) => Process.Start(Settings.Default.ForumsUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;
            }

            if (!string.IsNullOrEmpty(Settings.Default.VoteUrl))
            {
                CataButton btn = new CataButton();
                btn.Size       = new Size(97, 39);
                btn.Name       = "voteBtn";
                btn.ButtonText = "Vote";
                btn.Location   = new Point((97 * btnCtr) + 25, 469);
                btn.Click     += (s, args) => Process.Start(Settings.Default.VoteUrl);

                Controls.Add(btn);

                btn.BringToFront();

                btnCtr++;
            }

            if (!string.IsNullOrEmpty(Settings.Default.DonateUrl))
            {
                CataButton btn = new CataButton();
                btn.Size       = new Size(97, 39);
                btn.Name       = "donateBtn";
                btn.ButtonText = "Donate";
                btn.Location   = new Point((97 * btnCtr) + 25, 469);
                btn.Click     += (s, args) => Process.Start(Settings.Default.DonateUrl);

                Controls.Add(btn);

                btn.BringToFront();
            }

            if (string.IsNullOrEmpty(Settings.Default.WowLocation) || !Directory.Exists(Settings.Default.WowLocation))
            {
                if (!string.IsNullOrEmpty(WoW.Directory))
                {
                    Settings.Default.WowLocation = WoW.Directory;
                    Settings.Default.Save();
                }
                else
                {
                    using (SettingsForm form = new SettingsForm())
                        form.ShowDialog();
                }
            }

            TransparencyKey = Color.Lime;

            downloadBar1.BarState = DownloadBar.DownloadBarState.Setup;

            checkServerStatusBackgroundWorker.RunWorkerAsync();

            try
            {
                string path = WoW.RealmListLocation;

                if (!string.IsNullOrEmpty(path) && File.Exists(path))
                {
                    using (StreamWriter writer = new StreamWriter(path))
                    {
                        writer.WriteLine(Settings.Default.realmlist);
                        writer.Flush();

                        writer.Close();
                    }
                }

                if (Settings.Default.patchDownloadURL != String.Empty)
                {
                    startDownloadBackgroundWorker.RunWorkerAsync();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ATN Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }