Пример #1
0
        private void tsmiHowDoI_Click(object sender, EventArgs e)
        {
            String helpPath = System.IO.Path.Combine(Directories.GetDocDirectory(), "Help.pdf");

            if (!System.IO.File.Exists(helpPath))
            {
                UserErrors.BadInstallation("documentation", false);
            }
            else
            {
                System.Diagnostics.Process.Start("explorer", helpPath);
            }
        }
Пример #2
0
        static void Main(String[] args)
        {
            try
            { SettingsManager.GetRef().Load(); }
            catch (Exception)
            {
                UserErrors.ConfigFileCorrupted("File with user settings", "using default settings");
                SettingsManager.GetRef().Reset();
            }

            try
            {
                System.AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveHandler);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                if (args.Length == 1)
                {
                    if (args[0] == "--auto_start")
                    {
                        if (System.IO.File.Exists(SettingsManager.GetRef().GuiSettings.DefaultCellFile))
                        {
                            Application.Run(new MainForm(SettingsManager.GetRef().GuiSettings.DefaultCellFile));
                        }
                        else
                        {
                            Application.Run(new MainForm());
                        }
                    }
                    else
                    {
                        Application.Run(new MainForm(args[0]));
                    }
                }
                else
                {
                    Application.Run(new MainForm());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Global error has been detected. Program will be closed{0}Details: {1}",
                                              Environment.NewLine, ex.ToString()),
                                "Global error");
                Environment.Exit(0);
            }
        }
Пример #3
0
        private void PerformAction(GuiAction action, Object arg, bool pausePlayback)
        {
            bool timerEnabled = false;

            if (timer != null)
            {
                timerEnabled  = timer.Enabled;
                timer.Enabled = false;
            }

            bool playbackPaused = false;

            if (_context != null && pausePlayback)
            {
                playbackPaused  = _context.Paused;
                _context.Paused = true;
            }

            try
            {
                action(arg);
            }
            catch (VersionConflictException ex)
            { UserErrors.VersionConflict(ex.RequiredVersion); }
            catch (FailedToLoadSimResultsException ex)
            { UserErrors.FailedToLoadSimulationResults(ex.Message); }
            catch (ApplicationException ex)
            { UserErrors.UnhandledException(ex, true); }
            finally
            {
                if (_context != null && pausePlayback)
                {
                    _context.Paused = playbackPaused;
                }
                if (timer != null)
                {
                    timer.Enabled = timerEnabled;
                }
            }
        }
Пример #4
0
        static internal bool CreateAndShow(List <String> styles, RenderSettings settings)
        {
            int styleIndex = -1;

            for (int i = 0; i < styles.Count; i++)
            {
                if (styles[i].ToLower() == settings.StyleName.ToLower())
                {
                    styleIndex = i;
                    break;
                }
            }
            if (styleIndex < 0)
            {
                UserErrors.SettingsFileCorrupted("using default visual settings");
                styleIndex = 0;
            }

            VisualSettingsForm form = new VisualSettingsForm(styles,
                                                             styleIndex,
                                                             settings.AntiAliasingEnabled,
                                                             settings.TexturesEnabled);

            form.ShowDialog();

            if (form._shouldApply)
            {
                styleIndex                   = Math.Min(styles.Count - 1, Math.Max(0, form.cbStyle.SelectedIndex));
                settings.StyleName           = styles[styleIndex];
                settings.AntiAliasingEnabled = form.cbAntiAliasing.Checked;
                settings.TexturesEnabled     = form.cbTextures.Checked;
                return(true);
            }
            else
            {
                return(false);
            }
        }