private async Task HandleQuickAddItem(AddHomeworkViewModel.ItemType type)
        {
            if (CurrentAccount == null)
            {
                await HandleNormalLaunchActivation();
            }

            var mainScreen = GetMainScreenViewModel();

            if (mainScreen != null && mainScreen.CurrentAccount != null && mainScreen.Classes != null && mainScreen.Classes.Count > 0)
            {
                Popups.Clear();
                var newModel = AddHomeworkViewModel.CreateForAdd(mainScreen, new AddHomeworkViewModel.AddParameter()
                {
                    Classes = mainScreen.Classes.ToArray(),
                    DueDate = DateTime.Today,
                    Type    = type
                });

                // For iOS, we can't clear and then add, we need to replace
                if (mainScreen.Popups.Count >= 1)
                {
                    mainScreen.Popups[0] = newModel;
                    while (mainScreen.Popups.Count > 1)
                    {
                        mainScreen.Popups.RemoveAt(1);
                    }
                }
                else
                {
                    mainScreen.ShowPopup(newModel);
                }
            }
        }
示例#2
0
 private void AddItem(AddHomeworkViewModel.ItemType type)
 {
     MainScreenViewModel.ShowPopup(AddHomeworkViewModel.CreateForAdd(MainScreenViewModel, new AddHomeworkViewModel.AddParameter()
     {
         SemesterIdentifier = MainScreenViewModel.CurrentSemesterId,
         Classes            = MainScreenViewModel.Classes,
         SelectedClass      = null,
         Type = type
     }));
 }
        private void AddItem(AddHomeworkViewModel.ItemType type, DateTime?dueDate = null, bool useSelectedDate = true)
        {
            dueDate = GetDateForAdd(dueDate, useSelectedDate);

            MainScreenViewModel.ShowPopup(AddHomeworkViewModel.CreateForAdd(MainScreenViewModel, new AddHomeworkViewModel.AddParameter()
            {
                SemesterIdentifier = MainScreenViewModel.CurrentSemesterId,
                Classes            = MainScreenViewModel.Classes,
                SelectedClass      = null,
                Type    = type,
                DueDate = dueDate
            }));
        }
示例#4
0
        private void initializeAdding(AddHomeworkViewModel.ItemType type)
        {
            var viewModel = PowerPlannerApp.Current.GetMainScreenViewModel();

            if (viewModel != null)
            {
                viewModel.ShowPopup(AddHomeworkViewModel.CreateForAdd(viewModel, new AddHomeworkViewModel.AddParameter()
                {
                    Classes         = GetClassesForAdding(),
                    DueDate         = DateToUseForNewItems,
                    HideClassPicker = IsClassPickerHidden,
                    HideDatePicker  = IsDatePickerHidden,
                    SelectedClass   = ClassForNewItems,
                    Type            = type
                }));
            }
        }
示例#5
0
        private async void AddItem(AddHomeworkViewModel.ItemType type)
        {
            if (MainScreenViewModel.Classes == null || MainScreenViewModel.Classes.Count == 0)
            {
                await new PortableMessageDialog("You don't have any classes. Make sure you've opened a semester that has classes.", "No classes").ShowAsync();
                return;
            }

            MainScreenViewModel.ShowPopup(AddHomeworkViewModel.CreateForAdd(MainScreenViewModel, new AddHomeworkViewModel.AddParameter()
            {
                SemesterIdentifier = MainScreenViewModel.CurrentSemesterId,
                Classes            = MainScreenViewModel.Classes,
                SelectedClass      = null,
                Type    = type,
                DueDate = DateTime.Today
            }));

            RemoveViewModel();
        }
        private async Task HandleQuickAddItem(AddHomeworkViewModel.ItemType type)
        {
            if (CurrentAccount == null)
            {
                await HandleNormalLaunchActivation();
            }

            var mainScreen = GetMainScreenViewModel();

            if (mainScreen != null && mainScreen.CurrentAccount != null && mainScreen.Classes != null && mainScreen.Classes.Count > 0)
            {
                Popups.Clear();
                mainScreen.Popups.Clear();
                mainScreen.ShowPopup(AddHomeworkViewModel.CreateForAdd(mainScreen, new AddHomeworkViewModel.AddParameter()
                {
                    Classes = mainScreen.Classes.ToArray(),
                    DueDate = DateTime.Today,
                    Type    = type
                }));
            }
        }