public FamilyResult(SearchFamilyPanel parent, Family family) { Parent = parent; Family = family; FamilyView = new FamilySearchResultView( ); parent.GetRootView( ).AddSubview(FamilyView); Button = new UIButton( ); Button.Layer.AnchorPoint = CGPoint.Empty; FamilyView.AddSubview(Button); Button.BackgroundColor = UIColor.Clear; Button.TouchUpInside += (object sender, EventArgs e) => { // don't process the touch if there's no valid family if (Family != null) { Parent.FamilySelected(Family); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Background mask BackgroundPanel = new UIView( ); BackgroundPanel.BackgroundColor = UIColor.Black; BackgroundPanel.Layer.Opacity = 0.00f; View.AddSubview(BackgroundPanel); // Floating "main" UI panel MainPanel = new UIView(); MainPanel.Layer.AnchorPoint = CGPoint.Empty; MainPanel.BackgroundColor = UIColor.Black; MainPanel.Layer.Opacity = 1.00f; MainPanel.Bounds = new CoreGraphics.CGRect(0, 0, View.Bounds.Width * .75f, View.Bounds.Height * .75f); View.AddSubview(MainPanel); // Scroll view on the right hand side ScrollView = new UIScrollViewWrapper( ); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; //ScrollView.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.AddPersonBGColor ); ScrollView.BackgroundColor = Theme.GetColor(Config.Instance.VisualSettings.BackgroundColor); MainPanel.AddSubview(ScrollView); KeyboardAdjustManager = new KeyboardAdjustManager(MainPanel); SearchPanel = new SearchFamilyPanel(); SearchPanel.ViewDidLoad(this); PeoplePanel = new BrowsePeoplePanel(); PeoplePanel.ViewDidLoad(this); // add both views to the scrollView ScrollView.AddSubview(SearchPanel.GetRootView( )); ScrollView.AddSubview(PeoplePanel.GetRootView( )); // setup the initial panel positions SearchPanel.GetRootView( ).Bounds = ScrollView.Bounds; // hide the people/family panels until we know which one the user wants PeoplePanel.GetRootView( ).Layer.Position = new CGPoint(MainPanel.Bounds.Width, 0); PeoplePanel.GetRootView( ).Hidden = true; // add our Close Button CloseButton = UIButton.FromType(UIButtonType.System); CloseButton.Layer.AnchorPoint = CGPoint.Empty; CloseButton.SetTitle("X", UIControlState.Normal); Theme.StyleButton(CloseButton, Config.Instance.VisualSettings.DefaultButtonStyle); CloseButton.SizeToFit( ); CloseButton.BackgroundColor = UIColor.Clear; CloseButton.Layer.BorderWidth = 0; MainPanel.AddSubview(CloseButton); CloseButton.TouchUpInside += (object sender, EventArgs e) => { ActivePanel.TouchesEnded( ); //ConfirmCancel( ); DismissAnimated(false, null); }; // setup the blocker view BlockerView = new UIBlockerView(MainPanel, MainPanel.Bounds.ToRectF( )); ActivePanel = SearchPanel; MainPanel.Layer.CornerRadius = 4; // default to hidden until PresentAnimated() is called View.Hidden = true; }