Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);

            Application.EnableVisualStyles();

            if (ZeoSettings.Default.LicenseAgree == false)
            {
                DialogResult result = MessageBox.Show(File.ReadAllText("LICENSE"), "Accept the terms of License Agreement?", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    ZeoSettings.Default.LicenseAgree = true;
                    ZeoSettings.Default.Save();
                }
                else
                {
                    return;
                }
            }

            using (MainScreen frm = new MainScreen())
            {
                try
                {
                    frm.InitializeComponent();
                }
                catch (ZeoException ex)
                {
                    if (ex.InnerException != null)
                    {
                        MessageBox.Show(ex.Message, "Install DirectX Runtime", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Environment.Exit(1);
                    }
                }

                if (args.Length > 0)
                {
                    if (File.Exists(args[0]))
                    {
                        frm.LoadFile(args[0]);
                    }
                }

                // While the form is still valid, render and process messages
                MessagePump.Run(frm, () =>
                {
                    if (frm.WindowState != FormWindowState.Minimized)
                    {
                        frm.Render();
                        Thread.Sleep(10);
                    }
                });
            }
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);

            Application.EnableVisualStyles();

            if (ZeoSettings.Default.LicenseAgree == false)
            {
                DialogResult result = MessageBox.Show(File.ReadAllText("LICENSE"), "Accept the terms of License Agreement?", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    ZeoSettings.Default.LicenseAgree = true;
                    ZeoSettings.Default.Save();
                }
                else
                {
                    return;
                }
            }

            using (MainScreen frm = new MainScreen())
            {
                try
                {
                    frm.InitializeComponent();
                }
                catch (ZeoException ex)
                {
                    if (ex.InnerException != null)
                    {
                        MessageBox.Show(ex.Message, "Install DirectX Runtime", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Environment.Exit(1);
                    }
                }

                if (args.Length > 0)
                {
                    if (File.Exists(args[0]))
                    {
                        frm.LoadFile(args[0]);
                    }
                }

                // While the form is still valid, render and process messages
                MessagePump.Run(frm, () =>
                    {
                        if (frm.WindowState != FormWindowState.Minimized)
                        {
                            frm.Render();
                            Thread.Sleep(10);
                        }
                    });
            }
        }