public StatisticsWindow()
        {
            InitializeComponent();
            _dbAccess = DBAccess.GetInstance();

            MonthComboBox.SelectedIndex = DateTime.Today.Month - 1;
            Week.PrepareWeekComboBox(StatWindWeekComboBox, Period.Month, (byte)DateTime.Today.Month);
            DayComboBox.SelectedIndex = (int)DateTime.Today.DayOfWeek - 1;
            //Setting selection to "Week":
            PeriodComboBox.SelectedIndex = 1;
            DayComboBox.IsEnabled        = false;

            DayComboBox.SelectionChanged          += ComboBox_SelectionChanged_DefaultHandler;
            MonthComboBox.SelectionChanged        += MonthComboBox_SelectionChanged;
            PeriodComboBox.SelectionChanged       += PeriodComboBox_SelectionChanged;
            StatWindWeekComboBox.SelectionChanged += ComboBox_SelectionChanged_DefaultHandler;

            UpdateStatisticsVisualisation();
        }
Beispiel #2
0
        public static void PrepareWeekComboBox(ComboBox weekComboBox, Period period, byte month = 0)
        {
            if (period != Period.Year && period != Period.Month)
            {
                throw new ArgumentException("Period argument must be Period.Month or Period.Year.", "period");
            }

            DateTime firstDay;
            DateTime endLoopDate;
            int      pastPeriodDays = VariousTools.FirstWeekDaysInPastPeriod(period, month);

            if (period == Period.Year)
            {
                firstDay    = new DateTime(DateTime.Today.Year, 1, 1);
                endLoopDate = new DateTime(DateTime.Today.Year + 1, 1, 1);
            }
            else
            {
                firstDay    = new DateTime(DateTime.Today.Year, month, 1);
                endLoopDate = new DateTime(DateTime.Today.Year, month + 1, 1);
            }

            DateTime weekStart        = firstDay.AddDays(-pastPeriodDays);
            DateTime weekEnd          = weekStart.AddDays(6);
            int      currentWeekIndex = 0;

            weekComboBox.Items.Clear();

            for (byte i = 1; weekStart < endLoopDate; i++)
            {
                weekComboBox.Items.Add(Week.PrepareWeekString(weekStart, weekEnd, i));
                if (weekStart <= DateTime.Today && DateTime.Today <= weekEnd)
                {
                    currentWeekIndex = i - 1;
                }
                weekStart = weekStart.AddDays(7);
                weekEnd   = weekEnd.AddDays(7);
            }
            weekComboBox.SelectedIndex = currentWeekIndex;
        }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();

            ActionHandler     actionHandler     = ActionHandler.GetInstance();
            ActivitiesManager activitiesManager = ActivitiesManager.GetInstance();

            _week     = Week.GetInstance();
            _dbAccess = DBAccess.GetInstance();

            activitiesManager.Start(ActivitiesPanel, actionHandler, _week);
            actionHandler.Start(activitiesManager);
            _week.ActualInitialisation(WeekGrid, WeekComboBox);

            StatsBtn.Click += actionHandler.StatsBtn_Click;
            WeekComboBox.SelectionChanged += actionHandler.WeekComboBox_SelectionChanged;
            PlanningRB.Checked            += actionHandler.PlanningRB_Checked;
            ReportingRB.Checked           += actionHandler.ReportingRB_Checked;
            AddActivityBtn.Click          += actionHandler.AddActivityBtn_Click;
            RemoveActivityBtn.Click       += actionHandler.RemoveActivityBtn_Click;
            MouseLeftButtonDown           += actionHandler.Window_MouseLeftButtonDown;
            MouseLeftButtonUp             += actionHandler.Window_MouseLeftButtonUp;
        }
 private void MonthComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Week.PrepareWeekComboBox(StatWindWeekComboBox, Period.Month, CurrSlctdMonth);
     UpdateStatisticsVisualisation();
 }