Ejemplo n.º 1
0
        private void btnExport_Click(object sender, System.EventArgs e)
        {
            int year;

            if (!LocalizationManager.ConvertFloatingTo <int>(this.txtBoxYear.Text, int.TryParse, out year))
            {
                ErrorManager.ShowNotANumberError(this);
                return;
            }

            // this code spawned itself from nowhere idk why
            try {
                if (year == 666)
                {
                    throw new UnableToSummonDaCatException();
                }
            }
            catch (UnableToSummonDaCatException ex)
            {
                ErrorManager.HandleBaseException(ex);
                return;
            }

            PrintToPDDF(this.comboBoxMonth.SelectedIndex + 1, year);
        }
Ejemplo n.º 2
0
        static void RunApp()
        {
            FrmMain      MainForm;
            UserCreation CreationForm;

            try {
                // run the Main form and restart it if it asks so
                do
                {
                    // load settings from saved data if available. Otherwise: create settings
                    Program.settings = Settings.Load();
                    if (Program.settings == null)
                    {
                        Program.settings = new Settings();
                    }

                    // If there is nobody in the database, open the creation form
                    while (PersonneRepository.CountRows() == 0)
                    {
                        // !!TODO!!
                        CreationForm = new UserCreation();
                        Application.Run(CreationForm);

                        // Stop user cancelled the user creation, close the program
                        if (CreationForm.UserCancelled)
                        {
                            return;
                        }
                    }

                    MainForm = new FrmMain();
                    Application.Run(MainForm);
                } while (MainForm.WaitsForRestart);
            }
            // handle any fatal OleDB error
            catch (OleDbException ex)
            {
                ErrorManager.HandleOleDBError(ex);
            }
            catch (Exception ex)
            {
                ErrorManager.HandleBaseException(ex);
            }
        }