예제 #1
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);
        }