/// <summary>
        /// Handler for Scheduler button click event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainWindowOpenScheduler(object sender, EventArgs e)
        {
            var window = new ScheduleWindow(this.deviceManager.Scheduler.Schedule)
            {
                Owner           = this.mainWindow,
                SchedulerEnable = this.deviceManager.Scheduler.Enabled,
            };

            if (window.ShowDialog() == true)
            {
                // TODO: Figure out how to display this in UI
                if (window.SchedulerEnable)
                {
                    if (this.deviceManager.Scheduler.SetSchedule(window.Schedule))
                    {
                        SendStatusUpdate(Properties.Resources.MSG_SCHEDULE_SET);
                    }
                }
                else
                {
                    this.deviceManager.Scheduler.ClearSchedule();
                    SendStatusUpdate(Properties.Resources.MSG_SCHEDULE_CLEAR);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the Click event of the ScheduleSelectButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void ScheduleSelectButton_Click(object sender, RoutedEventArgs e)
        {
            ScheduleWindow scheduleWindow = new ScheduleWindow();

            scheduleWindow.UpdateWith(!string.IsNullOrWhiteSpace(this.ScheduleHiddenLabel.Text) ? this.ScheduleHiddenLabel.Text : ScheduleUtility.DefaultCrontab);
            if (scheduleWindow.ShowDialog() == true)
            {
                this.ScheduleHiddenLabel.Text = scheduleWindow.Schedule;
                this.ScheduleLabel.Text       = ScheduleUtility.GetFullDescription(scheduleWindow.Schedule);
            }
        }
Beispiel #3
0
        void ICommand.Execute(object parameter)
        {
            var swd = new ScheduleWindow(new Schedule
            {
                Date      = DateTime.Now.AddHours(2),
                Count     = 1,
                Interval  = 1,
                Frequency = ScheduleFrequency.Workday,
                TaskId    = _viewModel.SelectedTask.Id,
                UserId    = RunTimeContext.Context.CurrentUser.Id,
            });

            swd.ShowDialog();
            _viewModel.ScheduledList = new ObservableCollection <Schedule>(ScheduleManager.GetScheduledTask(RunTimeContext.Context.CurrentUser,
                                                                                                            RunTimeContext.Context.DatabaseContext));
        }
Beispiel #4
0
        public BasicSchedule ShowScheduleDialog(BasicSchedule basicSchedule)
        {
            ScheduleWindow window = new ScheduleWindow();

            window.Owner = GetActiveWindow();
            if (basicSchedule != null)
            {
                window.ViewModel.LoadModel(basicSchedule);
            }
            if (window.ShowDialog() == true)
            {
                return(window.ViewModel.SaveSchedule());
            }
            else
            {
                return(null);
            }
        }
 // Открытие окна расписания.
 private void btnSchedule_Click(object sender, RoutedEventArgs e)
 {
     if (currentTerm != null)
     {
         ScheduleWindow Schedule = new ScheduleWindow(currentTerm);
         try
         {
             if (Schedule.ShowDialog() == true)
             {
                 UpdateLessonList();
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("{0} Exception cought", ex);
         }
     }
     else
     {
         OpenAddTermWindow();
     }
 }
        private void EmergencyExamination_Click(object sender, RoutedEventArgs e)
        {
            if (InvalidInputForEmergencyAppointment())
            {
                MessageBox.Show("Invalid input.");
                return;
            }

            int    specialtyId  = GetChosenSpecialtyId();
            Doctor chosenDoctor = doctorServerController.GetDoctorsBySpecialty(specialtyId).ElementAt(0);

            DateTime startDate = DateTime.Now.AddHours(1);
            DateTime endDate   = startDate.AddHours(3);

            RecommendationRequestDto recommendationRequestDto = new RecommendationRequestDto()
            {
                DoctorId     = chosenDoctor.Id,
                SpecialtyId  = specialtyId,
                TimeInterval = new TimeInterval(startDate, endDate),
                Preference   = RecommendationPreference.Time
            };

            List <RecommendationDto> searchResults = schedulingController.GetEmergencyAppointments(recommendationRequestDto);

            if (searchResults.Count() != 0)
            {
                ScheduleWindow scheduleWindow = new ScheduleWindow(searchResults.ElementAt(0), null);
                scheduleWindow.ShowDialog();
            }
            else
            {
                MessageBox.Show("Appointment analysis is needed!");
                AppointmentAnalysisWindow appointmentAnalysisWindow = new AppointmentAnalysisWindow(recommendationRequestDto.SpecialtyId);
                appointmentAnalysisWindow.ShowDialog();
            }
        }
Beispiel #7
0
        void ICommand.Execute(object parameter)
        {
            ScheduleWindow swd = new ScheduleWindow(_viewModel.SelectedSchedule);

            swd.ShowDialog();
        }