public void Main() { string reportPath = string.Empty; string shiftPath = string.Empty; string outputPth = string.Empty; reportSelector.Invoke((MethodInvoker)(() => reportPath = reportSelector.Value)); shiftSelector.Invoke((MethodInvoker)(() => shiftPath = shiftSelector.Value)); outputSelector.Invoke((MethodInvoker)(() => outputPth = outputSelector.Value)); int durationIndex = 0; int year = 0; int month = 0; int day = 0; this.duration.Invoke((MethodInvoker)(() => durationIndex = this.duration.SelectedIndex)); this.year.Invoke((MethodInvoker)(() => year = int.Parse(this.year.SelectedItem.Text))); this.month.Invoke((MethodInvoker)(() => month = this.month.SelectedIndex + 1)); this.day.Invoke((MethodInvoker)(() => day = this.day.SelectedIndex + 1)); var duration = durationIndex == 0 ? new TimeSpan(0, 15, 0) : new TimeSpan(0, 30, 0); var manager = new Manager { ReportPath = reportPath, ShiftPath = shiftPath, CurrentDate = PersianDate.FromShamsi(year, month, day), OutputPath = outputPth, Duration = duration }; manager.ReadData(); manager.CalculateCounts(); execteBtn.Invoke((MethodInvoker)(() => execteBtn.Enabled = true)); waiting.Invoke((MethodInvoker)(() => waiting.Visible = false)); waiting.Invoke((MethodInvoker)(() => waiting.StopWaiting())); }
private void button1_Click(object sender, EventArgs e) { var manager = new Manager { ReportPath = @"C:\Users\mehdi\Desktop\outbound\report\Report.xlsx", ShiftPath = @"C:\Users\mehdi\Desktop\outbound\report\Shift.xlsx", CurrentDate = PersianDate.FromShamsi(1395, 8, 25) }; manager.ReadData(); manager.CalculateCounts(); }