Пример #1
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;
				}
			}
		}
Пример #2
0
		void OnEdit()
		{
			var scheduleDetailsViewModel = new ScheduleDetailsViewModel(SelectedSchedule.Schedule);
			if (DialogService.ShowModalWindow(scheduleDetailsViewModel))
			{
				var schedule = scheduleDetailsViewModel.Schedule;
				if (GKScheduleHelper.SaveSchedule(schedule, false))
				{
					SelectedSchedule.Update(schedule);
					scheduleDetailsViewModel.Schedule.OnChanged();
				}
			}
		}