예제 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Log("MainForm_Load event");

            _timecardLogic = new TimecardLogic(Factory);
            _reportLogic   = new ReportLogic(Factory);

            _loading = true;

            Timecard tc;

            try
            {
                tc = _timecardLogic.GetLatestTimecard();
            }
            catch (TimecardNotFoundException)
            {
                tc = _timecardLogic.GetNewTimecard();
            }

            MainDate.Value = tc.Date;
            UpdateMainDateLabel();
            PopulateActivitiesGrid();
            ClearStatusMessage();

            ReportOptionHundredths.Checked = (Configuration.MinutesPerReportUnit == 1);
            ReportOptionTenths.Checked     = (Configuration.MinutesPerReportUnit == 6);
            ReportOptionQuarters.Checked   = (Configuration.MinutesPerReportUnit == 15);

            _loading = false;
        }
예제 #2
0
        private void NavigateTo(Navigation direction)
        {
            Log($"NavigateTo: direction={direction}");

            _loading = true;
            SetStatusMessage("Loading...");

            try
            {
                switch (direction)
                {
                case Navigation.Earliest:
                    _timecardLogic.GetEarliestTimecard();
                    break;

                case Navigation.Previous:
                    _timecardLogic.GetPreviousTimecard();
                    break;

                case Navigation.Next:
                    _timecardLogic.GetNextTimecard();
                    break;

                case Navigation.Latest:
                    _timecardLogic.GetLatestTimecard();
                    break;

                case Navigation.Today:
                    _timecardLogic.GetTodaysTimecard();
                    break;
                }
            }
            catch (TimecardNotFoundException)
            {
                _timecardLogic.GetNewTimecard();
            }

            MainDate.Value = _timecardLogic.GetCurrentTimecard().Date;
            UpdateMainDateLabel();
            PopulateActivitiesGrid();

            ClearStatusMessage();
            _loading = false;
        }