public void ViewDidLoad(AddPersonViewController parentViewController) { Parent = parentViewController; ParentView = parentViewController.View; RootView = new UIView(); RootView.Layer.AnchorPoint = CGPoint.Empty; // setup the search field SearchField = new Dynamic_UITextField(parentViewController, RootView, Strings.General_Search, false, false); RootView.AddSubview(SearchField); SearchField.GetTextField( ).ShouldReturn += delegate(UITextField textField) { PerformSearch( ); return(true); }; // setup the search button SearchButton = UIButton.FromType(UIButtonType.System); SearchButton.Layer.AnchorPoint = CGPoint.Empty; SearchButton.SetTitle(Strings.General_Search, UIControlState.Normal); SearchButton.Font = FontManager.GetFont(Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize); Theme.StyleButton(SearchButton, Config.Instance.VisualSettings.PrimaryButtonStyle); RootView.AddSubview(SearchButton); SearchButton.TouchUpInside += (object sender, EventArgs e) => { PerformSearch( ); }; }
public void ViewDidLoad(AddPersonViewController parentViewController) { Parent = parentViewController; RootView = new UIView(); RootView.Layer.AnchorPoint = CGPoint.Empty; Header = new UILabel(); Header.Layer.AnchorPoint = CGPoint.Empty; Header.Text = Strings.AddPerson_SelectPeople_Header; Header.Font = FontManager.GetFont(Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize); Theme.StyleLabel(Header, Config.Instance.VisualSettings.LabelStyle); RootView.AddSubview(Header); Cancel = UIButton.FromType(UIButtonType.System); Cancel.Layer.AnchorPoint = CGPoint.Empty; Cancel.SetTitle(Strings.General_Cancel, UIControlState.Normal); Cancel.Font = FontManager.GetFont(Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize); Theme.StyleButton(Cancel, Config.Instance.VisualSettings.DefaultButtonStyle); RootView.AddSubview(Cancel); Cancel.TouchUpInside += (object sender, EventArgs e) => { Parent.BrowsePeopleFinished(false, false, null); }; Add = UIButton.FromType(UIButtonType.System); Add.Layer.AnchorPoint = CGPoint.Empty; Add.SetTitle(Strings.AddPerson_AddPeople_Header, UIControlState.Normal); Add.Font = FontManager.GetFont(Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize); Theme.StyleButton(Add, Config.Instance.VisualSettings.PrimaryButtonStyle); RootView.AddSubview(Add); Add.TouchUpInside += (object sender, EventArgs e) => { // go thru and add all the selected people. List <Rock.Client.GroupMember> familyMembers = new List <Rock.Client.GroupMember>( ); foreach (FamilyMember member in Members) { if (member.Enabled == true) { familyMembers.Add(member.Member); } } // say "true", we added someone, and then when determining whether to remove them from other families, evaluate the toggle. Parent.BrowsePeopleFinished(true, RemoveFromOtherFamiliesToggle.SideToggled == UIToggle.Toggle.Left ? false : true, familyMembers); }; RemoveFromOtherFamiliesLabel = new UILabel(); RemoveFromOtherFamiliesLabel.Layer.AnchorPoint = CGPoint.Empty; RemoveFromOtherFamiliesLabel.Text = Strings.AddPerson_KeepInOtherFamilies; Theme.StyleLabel(RemoveFromOtherFamiliesLabel, Config.Instance.VisualSettings.LabelStyle); RootView.AddSubview(RemoveFromOtherFamiliesLabel); RemoveFromOtherFamiliesToggle = new UIToggle(Strings.General_Stay, Strings.General_Remove, null); RemoveFromOtherFamiliesToggle.Layer.AnchorPoint = CGPoint.Empty; Theme.StyleToggle(RemoveFromOtherFamiliesToggle, Config.Instance.VisualSettings.ToggleStyle); RemoveFromOtherFamiliesToggle.Font = FontManager.GetFont(Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize); RootView.AddSubview(RemoveFromOtherFamiliesToggle); }