예제 #1
0
		public void Initialize()
		{
			Schedules = new ObservableCollection<ScheduleViewModel>();
			var schedules = GKScheduleHelper.GetSchedules();
			if (schedules != null)
			{
				foreach (var schedule in schedules.OrderBy(x => x.No))
				{
					var scheduleViewModel = new ScheduleViewModel(schedule);
					Schedules.Add(scheduleViewModel);
				}
				SelectedSchedule = Schedules.FirstOrDefault();
			}
		}
예제 #2
0
		void OnAdd()
		{
			var scheduleDetailsViewModel = new ScheduleDetailsViewModel();
			if (DialogService.ShowModalWindow(scheduleDetailsViewModel))
			{
				var schedule = scheduleDetailsViewModel.Schedule;
				if (schedule.SchedulePeriodType == GKSchedulePeriodType.Weekly)
				{
					for (int i = 0; i < 7; i++)
					{
						var daySchedule = GKModuleLoader.DaySchedulesViewModel.GetDaySchedules().FirstOrDefault();
						if (daySchedule != null)
						{
							schedule.ScheduleParts.Add(new GKSchedulePart() { DayNo = i, DayScheduleUID = daySchedule.UID });
						}
					}
				}
				var saveScheduleResult = GKScheduleHelper.SaveSchedule(schedule, true);
				if (saveScheduleResult)
				{
					var scheduleViewModel = new ScheduleViewModel(schedule);
					Schedules.Add(scheduleViewModel);
					SelectedSchedule = scheduleViewModel;
				}
			}
		}