Exemple #1
0
        private void InitializeTable()
        {
            _cellUsername = new UITableViewCell(UITableViewCellStyle.Default, "TableCell");
            _cellUsername.TextLabel.TextColor = UIColor.LightGray;
            _accountBindingHost.SetLabelTextBinding(_cellUsername.TextLabel, nameof(ViewModel.CurrentAccount.Username));
            _tableView.AddCell(_cellUsername, null);

            _tableView.StartNewGroup();

            _tableView.AddCell("Log Out", ViewModel.LogOut);
            _tableView.AddCell("Change Username", ViewModel.ChangeUsername);
            _tableView.AddCell("Change Password", ViewModel.ChangePassword);

            if (ViewModel.CurrentAccount.IsOnlineAccount)
            {
                _tableView.AddCell("Change Email Address", ViewModel.ChangeEmail);
            }

            if (!ViewModel.CurrentAccount.IsOnlineAccount)
            {
                _tableView.AddCell("Convert to Online Account", ViewModel.ConvertToOnline);
            }

            _tableView.StartNewGroup();

            var cellDelete = new UITableViewCell(UITableViewCellStyle.Default, "TableCell");

            cellDelete.TextLabel.Text          = "Delete Account";
            cellDelete.TextLabel.TextColor     = UIColor.Red;
            cellDelete.TextLabel.TextAlignment = UITextAlignment.Center;
            _tableView.AddCell(cellDelete, ViewModel.PromptConfirmDelete);

            _tableView.Compile();
        }
Exemple #2
0
        public override void OnViewModelLoadedOverride()
        {
            _tableView.AddDescriptionCell(PowerPlannerResources.GetString("Settings_SchoolTimeZone_Description.Text"));

            _tableView.StartNewGroup();

            var selectedTimeZone = new BareUIInlinePickerView(this, left: 16, right: 16)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HeaderText  = "Time zone",
                ItemsSource = ViewModel.AvailableTimeZones,
                ItemToPreviewStringConverter = item => SchoolTimeZoneSettingsViewModel.Format(item as TimeZoneInfo),
                ItemToViewConverter          = ConvertTimeZoneToInlineView
            };

            BindingHost.SetSelectedItemBinding(selectedTimeZone, nameof(ViewModel.SelectedSchoolTimeZone));
            var cellSelectedTimeZone = new BareUITableViewCell("selectedTimeZone");

            cellSelectedTimeZone.ContentView.Add(selectedTimeZone);
            selectedTimeZone.StretchWidth(cellSelectedTimeZone.ContentView);
            selectedTimeZone.SetHeight(44);
            _tableView.AddCell(cellSelectedTimeZone, delegate { }); // Have to provide action so it remains clickable

            _tableView.StartNewGroup();

            _tableView.AddCell("Save changes", ViewModel.Save);

            _tableView.AddCaptionDescriptionCell(PowerPlannerResources.GetString("Settings_SchoolTimeZone_RestartNote.Text"));

            _tableView.Compile();

            base.OnViewModelLoadedOverride();
        }
Exemple #3
0
        public override void OnViewModelLoadedOverride()
        {
            _tableView.AddDescriptionCell("Power Planner automatically sets reminders for each task and event.");

            _tableView.StartNewGroup();

            var switchDayBefore = new BareUISwitch()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Header = "Day Before"
            };

            BindingHost.SetSwitchBinding(switchDayBefore, nameof(ViewModel.RemindersDayBefore));
            var cellDayBefore = new BareUITableViewCell("dayBefore");

            cellDayBefore.ContentView.Add(switchDayBefore);
            switchDayBefore.StretchWidthAndHeight(cellDayBefore.ContentView);
            _tableView.AddCell(cellDayBefore, delegate { }); // Have to provide action so it remains clickable

            _tableView.AddCaptionDescriptionCell("This reminds you the day before your incomplete tasks or events are due. It will remind you 10 minutes after your last class, or at 3:00 PM if you don't have any classes that day.");

            _tableView.StartNewGroup();

            var switchDayOf = new BareUISwitch()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Header = "Day Of"
            };

            BindingHost.SetSwitchBinding(switchDayOf, nameof(ViewModel.RemindersDayOf));
            var cellDayOf = new BareUITableViewCell("dayOf");

            cellDayOf.ContentView.Add(switchDayOf);
            switchDayOf.StretchWidthAndHeight(cellDayOf.ContentView);
            _tableView.AddCell(cellDayOf, delegate { });

            _tableView.AddCaptionDescriptionCell("This reminds you on the same day that your incomplete tasks or events are due. It will remind you 1 hour before your class starts, or at 6:00 PM if your class doesn't meet on that day.");

            _tableView.Compile();

            base.OnViewModelLoadedOverride();
        }
        public override void OnViewModelLoadedOverride()
        {
            _tableView.AddDescriptionCell(PowerPlannerResources.GetString("Settings_TwoWeekSchedule_Description.Text"));

            _tableView.StartNewGroup();

            var currentWeek = new BareUIInlinePickerView(this, left: 16, right: 16)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HeaderText  = "Current week",
                ItemsSource = ViewModel.AvailableCurrentWeekStrings
            };

            BindingHost.SetSelectedItemBinding(currentWeek, nameof(ViewModel.CurrentWeekString));
            var cellCurrentWeek = new BareUITableViewCell("currentWeek");

            cellCurrentWeek.ContentView.Add(currentWeek);
            currentWeek.StretchWidth(cellCurrentWeek.ContentView);
            currentWeek.SetHeight(44);
            _tableView.AddCell(cellCurrentWeek, delegate { }); // Have to provide action so it remains clickable

            _tableView.StartNewGroup();

            var weekChangesOn = new BareUIInlinePickerView(this, left: 16, right: 16)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HeaderText  = "Week changes on",
                ItemsSource = ViewModel.AvailableWeekChangesOnStrings
            };

            BindingHost.SetSelectedItemBinding(weekChangesOn, nameof(ViewModel.WeekChangesOnString));
            var cellWeekChangesOn = new BareUITableViewCell("weekChangesOn");

            cellWeekChangesOn.ContentView.Add(weekChangesOn);
            weekChangesOn.StretchWidth(cellWeekChangesOn.ContentView);
            weekChangesOn.SetHeight(44);
            _tableView.AddCell(cellWeekChangesOn, delegate { });

            _tableView.Compile();

            base.OnViewModelLoadedOverride();
        }
Exemple #5
0
        private void UpdateTable()
        {
            _tableView.ClearAll();

            // Display summary info
            _tableView.AddDescriptionCell("Edit grade options for this class.");

            _tableView.StartNewGroup();

            // Add items
            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBoxEditCredits.Header"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.Credits),
                                    converter: ConvertCreditsToString,
                                    invokeAction: ViewModel.ConfigureCredits);

            _tableView.AddCell(PowerPlannerResources.GetString("ConfigureClassGrades_Items_WeightCategories.Title"), ViewModel.ConfigureWeightCategories);

            _tableView.AddValueCell(PowerPlannerResources.GetString("Settings_GradeOptions_ListItemGpaType.Title"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.GpaType),
                                    converter: ConvertGpaTypeToString,
                                    invokeAction: ViewModel.ConfigureGpaType);

            if (ViewModel.Class.GpaType == PowerPlannerSending.GpaType.PassFail)
            {
                _tableView.AddValueCell(PowerPlannerResources.GetString("Settings_GradeOptions_ListItemPassingGrade.Title"),
                                        bindingHost: m_classBindingHost,
                                        bindingValuePropertyName: nameof(ViewModel.Class.PassingGrade),
                                        converter: (val) => { return(((double)val).ToString("0.##%")); },
                                        invokeAction: ViewModel.ConfigurePassingGrade);
            }
            else
            {
                _tableView.AddCell(PowerPlannerResources.GetString("ConfigureClassGrades_Items_GradeScale.Title"), ViewModel.ConfigureGradeScale);
            }

            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBlockAverageGradesHelpHeader.Text"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.ShouldAverageGradeTotals),
                                    converter: ConvertBooleanToYesNo,
                                    invokeAction: ViewModel.ConfigureAverageGrades);

            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBlockRoundGradesUpHelpHeader.Text"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.DoesRoundGradesUp),
                                    converter: ConvertBooleanToYesNo,
                                    invokeAction: ViewModel.ConfigureRoundGradesUp);

            _tableView.Compile();
        }
        private async void RedrawItems()
        {
            _tableView.ClearAll();

            if (ViewModel.HasAccount)
            {
                var mainScreenViewModel = ViewModel.FindAncestor <MainScreenViewModel>();
                var account             = ViewModel.Account;

                _isFullVersion = await PowerPlannerApp.Current.IsFullVersionAsync();

                if (!_isFullVersion)
                {
                    _tableView.AddCell("Upgrade to Premium", ViewModel.OpenPremiumVersion);

                    _tableView.StartNewGroup();
                }

                if (ViewModel.HasAccount && mainScreenViewModel != null)
                {
                    _cellCurrentSemester = new UITableViewCell(UITableViewCellStyle.Default, "TableCellCurrentSemester");

                    if (mainScreenViewModel.CurrentSemester != null && !_isListeningToSemester)
                    {
                        _isListeningToSemester = true;
                        mainScreenViewModel.CurrentSemester.PropertyChanged += new WeakEventHandler <PropertyChangedEventArgs>(CurrentSemester_PropertyChanged).Handler;
                    }

                    UpdateCurrentSemesterText(mainScreenViewModel.CurrentSemester);
                    _tableView.AddCell(_cellCurrentSemester, null);

                    _tableView.AddCell("View Years & Semesters", () => mainScreenViewModel.OpenYears());

                    _tableView.StartNewGroup();
                }

                if (ViewModel.IsOnlineAccount && mainScreenViewModel != null)
                {
                    if (!_isListeningToMain)
                    {
                        _isListeningToMain = true;
                        mainScreenViewModel.PropertyChanged += new WeakEventHandler <PropertyChangedEventArgs>(MainScreenViewModel_PropertyChanged).Handler;
                    }

                    _cellSyncStatus = new UITableViewCell(UITableViewCellStyle.Default, "TableCellSyncStatus");
                    _tableView.AddCell(_cellSyncStatus, delegate
                    {
                        if (mainScreenViewModel.HasSyncErrors)
                        {
                            mainScreenViewModel.ViewSyncErrors();
                        }
                    });

                    _cellSyncNow = new UITableViewCell(UITableViewCellStyle.Default, "TableCellSyncNow");
                    _tableView.AddCell(_cellSyncNow, delegate
                    {
                        mainScreenViewModel.SyncCurrentAccount();
                    });

                    UpdateSyncStatuses(mainScreenViewModel);

                    _tableView.StartNewGroup();
                }
            }

            if (ViewModel.IsCreateAccountVisible)
            {
                _tableView.AddCell("Create Account", ViewModel.OpenCreateAccount);
            }

            if (ViewModel.IsLogInVisible)
            {
                _tableView.AddCell("Log In", ViewModel.OpenLogIn);
            }

            if (ViewModel.IsMyAccountVisible)
            {
                _tableView.AddCell("My Account", ViewModel.OpenMyAccount);
            }

            if (ViewModel.IsRemindersVisible)
            {
                _tableView.AddCell("Reminders", ViewModel.OpenReminderSettings);
            }

            if (ViewModel.IsGoogleCalendarIntegrationVisible)
            {
                _tableView.AddCell("Google Calendar Integration", OpenGoogleCalendarIntegration);
            }

            if (ViewModel.IsTwoWeekScheduleVisible)
            {
                _tableView.AddCell("Two Week Schedule", ViewModel.OpenTwoWeekScheduleSettings);
            }

            if (ViewModel.IsSchoolTimeZoneVisible)
            {
                _tableView.AddCell("Time Zone", ViewModel.OpenSchoolTimeZone);
            }

            _tableView.AddCell("Help", OpenHelp);

            _tableView.AddCell("About", ViewModel.OpenAbout);

            _tableView.Compile();
        }