private void FormMain_Load(object sender, EventArgs e) { try { labelSoftwareVersion.Text = string.Format("{0}-alpha", Application.ProductVersion); SetTimer(); Log.Debug("Timer configured."); timer.Start(); Log.Debug("Timer started."); numericUpDownWeeklyReportYear.Value = DateTime.Now.Year; numericUpDownWeeklyReportWeekNumber.Value = ReportingExcel.GetIso8601WeekOfYear(DateTime.Now); // Check to see the current state (running at startup or not) if (registryKeyRunOnStartup.GetValue(stringApplicationName) == null) { // The value doesn't exist, the application is not set to run at startup checkBoxRunOnStartup.Checked = false; } else { // The value exists, the application is set to run at startup checkBoxRunOnStartup.Checked = true; } } catch (Exception exception) { #if DEBUG throw exception; #else Log.Fatal(exception, "Form load failed."); Application.Exit(); #endif } }
private void buttonGenerateWeeklyReport_Click(object sender, EventArgs e) { ReportingExcel.CreateWeeklyReport(Convert.ToInt32(numericUpDownWeeklyReportYear.Value), Convert.ToInt32(numericUpDownWeeklyReportWeekNumber.Value)); }