Example #1
0
        private async void BtnSaveSchedule_Click(object sender, RoutedEventArgs e)
        {
            UScheduleListModel selectedSchedule = lstSchedules.SelectedItem as UScheduleListModel;

            if (selectedSchedule is null)
            {
                return;
            }
            var sfd = new SaveFileDialog()
            {
                Filter           = "JSON File (*.json)|*.json",
                AddExtension     = true,
                CheckFileExists  = false,
                DefaultExt       = ".json",
                ValidateNames    = true,
                Title            = "Schedule file.",
                DereferenceLinks = true
            };

            if (sfd.ShowDialog() == false)
            {
                return;
            }
            await selectedSchedule.Source.Save(sfd.FileName);
        }
Example #2
0
        private void LstSchedules_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UScheduleListModel selectedSchedule = lstSchedules.SelectedItem as UScheduleListModel;

            if (selectedSchedule is null)
            {
                ClearSelectedSchedule();
                return;
            }
            lstSchedule.ItemsSource = null;
            lstSchedule.ItemsSource = selectedSchedule.ClassesModels;
            lstSchedule.Items.Refresh();
            lblDays.Content               = $"Days: {selectedSchedule.Days}";
            lblFinancialHours.Content     = $"Financial hours: {selectedSchedule.FinancialHours}";
            lblFirstStartTime.Content     = $"First start time: {selectedSchedule.FirstStartTime}";
            lblLastEndTime.Content        = $"Last end time: {selectedSchedule.LastEndTime}";
            lblLongestDayDuration.Content = $"Longest day duration: {selectedSchedule.LongestDayDuration}";
            lblMaximumBreaksTotal.Content = $"Maximum breaks per day: {selectedSchedule.MaximumBreaksTotal}";
        }