Exemple #1
0
        public async void AddSemester(Guid yearIdentifier)
        {
            await TryHandleUserInteractionAsync("AddSemester" + yearIdentifier, async (cancellationToken) =>
            {
                // If not full version and they already have a semester
                if (YearsViewItemsGroup.School.Years.Any(i => i.Semesters.Any()) && !await PowerPlannerApp.Current.IsFullVersionAsync())
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    PowerPlannerApp.Current.PromptPurchase(PowerPlannerResources.GetString("MessageFreeSemesterLimitReached"));
                    return;
                }

                ShowPopup(AddSemesterViewModel.CreateForAdd(MainScreenViewModel, new AddSemesterViewModel.AddParameter()
                {
                    YearIdentifier = yearIdentifier
                }));
            });
        }
        public static AddSemesterViewModel CreateForEdit(BaseViewModel parent, ViewItemSemester semesterToEdit)
        {
            var viewModel = new AddSemesterViewModel(parent)
            {
                State          = OperationState.Editing,
                SemesterToEdit = semesterToEdit,
                Name           = semesterToEdit.Name
            };

            if (!PowerPlannerSending.DateValues.IsUnassigned(semesterToEdit.Start))
            {
                viewModel.StartDate = semesterToEdit.Start.Date;
            }

            if (!PowerPlannerSending.DateValues.IsUnassigned(semesterToEdit.End))
            {
                viewModel.EndDate = semesterToEdit.End.Date;
            }

            viewModel.ListenToItem(semesterToEdit.Identifier).Deleted += viewModel.Semester_Deleted;

            return(viewModel);
        }
Exemple #3
0
 public void EditSemester(ViewItemSemester semester)
 {
     ShowPopup(AddSemesterViewModel.CreateForEdit(MainScreenViewModel, semester));
 }