Beispiel #1
0
        private void NavNext_Click(object sender, RoutedEventArgs e)
        {
            var shiftBox = FindVisualChildren <ComboBox>(this);

            foreach (ComboBox box in shiftBox)
            {
                if (box.Name.Equals("shiftBox"))
                {
                    DateTime date;
                    string   shift;
                    if (box.SelectedIndex != box.Items.Count - 1)
                    {
                        ComboBoxItem item = (ComboBoxItem)box.Items.GetItemAt(box.SelectedIndex + 1);
                        shift = item.Content.ToString();
                    }
                    else
                    {
                        currentDate = currentDate.AddDays(1);
                        ComboBoxItem item = (ComboBoxItem)box.Items.GetItemAt(0);
                        shift = item.Content.ToString();
                        mainDate.SelectedDate = currentDate;
                    }
                    LogViewModel.Load(currentDate, shift);
                    EnabledNavButtons();
                    EnabledTextBoxes(!LogViewModel.CurrentLog.Submitted);
                }
            }
        }
Beispiel #2
0
        private void NavDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            var comboboxes = FindVisualChildren <ComboBox>(this);

            foreach (ComboBox box in comboboxes)
            {
                if (box.Name.Equals("shiftBox"))
                {
                    ComboBox shiftBox = box;
                }
            }
            if (loaded)
            {
                string   shift = shiftBox.Text;
                DateTime date  = (DateTime)((DatePicker)sender).SelectedDate;
                LogViewModel.Load(date, shift);
                currentDate = date;
            }
            EnabledNavButtons();
            EnabledTextBoxes(!LogViewModel.CurrentLog.Submitted);
        }