예제 #1
0
파일: Program.cs 프로젝트: Rulfy/OpenRA
        public static void Main(string[] args)
        {
            settings = new Settings(Platform.SupportDir + "settings.yaml", new Arguments());

            var form = new Form
            {
                Size = new Size(315, 140),
                Text = "Fatal Error",
                MinimizeBox = false,
                MaximizeBox = false,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                StartPosition = FormStartPosition.CenterScreen,
                Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
            };

            var notice = new Label
            {
                Location = new Point(10, 10),
                AutoSize = true,
                Text = "OpenRA has encountered a fatal error and must close.{0}Refer to the crash logs and FAQ for more information.".F(Environment.NewLine),
                TextAlign = ContentAlignment.TopCenter
            };
            form.Controls.Add(notice);

            var dontShowAgain = new CheckBox
            {
                Location = new Point(25, 50),
                AutoSize = true,
                Text = "Don't show this message again",
            };
            form.Controls.Add(dontShowAgain);

            var viewLogs = new Button
            {
                Location = new Point(10, 80),
                Size = new Size(75, 23),
                Text = "View Logs"
            };
            viewLogs.Click += ViewLogsClicked;
            form.Controls.Add(viewLogs);

            var viewFaq = new Button
            {
                Location = new Point(90, 80),
                Size = new Size(75, 23),
                Text = "View FAQ"
            };
            viewFaq.Click += ViewFaqClicked;
            form.Controls.Add(viewFaq);

            var quit = new Button
            {
                Location = new Point(225, 80),
                Size = new Size(75, 23),
                Text = "Quit"
            };
            quit.DialogResult = DialogResult.Cancel;
            form.Controls.Add(quit);

            form.FormClosed += (sender, e) =>
            {
                settings.Debug.ShowFatalErrorDialog = !dontShowAgain.Checked;
                settings.Save();
            };

            SystemSounds.Exclamation.Play();
            form.ShowDialog();
        }