public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor );

            ScrollView = new UIScrollViewWrapper();
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Parent = this;
            ScrollView.Bounds = View.Bounds;
            View.AddSubview( ScrollView );

            KeyboardAdjustManager = new KeyboardAdjustManager( View );

            JoinGroupView = new UIJoinGroup();
            JoinGroupView.Create( ScrollView, View.Frame.ToRectF( ) );

            UITextField spouseName = (UITextField)JoinGroupView.SpouseName.PlatformNativeObject;
            spouseName.Delegate = new KeyboardAdjustManager.TextFieldDelegate( );

            UITextField emailName = (UITextField)JoinGroupView.Email.PlatformNativeObject;
            emailName.Delegate = new KeyboardAdjustManager.TextFieldDelegate( );

            // since we're using the platform UI, we need to manually hook up the phone formatting delegate,
            // because that isn't implemented in platform abstracted code.
            CellPhoneTextField = (UITextField)JoinGroupView.CellPhone.PlatformNativeObject;
            CellPhoneTextField.Delegate = new Rock.Mobile.PlatformSpecific.iOS.UI.PhoneNumberFormatterDelegate();
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor);

            ScrollView = new UIScrollViewWrapper();
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Parent            = this;
            ScrollView.Bounds            = View.Bounds;
            View.AddSubview(ScrollView);

            KeyboardAdjustManager = new KeyboardAdjustManager(View);

            JoinGroupView = new UIJoinGroup();
            JoinGroupView.Create(ScrollView, View.Frame.ToRectF( ));

            UITextField spouseName = (UITextField)JoinGroupView.SpouseName.PlatformNativeObject;

            spouseName.Delegate = new KeyboardAdjustManager.TextFieldDelegate( );

            UITextField emailName = (UITextField)JoinGroupView.Email.PlatformNativeObject;

            emailName.Delegate = new KeyboardAdjustManager.TextFieldDelegate( );

            // since we're using the platform UI, we need to manually hook up the phone formatting delegate,
            // because that isn't implemented in platform abstracted code.
            CellPhoneTextField          = (UITextField)JoinGroupView.CellPhone.PlatformNativeObject;
            CellPhoneTextField.Delegate = new Rock.Mobile.PlatformSpecific.iOS.UI.PhoneNumberFormatterDelegate();
        }
示例#3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // enable all controls
            EnableControls(true);

            // todo: determine if we're coming back from the post page.
            UISwitchAnonymous.SetState(false, false);
            UIPublicSwitch.SetState(false, false);

            TogglePlaceholderText( );

            // prepopulate the name fields if we have them
            if (RockMobileUser.Instance.LoggedIn == true)
            {
                FirstName.Field.Text = RockMobileUser.Instance.Person.NickName;
                LastName.Field.Text  = RockMobileUser.Instance.Person.LastName;
                Email.Field.Text     = RockMobileUser.Instance.Person.Email;
            }

            // monitor for text field being edited, and keyboard show/hide notitications
            NSObject handle = NSNotificationCenter.DefaultCenter.AddObserver(Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager.TextControlChangedNotification, OnTextChanged);

            ObserverHandles.Add(handle);

            KeyboardAdjustManager.Activate( );
        }
示例#4
0
        /*CGRect GetTappedTextFieldFrame( RectangleF textFrame )
         * {
         *  // first subtract the amount scrolled by the view.
         *  nfloat yPos = textFrame.Y - UIScrollView.ContentOffset.Y;
         *  nfloat xPos = textFrame.X - UIScrollView.ContentOffset.X;
         *
         *  // now add in however far down the scroll view is from the top.
         *  yPos += UIScrollView.Frame.Y;
         *  xPos += UIScrollView.Frame.X;
         *
         *  return new CGRect( xPos, yPos, textFrame.Width, textFrame.Height );
         * }*/

        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            if (KeyboardAdjustManager != null)
            {
                KeyboardAdjustManager.Deactivate( );
            }
        }
示例#5
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            KeyboardAdjustManager.Activate( );

            UIApplication.SharedApplication.IdleTimerDisabled = true;
            Rock.Mobile.Util.Debug.WriteLine("Turning idle timer OFF");
        }
示例#6
0
        public void PresentAnimated(int workingFamilyId, bool browsingPeople, FamilyInfoViewController.OnBrowsePeopleCompleteDelegate onComplete)
        {
            KeyboardAdjustManager.Activate( );

            WorkingFamilyId = workingFamilyId;

            OnCompleteDelegate = onComplete;

            // default to false
            RemoveFromOtherFamilies = false;

            // always begin at the SearchPanel
            SearchPanel.GetRootView( ).Layer.Position = CGPoint.Empty;

            PeoplePanel.GetRootView( ).Layer.Position = new CGPoint(MainPanel.Bounds.Width, 0);

            // use the provided bool to set the correct panel visible
            PeoplePanel.GetRootView( ).Hidden = !browsingPeople;

            ActivePanel = SearchPanel;

            View.Hidden = false;

            // animate the background to dark
            BackgroundPanel.Layer.Opacity = 0;

            SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(BackgroundPanel.Layer.Opacity, Settings.DarkenOpacity, .33f,
                                                                      delegate(float percent, object value)
            {
                BackgroundPanel.Layer.Opacity = (float)value;
            }, null);

            alphaAnim.Start(SimpleAnimator.Style.CurveEaseOut);


            // animate in the main panel
            MainPanel.Layer.Position = new CoreGraphics.CGPoint((View.Bounds.Width - MainPanel.Bounds.Width) / 2, View.Bounds.Height);

            // animate UP the main panel
            nfloat visibleHeight = Parent.GetVisibleHeight( );
            PointF endPos        = new PointF((float)(View.Bounds.Width - MainPanel.Bounds.Width) / 2,
                                              (float)(visibleHeight - MainPanel.Bounds.Height) / 2);

            SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF(MainPanel.Layer.Position.ToPointF( ), endPos, .33f,
                                                                      delegate(float percent, object value)
            {
                MainPanel.Layer.Position = (PointF)value;
            },
                                                                      delegate
            {
                SearchPanel.PerformSearch( );
            });


            posAnim.Start(SimpleAnimator.Style.CurveEaseOut);
        }
示例#7
0
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            foreach (NSObject handle in ObserverHandles)
            {
                NSNotificationCenter.DefaultCenter.RemoveObserver(handle);
            }

            ObserverHandles.Clear( );

            KeyboardAdjustManager.Deactivate( );
        }
示例#8
0
        void DismissAnimated(bool didSave, object returnContext)
        {
            // guard against multiple dismiss requests
            if (IsDismissing == false)
            {
                IsDismissing = true;

                // run an animation that will dismiss our view, and then remove
                // ourselves from the hierarchy
                SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(BackgroundPanel.Layer.Opacity, .00f, .33f,
                                                                          delegate(float percent, object value)
                {
                    BackgroundPanel.Layer.Opacity = (float)value;
                }, null);

                alphaAnim.Start(SimpleAnimator.Style.CurveEaseOut);


                // animate OUT the main panel
                PointF endPos = new PointF((float)(View.Bounds.Width - MainPanel.Bounds.Width) / 2, (float)View.Bounds.Height);

                SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF(MainPanel.Layer.Position.ToPointF( ), endPos, .33f,
                                                                          delegate(float percent, object value)
                {
                    MainPanel.Layer.Position = (PointF)value;
                },
                                                                          delegate
                {
                    // hide ourselves
                    View.Hidden = true;

                    IsDismissing = false;

                    KeyboardAdjustManager.Deactivate( );

                    OnCompleteDelegate(didSave, WorkingFamilyId, returnContext);
                });

                posAnim.Start(SimpleAnimator.Style.CurveEaseOut);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.BackgroundColor );

            ScrollView = new UIScrollViewWrapper();
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Parent = this;
            ScrollView.Bounds = View.Bounds;
            View.AddSubview( ScrollView );

            ScrollView.ScrollEnabled = false;

            // setup everything except positioning, which will happen in LayoutChanged()
            SourceLocation = null;
            GroupEntries = new List<GroupFinder.GroupEntry>();

            SearchAddressButton = UIButton.FromType( UIButtonType.System );
            ScrollView.AddSubview( SearchAddressButton );
            SearchAddressButton.Layer.AnchorPoint = CGPoint.Empty;
            ControlStyling.StyleButton( SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
            SearchAddressButton.TouchUpInside += (object sender, EventArgs e ) =>
                {
                    SearchPage.Show( );
                    Task.NavToolbar.Reveal( false );
                };


            MapView = new MKMapView( );
            ScrollView.AddSubview( MapView );

            // set the default position for the map to whatever specified area.
            MKCoordinateRegion region = MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D( 
                ConnectConfig.GroupFinder_DefaultLatitude, 
                ConnectConfig.GroupFinder_DefaultLongitude ), 
                ConnectConfig.GroupFinder_DefaultScale_iOS, 
                ConnectConfig.GroupFinder_DefaultScale_iOS );
            MapView.SetRegion( region, true );

            MapView.Layer.AnchorPoint = new CGPoint( 0, 0 );
            MapView.Delegate = new MapViewDelegate() { Parent = this };

            SearchResultsBGLayer = new UIView();
            ScrollView.AddSubview( SearchResultsBGLayer );
            SearchResultsBGLayer.Layer.AnchorPoint = new CGPoint( 0, 0 );
            SearchResultsBGLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );

            SearchResultsPrefix = new UILabel( );
            ScrollView.AddSubview( SearchResultsPrefix );
            SearchResultsPrefix.Layer.AnchorPoint = new CGPoint( 0, 0 );
            SearchResultsPrefix.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
            SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;
            SearchResultsPrefix.SizeToFit( );
            SearchResultsPrefix.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor );
            SearchResultsPrefix.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
            SearchResultsPrefix.TextAlignment = UITextAlignment.Center;

            SearchResultsNeighborhood = new UILabel( );
            ScrollView.AddSubview( SearchResultsNeighborhood );
            SearchResultsNeighborhood.Layer.AnchorPoint = new CGPoint( 0, 0 );
            SearchResultsNeighborhood.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
            SearchResultsNeighborhood.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor );
            SearchResultsNeighborhood.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
            SearchResultsNeighborhood.TextAlignment = UITextAlignment.Center;


            Seperator = new UIView( );
            ScrollView.AddSubview( Seperator );
            Seperator.Layer.BorderWidth = 1;
            Seperator.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ).CGColor;


            GroupFinderTableView = new UITableView();
            ScrollView.AddSubview( GroupFinderTableView );
            GroupTableSource = new GroupFinderViewController.TableSource( this );

            // add the table view and source
            GroupFinderTableView.BackgroundColor = UIColor.Clear;//Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.Table_Footer_Color );
            //GroupFinderTableView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.BG_Layer_Color );
            GroupFinderTableView.Source = GroupTableSource;
            GroupFinderTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            BlockerView = new UIBlockerView( ScrollView, ScrollView.Frame.ToRectF( ) );

            SearchPage = new UIGroupFinderSearch();
            SearchPage.Create( ScrollView, ScrollView.Frame.ToRectF( ), 
                delegate
                {
                    SearchPage.Hide( true );
                    GetGroups( SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text );
                    Task.NavToolbar.Reveal( true );
                } );
            SearchPage.SetTitle( ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails );
            SearchPage.Hide( false );

            KeyboardAdjustManager = new KeyboardAdjustManager( View );

            // don't allow them to tap the address button until we reveal the search page.
            SearchAddressButton.Enabled = false;

            // wait a couple seconds before revealing the search page.
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.AutoReset = false;
            timer.Interval = 1000;
            timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) =>
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
                        {
                            SearchAddressButton.Enabled = true;
                            SearchPage.Show( );                
                        } );
                };
            timer.Start( );

            // hook in delegates so we can handle return
            ((UITextField)SearchPage.Street.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this };
            ((UITextField)SearchPage.City.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this };
            ((UITextField)SearchPage.State.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this };
            ((UITextField)SearchPage.ZipCode.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this };
        }
        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 = Theme.GetColor( Config.Instance.VisualSettings.SidebarBGColor );//Theme.GetColor( Config.Instance.VisualSettings.TopHeaderBGColor );
            MainPanel.Layer.Opacity = 1.00f;
            MainPanel.ClipsToBounds = true;
            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.BackgroundColor );
            MainPanel.AddSubview( ScrollView );

            // setup controls that go on the left side
            AdultChildToggle = new UIToggle( Strings.General_Adult, Strings.General_Child,
                delegate(bool wasLeft)
                {
                    if( wasLeft == true )
                    {
                        SwitchActiveMemberView( AdultPanel );
                    }
                    else
                    {
                        SwitchActiveMemberView( ChildPanel );
                    }
                } );
            Theme.StyleToggle( AdultChildToggle, Config.Instance.VisualSettings.ToggleStyle );
            AdultChildToggle.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize );
            AdultChildToggle.Layer.AnchorPoint = CGPoint.Empty;
            MainPanel.AddSubview( AdultChildToggle );

            // setup our submit button
            SubmitButton = UIButton.FromType( UIButtonType.System );
            SubmitButton.Layer.AnchorPoint = CGPoint.Empty;
            SubmitButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize );
            SubmitButton.SetTitle( Strings.General_Save, UIControlState.Normal );
            SubmitButton.BackgroundColor = UIColor.Blue;
            SubmitButton.SizeToFit( );
            Theme.StyleButton( SubmitButton, Config.Instance.VisualSettings.PrimaryButtonStyle );
            SubmitButton.Bounds = new CGRect( 0, 0, SubmitButton.Bounds.Width * 2.00f, SubmitButton.Bounds.Height );
            MainPanel.AddSubview( SubmitButton );
            SubmitButton.TouchUpInside += (object sender, EventArgs e ) =>
            {
                TrySubmitPerson( );
            };

            // setup the button to tap for editing the picture
            EditPictureButton = new UIButton( new CGRect( 0, 0, 112, 112 )  );
            EditPictureButton.Layer.AnchorPoint = CGPoint.Empty;
            EditPictureButton.Font = FontManager.GetFont( Settings.AddPerson_Icon_Font_Primary, Settings.AddPerson_SymbolFontSize );
            EditPictureButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.PhotoOutlineColor ), UIControlState.Normal );
            EditPictureButton.Layer.BorderColor = Theme.GetColor( Config.Instance.VisualSettings.PhotoOutlineColor ).CGColor;
            EditPictureButton.Layer.CornerRadius = EditPictureButton.Bounds.Width / 2;
            EditPictureButton.Layer.BorderWidth = 4;
            MainPanel.AddSubview( EditPictureButton );

            EditPictureButton.TouchUpInside += (object sender, EventArgs e ) =>
                {
                    Parent.CaptureImage( delegate(NSData imageBuffer )
                        {
                            // if an image was taken, flag this as dirty so
                            // we know to upload it.
                            if( imageBuffer != null )
                            {
                                ProfileImageViewDirty = true;
                                UpdateProfilePic( imageBuffer );
                            }
                        });
                };

            // set the profile image mask so it's circular
            CALayer maskLayer = new CALayer();
            maskLayer.AnchorPoint = new CGPoint( 0, 0 );
            maskLayer.Bounds = EditPictureButton.Layer.Bounds;
            maskLayer.CornerRadius = EditPictureButton.Bounds.Width / 2;
            maskLayer.BackgroundColor = UIColor.Black.CGColor;
            EditPictureButton.Layer.Mask = maskLayer;
            //

            // setup the image that will display (and note it's a child of EditPictureButton)
            ProfileImageView = new UIImageView( );
            ProfileImageView.ContentMode = UIViewContentMode.ScaleAspectFit;

            ProfileImageView.Layer.AnchorPoint = CGPoint.Empty;
            ProfileImageView.Bounds = EditPictureButton.Bounds;
            ProfileImageView.Layer.Position = CGPoint.Empty;
            EditPictureButton.AddSubview( ProfileImageView );

            KeyboardAdjustManager = new KeyboardAdjustManager( MainPanel );

            // setup both types of member view. Adult and Child
            AdultPanel = new AdultMemberPanel( );
            AdultPanel.ViewDidLoad( this );
            ScrollView.AddSubview( AdultPanel.GetRootView( ) );

            ChildPanel = new ChildMemberPanel( );
            ChildPanel.ViewDidLoad( this );
            ScrollView.AddSubview( ChildPanel.GetRootView( ) );

            // 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;
            //CloseButton.Layer.CornerRadius = CloseButton.Bounds.Width / 2;
            MainPanel.AddSubview( CloseButton );
            CloseButton.TouchUpInside += (object sender, EventArgs e ) =>
            {
                ActivePanel.TouchesEnded( );

                if ( ActivePanel.IsInfoDirty( WorkingPerson, WorkingPhoneNumber ) || ProfileImageViewDirty == true )
                {
                    ConfirmCancel( );
                }
                else
                {
                    DismissAnimated( false );
                }
            };

            // default to the adult, and hide the child one
            ActivePanel = AdultPanel;
            ChildPanel.GetRootView( ).Hidden = true;

            View.SetNeedsLayout( );

            ProfileImageView.Image = null;
            EditPictureButton.SetTitle( Settings.AddPerson_NoPhotoSymbol, UIControlState.Normal );

            // remove any existing picture.
            FileCache.Instance.RemoveFile( Settings.AddPerson_PicName );

            // setup the main bounds
            MainPanel.Bounds = new CoreGraphics.CGRect( 0, 0, View.Bounds.Width * .75f, View.Bounds.Height * .75f );

            MainPanel.Layer.CornerRadius = 4;

            // default to hidden until PresentAnimated() is called.
            View.Hidden = true;

            BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) );
        }
示例#11
0
        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;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(MobileApp.Shared.Config.ControlStylingConfig.BackgroundColor);

            ScrollView = new UIScrollViewWrapper();
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Parent            = this;
            ScrollView.Bounds            = View.Bounds;
            View.AddSubview(ScrollView);

            ScrollView.ScrollEnabled = false;

            // setup everything except positioning, which will happen in LayoutChanged()
            SourceLocation = null;
            GroupEntries   = new List <MobileAppApi.GroupSearchResult>();

            SearchAddressButton = UIButton.FromType(UIButtonType.System);
            ScrollView.AddSubview(SearchAddressButton);
            SearchAddressButton.Layer.AnchorPoint = CGPoint.Empty;
            ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            SearchAddressButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                SearchPage.Show( );
                Task.NavToolbar.Reveal(false);
            };


            MapView = new MKMapView( );
            ScrollView.AddSubview(MapView);

            CurrGroupIndex     = 0;
            NumRequestedGroups = 10;

            // set the default position for the map to whatever specified area.
            MKCoordinateRegion region = MKCoordinateRegion.FromDistance(new CLLocationCoordinate2D(
                                                                            ConnectConfig.GroupFinder_DefaultLatitude,
                                                                            ConnectConfig.GroupFinder_DefaultLongitude),
                                                                        ConnectConfig.GroupFinder_DefaultScale_iOS,
                                                                        ConnectConfig.GroupFinder_DefaultScale_iOS);

            MapView.SetRegion(region, true);

            MapView.Layer.AnchorPoint = new CGPoint(0, 0);
            MapView.Delegate          = new MapViewDelegate()
            {
                Parent = this
            };

            SearchResultsBGLayer = new UIView();
            ScrollView.AddSubview(SearchResultsBGLayer);
            SearchResultsBGLayer.Layer.AnchorPoint = new CGPoint(0, 0);
            SearchResultsBGLayer.BackgroundColor   = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);

            SearchResultsPrefix = new UILabel( );
            ScrollView.AddSubview(SearchResultsPrefix);
            SearchResultsPrefix.Layer.AnchorPoint = new CGPoint(0, 0);
            SearchResultsPrefix.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;
            SearchResultsPrefix.SizeToFit( );
            SearchResultsPrefix.TextColor       = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor);
            SearchResultsPrefix.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);
            SearchResultsPrefix.TextAlignment   = UITextAlignment.Center;

            SearchResultsNeighborhood = new UILabel( );
            ScrollView.AddSubview(SearchResultsNeighborhood);
            SearchResultsNeighborhood.Layer.AnchorPoint = new CGPoint(0, 0);
            SearchResultsNeighborhood.Font            = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            SearchResultsNeighborhood.TextColor       = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            SearchResultsNeighborhood.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);
            SearchResultsNeighborhood.TextAlignment   = UITextAlignment.Center;


            Seperator = new UIView( );
            ScrollView.AddSubview(Seperator);
            Seperator.Layer.BorderWidth = 1;
            Seperator.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor).CGColor;


            GroupFinderTableView = new UITableView();
            ScrollView.AddSubview(GroupFinderTableView);
            GroupTableSource = new GroupFinderViewController.TableSource(this);

            // add the table view and source
            GroupFinderTableView.BackgroundColor = UIColor.Clear;
            GroupFinderTableView.Source          = GroupTableSource;
            GroupFinderTableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;

            BlockerView = new UIBlockerView(ScrollView, ScrollView.Frame.ToRectF( ));

            SearchPage = new UIGroupFinderSearch();
            SearchPage.Create(ScrollView, ScrollView.Frame.ToRectF( ),
                              // Search Neighborhood Groups
                              delegate
            {
                SearchPage.Hide(true);
                GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                Task.NavToolbar.Reveal(true);
            },
                              // Search Short Term Groups
                              delegate
            {
                SearchPage.Hide(true);
                GetInitialGroups(PrivateGeneralConfig.GroupType_ShortTermGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                Task.NavToolbar.Reveal(true);
            },
                              // Search Young Adults Groups
                              delegate
            {
                SearchPage.Hide(true);
                GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                Task.NavToolbar.Reveal(true);
            });
            SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails);
            SearchPage.Hide(false);

            KeyboardAdjustManager = new KeyboardAdjustManager(View);

            // don't allow them to tap the address button until we reveal the search page.
            SearchAddressButton.Enabled = false;

            // wait a couple seconds before revealing the search page.
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.AutoReset = false;
            timer.Interval  = 1000;
            timer.Elapsed  += (object sender, System.Timers.ElapsedEventArgs e) =>
            {
                Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                {
                    SearchAddressButton.Enabled = true;
                    SearchPage.Show( );
                });
            };
            timer.Start( );

            // hook in delegates so we can handle return
            ((UITextField)SearchPage.Street.PlatformNativeObject).Delegate = new AddressDelegate( )
            {
                Parent = this
            };
            ((UITextField)SearchPage.City.PlatformNativeObject).Delegate = new AddressDelegate( )
            {
                Parent = this
            };
            ((UITextField)SearchPage.State.PlatformNativeObject).Delegate = new AddressDelegate( )
            {
                Parent = this
            };
            ((UITextField)SearchPage.ZipCode.PlatformNativeObject).Delegate = new AddressDelegate( )
            {
                Parent = this
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.Layer.Contents = Parent.View.Layer.Contents;
            View.BackgroundColor = Parent.View.BackgroundColor;

            // setup a scroll view
            ScrollView = new UIScrollViewWrapper();
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.Parent = this;
            ScrollView.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.SidebarBGColor );
            View.AddSubview( ScrollView );

            FamilyName = new Dynamic_UITextField( this, ScrollView, Strings.General_FamilyName, false, true );
            FamilyName.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No;
            FamilyName.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.Words;
            FamilyName.AddToView( ScrollView );

            //TODO: Handle international
            AddressHeader = new UILabel();
            AddressHeader.Layer.AnchorPoint = CGPoint.Empty;
            AddressHeader.Text = Strings.General_HomeAddress;
            AddressHeader.Font = FontManager.GetFont( Settings.General_BoldFont, Config.Instance.VisualSettings.SmallFontSize );
            Theme.StyleLabel( AddressHeader, Config.Instance.VisualSettings.LabelStyle );
            ScrollView.AddSubview( AddressHeader );

            Street = new UIInsetTextField();
            Street.InputAssistantItem.LeadingBarButtonGroups = null;
            Street.InputAssistantItem.TrailingBarButtonGroups = null;
            Street.Layer.AnchorPoint = CGPoint.Empty;
            Street.Placeholder = Strings.General_Street;
            Street.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize );
            Theme.StyleTextField( Street, Config.Instance.VisualSettings.TextFieldStyle );
            Street.AutocorrectionType = UITextAutocorrectionType.No;
            Street.AutocapitalizationType = UITextAutocapitalizationType.Words;
            ScrollView.AddSubview( Street );

            City = new UIInsetTextField();
            City.InputAssistantItem.LeadingBarButtonGroups = null;
            City.InputAssistantItem.TrailingBarButtonGroups = null;
            City.Layer.AnchorPoint = CGPoint.Empty;
            City.Placeholder = Strings.General_City;
            City.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize );
            Theme.StyleTextField( City, Config.Instance.VisualSettings.TextFieldStyle );
            City.AutocorrectionType = UITextAutocorrectionType.No;
            City.AutocapitalizationType = UITextAutocapitalizationType.Words;
            ScrollView.AddSubview( City );

            State = new UIInsetTextField();
            State.InputAssistantItem.LeadingBarButtonGroups = null;
            State.InputAssistantItem.TrailingBarButtonGroups = null;
            State.Layer.AnchorPoint = CGPoint.Empty;
            State.Placeholder = Strings.General_State;
            State.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize );
            Theme.StyleTextField( State, Config.Instance.VisualSettings.TextFieldStyle );
            State.AutocorrectionType = UITextAutocorrectionType.No;
            State.AutocapitalizationType = UITextAutocapitalizationType.Words;
            ScrollView.AddSubview( State );

            PostalCode = new UIInsetTextField();
            PostalCode.InputAssistantItem.LeadingBarButtonGroups = null;
            PostalCode.InputAssistantItem.TrailingBarButtonGroups = null;
            PostalCode.Layer.AnchorPoint = CGPoint.Empty;
            PostalCode.Placeholder = Strings.General_Zip;
            PostalCode.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize );
            Theme.StyleTextField( PostalCode, Config.Instance.VisualSettings.TextFieldStyle );
            ScrollView.AddSubview( PostalCode );
            //

            // build an array with all the campuses
            string[] campuses = new string[ Config.Instance.Campuses.Count ];
            for ( int i = 0; i < Config.Instance.Campuses.Count; i++ )
            {
                campuses[ i ] = Config.Instance.Campuses[ i ].Name;
            }

            FamilyCampus = new Dynamic_UIDropDown( this, ScrollView, Strings.FamilyInfo_Select_Campus_Header, Strings.FamilyInfo_Select_Campus_Message, campuses, false );
            FamilyCampus.AddToView( ScrollView );

            //default the campus to whatever's selected by the app settings.
            FamilyCampus.SetCurrentValue( Config.Instance.Campuses[ Config.Instance.SelectedCampusIndex ].Name );

            // build the dynamic UI controls
            for( int i = 0; i < Config.Instance.FamilyAttributeDefines.Count; i++ )
            {
                // get the required flag and the attribs that define what type of UI control this is.
                bool isRequired = bool.Parse( Config.Instance.FamilyAttributes[ i ][ "required" ] );
                Rock.Client.Attribute uiControlAttrib = Config.Instance.FamilyAttributeDefines[ i ];

                // build it and add it to our UI
                IDynamic_UIView uiView = Dynamic_UIFactory.CreateDynamic_UIControl( this, ScrollView, uiControlAttrib, isRequired, Config.Instance.FamilyAttributeDefines[ i ].Key );
                if ( uiView != null )
                {
                    Dynamic_FamilyControls.Add( uiView );
                    Dynamic_FamilyControls[ Dynamic_FamilyControls.Count - 1 ].AddToView( ScrollView );
                }
            }

            KeyboardAdjustManager = new KeyboardAdjustManager( View );

            // save button goes last, BELOW the dynamic content
            SaveButton = UIButton.FromType( UIButtonType.System );
            SaveButton.Layer.AnchorPoint = CGPoint.Empty;
            SaveButton.SetTitle( Strings.General_Save, UIControlState.Normal );
            SaveButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize );
            Theme.StyleButton( SaveButton, Config.Instance.VisualSettings.PrimaryButtonStyle );
            SaveButton.SetTitleColor( UIColor.LightGray, UIControlState.Disabled );
            SaveButton.SizeToFit( );
            SaveButton.Bounds = new CGRect( 0, 0, SaveButton.Bounds.Width * 2.00f, SaveButton.Bounds.Height );
            ScrollView.AddSubview( SaveButton );

            SaveButton.TouchUpInside += (object sender, EventArgs e ) =>
                {
                    TrySubmitFamilyInfo( );
                };

            TableView = new UITableView( );
            TableView.Layer.AnchorPoint = CGPoint.Empty;
            TableView.BackgroundColor = UIColor.Clear;
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            View.AddSubview( TableView );

            // if there's no family ID this is a new family, so create a table that lets them begin adding people
            if ( Family.Id == 0 )
            {
                TableView.Source = new TableSource( this );
            }

            // create the new person and add person view controllers
            PersonInfoViewController = new PersonInfoViewController( Parent );
            AddChildViewController( PersonInfoViewController );
            View.AddSubview( PersonInfoViewController.View );

            AddPersonViewController = new AddPersonViewController( Parent );
            AddChildViewController( AddPersonViewController );
            View.AddSubview( AddPersonViewController.View );

            BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) );

            View.AddSubview( SaveResult );
        }