public ConfigureClassPassingGradeViewController() { Title = PowerPlannerResources.GetString("Settings_GradeOptions_ListItemPassingGrade.Title"); PowerPlannerUIHelper.ConfigureForInputsStyle(this); var cancelButton = new UIBarButtonItem() { Title = PowerPlannerResources.GetStringCancel() }; cancelButton.Clicked += new WeakEventHandler <EventArgs>(CancelButton_Clicked).Handler; NavigationItem.LeftBarButtonItem = cancelButton; var saveButton = new UIBarButtonItem() { Title = PowerPlannerResources.GetStringSave() }; saveButton.Clicked += new WeakEventHandler <EventArgs>(SaveButton_Clicked).Handler; NavigationItem.RightBarButtonItem = saveButton; StackView.AddSectionDivider(); var textFieldPassingGrade = new UITextField() { TranslatesAutoresizingMaskIntoConstraints = false, KeyboardType = UIKeyboardType.DecimalPad, AdjustsFontSizeToFitWidth = true, Placeholder = PowerPlannerResources.GetExamplePlaceholderString(60.ToString()) }; BindingHost.SetTextFieldTextBinding <double>(textFieldPassingGrade, nameof(ViewModel.PassingGrade), converter: TextToDoubleConverter.Convert, backConverter: TextToDoubleConverter.ConvertBack); AddTextField(StackView, textFieldPassingGrade, firstResponder: true); StackView.AddSectionDivider(); StackView.AddSpacing(16); var labelDescription = new UILabel() { Text = PowerPlannerResources.GetString("Settings_GradeOptions_PassingGrade_Explanation.Text"), Lines = 0, Font = UIFont.PreferredCaption1, TextColor = UIColor.LightGray }; StackView.AddArrangedSubview(labelDescription); labelDescription.StretchWidth(StackView, left: 16, right: 16); StackView.AddSpacing(16); StackView.AddBottomSectionDivider(); }
public EditClassCreditsViewController() { Title = "Credits"; PowerPlannerUIHelper.ConfigureForInputsStyle(this); var cancelButton = new UIBarButtonItem() { Title = "Cancel" }; cancelButton.Clicked += new WeakEventHandler <EventArgs>(CancelButton_Clicked).Handler; NavigationItem.LeftBarButtonItem = cancelButton; var saveButton = new UIBarButtonItem() { Title = "Save" }; saveButton.Clicked += new WeakEventHandler <EventArgs>(SaveButton_Clicked).Handler; NavigationItem.RightBarButtonItem = saveButton; StackView.AddSectionDivider(); var textFieldCredits = new UITextField() { TranslatesAutoresizingMaskIntoConstraints = false, KeyboardType = UIKeyboardType.DecimalPad, AdjustsFontSizeToFitWidth = true, Placeholder = "ex: 3" }; BindingHost.SetTextFieldTextBinding <double>(textFieldCredits, nameof(ViewModel.Credits), converter: CreditsToTextBoxTextConverter.Convert, backConverter: CreditsToTextBoxTextConverter.ConvertBack); AddTextField(StackView, textFieldCredits, firstResponder: true); StackView.AddSectionDivider(); }
public ConfigureClassGradeScaleViewController() { Title = "Grade Scale"; var cancelButton = new UIBarButtonItem() { Title = "Cancel" }; cancelButton.Clicked += new WeakEventHandler <EventArgs>(CancelButton_Clicked).Handler; NavigationItem.LeftBarButtonItem = cancelButton; var saveButton = new UIBarButtonItem() { Title = "Save" }; saveButton.Clicked += new WeakEventHandler <EventArgs>(SaveButton_Clicked).Handler; NavigationItem.RightBarButtonItem = saveButton; PowerPlannerUIHelper.ConfigureForInputsStyle(this); StackView.AddTopSectionDivider(); var savedScalesContainer = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { var pickerSavedScales = new BareUIInlinePickerView(this, left: 16, right: 16) { TranslatesAutoresizingMaskIntoConstraints = false, HeaderText = "Scale" }; BindingHost.SetItemsSourceBinding(pickerSavedScales, nameof(ViewModel.SavedGradeScales)); BindingHost.SetSelectedItemBinding(pickerSavedScales, nameof(ViewModel.SelectedSavedGradeScale)); savedScalesContainer.AddSubview(pickerSavedScales); pickerSavedScales.StretchHeight(savedScalesContainer); var buttonSaveScale = new UIButton(UIButtonType.Custom) { TranslatesAutoresizingMaskIntoConstraints = false, //TintColor = UIColor. }; buttonSaveScale.SetImage(UIImage.FromBundle("SaveAsIcon").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal); buttonSaveScale.TouchUpInside += new WeakEventHandler(ButtonSaveScale_TouchUpInside).Handler; savedScalesContainer.Add(buttonSaveScale); buttonSaveScale.StretchHeight(savedScalesContainer, bottom: 1); savedScalesContainer.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[picker][save(44)]-16-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "picker", pickerSavedScales, "save", buttonSaveScale)); savedScalesContainer.SetHeight(44); } StackView.AddArrangedSubview(savedScalesContainer); savedScalesContainer.StretchWidth(StackView); StackView.AddSectionDivider(); var headerView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { var labelStartingGrade = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = "Starting Grade", Font = UIFont.PreferredBody.Bold() }; headerView.Add(labelStartingGrade); labelStartingGrade.StretchHeight(headerView, top: 8, bottom: 8); var labelGpa = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = "GPA", Font = UIFont.PreferredBody.Bold() }; headerView.Add(labelGpa); labelGpa.StretchHeight(headerView, top: 8, bottom: 8); headerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[startingGrade][gpa(==startingGrade)]-52-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "startingGrade", labelStartingGrade, "gpa", labelGpa)); } StackView.AddArrangedSubview(headerView); headerView.StretchWidth(StackView, left: 16, right: 16); StackView.AddDivider(); var scalesView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { _itemsSourceGradeScales = new BareUIViewItemsSourceAdapterAsStackPanel(scalesView, (w) => { return(new UIEditingGradeScaleView(this) { DataContext = w }); }); } StackView.AddArrangedSubview(scalesView); scalesView.StretchWidth(StackView, left: 16); var buttonAdd = new UIButton(UIButtonType.System) { TranslatesAutoresizingMaskIntoConstraints = false }; buttonAdd.SetTitle("Add Grade Scale", UIControlState.Normal); buttonAdd.TouchUpInside += new WeakEventHandler(delegate { ViewModel.AddGradeScale(); }).Handler; StackView.AddArrangedSubview(buttonAdd); buttonAdd.StretchWidth(StackView); buttonAdd.SetHeight(44); StackView.AddBottomSectionDivider(); }