public static FlyingObjectsContainterViewController CreateModal(UIViewController nestedViewController)
        {
            var flyingObjectsContainerViewController = new FlyingObjectsContainterViewController();
            flyingObjectsContainerViewController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;

            var clearNavigationController = flyingObjectsContainerViewController.ContainerNavigationController;
            clearNavigationController.SetViewControllers(new UIViewController[] { nestedViewController }, false);

            return flyingObjectsContainerViewController;
        }
Example #2
0
        public static void EnterApplication(bool animated, bool doubleTake)
        {
            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
            var flyingObjectsContainerViewController = new FlyingObjectsContainterViewController();
            var clearNavigationController            = flyingObjectsContainerViewController.ContainerNavigationController;

            clearNavigationController.SetViewControllers(new UIViewController[] { new MasterViewController() }, false);

            if (animated)
            {
                UIView.Transition(appDelegate.Window, 0.5, UIViewAnimationOptions.TransitionNone, () =>
                {
                    if (appDelegate.Window.RootViewController == null)
                    {
                        appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
                        appDelegate.SetUpPushNotificaions();
                        return;
                    }


                    appDelegate.Window.RootViewController.DismissViewController(false, () =>
                    {
                        appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
                    });

                    appDelegate.SetUpPushNotificaions();
                }, null);
            }
            else
            {
                if (appDelegate.Window.RootViewController == null)
                {
                    appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
                    appDelegate.SetUpPushNotificaions();
                    return;
                }


                appDelegate.Window.RootViewController.DismissViewController(false, () =>
                {
                    appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
                });
            }

            if (doubleTake)
            {
                appDelegate.Window.RootViewController.DismissViewController(false, null);
                appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
            }
        }
Example #3
0
 public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
 {
     if (IsPresenting)
     {
         UIViewController toVC = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);
         FlyingObjectsContainterViewController fromVC = (FlyingObjectsContainterViewController)transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey);
         OpenDrawer(transitionContext, toVC, fromVC);
     }
     else
     {
         FlyingObjectsContainterViewController toVC = (FlyingObjectsContainterViewController)transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);
         UIViewController fromVC = transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey);
         CloseDrawer(transitionContext, fromVC, toVC);
     }
 }
Example #4
0
        public static void ShowOnboarding(bool animated)
        {
            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
            var flyingObjectsContainerViewController = new FlyingObjectsContainterViewController();

            flyingObjectsContainerViewController.ShowsAds = false;
            var clearNavigationController = flyingObjectsContainerViewController.ContainerNavigationController;

            clearNavigationController.SetViewControllers(new UIViewController[] { new OnboardingViewController() }, false);

            if (animated)
            {
                UIView.Transition(appDelegate.Window, 0.5, UIViewAnimationOptions.TransitionCrossDissolve, () =>
                {
                    appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
                }, null);
            }
            else
            {
                appDelegate.Window.RootViewController = flyingObjectsContainerViewController;
            }
        }
Example #5
0
 private void CloseDrawer(IUIViewControllerContextTransitioning transitionContext, UIViewController fromVC, FlyingObjectsContainterViewController toVC)
 {
     if (Direction == DrawerDirection.Left)
     {
         toVC.View.LayoutIfNeeded();
         toVC.ShiftContainerRight(0);
         UIView.Animate(0.25,
                        () =>
         {
             fromVC.View.Frame = new CGRect(-toVC.View.Frame.Size.Width, UIApplication.SharedApplication.StatusBarFrame.Size.Height, fromVC.View.Frame.Size.Width, toVC.View.Window.Frame.Size.Height);
             toVC.View.LayoutIfNeeded();
         },
                        () =>
         {
             transitionContext.CompleteTransition(true);
         }
                        );
     }
     else
     {
         toVC.View.LayoutIfNeeded();
         toVC.ShiftContainerRight(0);
         UIView.Animate(0.25,
                        () =>
         {
             fromVC.View.Frame = new CGRect(toVC.View.Frame.Size.Width, UIApplication.SharedApplication.StatusBarFrame.Size.Height, fromVC.View.Frame.Size.Width, toVC.View.Window.Frame.Size.Height);
             toVC.View.LayoutIfNeeded();
         },
                        () =>
         {
             fromVC = null;
             transitionContext.CompleteTransition(true);
         });
     }
 }
Example #6
0
        private void OpenDrawer(IUIViewControllerContextTransitioning transitionContext, UIViewController toVC, FlyingObjectsContainterViewController fromVC)
        {
            transitionContext.ContainerView.AddSubview(toVC.View);
            var container = (fromVC as FlyingObjectsContainterViewController).ContainerNavigationController;
            var height    = container.View.Window.Frame.Height - (container.View.Window.Frame.Height - container.View.Frame.GetMaxY());

            if (Direction == DrawerDirection.Left)
            {
                toVC.View.Frame = new CGRect(-fromVC.View.Frame.Size.Width, UIApplication.SharedApplication.StatusBarFrame.Size.Height, MaxX, height);
                fromVC.View.LayoutIfNeeded();
                fromVC.ShiftContainerRight(270);

                UIView.Animate(TransitionDuration(transitionContext),
                               () =>
                {
                    if (fromVC.View.Frame.Size.Width - 50 > MaxX)
                    {
                        MaxX = 270;
                    }
                    toVC.View.Frame = new CGRect(0, UIApplication.SharedApplication.StatusBarFrame.Size.Height, MaxX, height);
                    fromVC.View.LayoutIfNeeded();
                },
                               () =>
                {
                    transitionContext.CompleteTransition(true);
                }
                               );
            }
            else
            {
                toVC.View.Frame = new CGRect(fromVC.View.Frame.Size.Width, UIApplication.SharedApplication.StatusBarFrame.Size.Height, MaxX, height);
                fromVC.View.LayoutIfNeeded();
                fromVC.ShiftContainerRight(270);

                UIView.Animate(TransitionDuration(transitionContext),
                               () =>
                {
                    toVC.View.Frame = new CGRect(fromVC.View.Frame.Size.Width - MaxX, UIApplication.SharedApplication.StatusBarFrame.Size.Height, MaxX, height);
                    fromVC.View.LayoutIfNeeded();
                },
                               () =>
                {
                    transitionContext.CompleteTransition(true);
                }
                               );
            }
        }
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new NewCardTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, NewCardModel arg2) =>
            {
                if (arg2 == null || String.IsNullOrEmpty(arg2.Title))
                {
                    return;
                }

                var vc = new ColorPickerViewController();
                vc.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
                vc.ModalTransitionStyle   = UIModalTransitionStyle.CrossDissolve;
                vc.LabelTitle             = arg2.Title;
                vc.StartingColor          = ColorUtils.FromHexString(arg2.ColorHexString, UIColor.White);
                vc.ColorPicked           += (UIColor obj) =>
                {
                    if (obj == null && String.IsNullOrEmpty(arg2.Title))
                    {
                        return;
                    }

                    arg2.ColorHexString = ColorUtils.HexStringFromColor(obj);

                    if (arg2.Title.Equals(NewCardShared.new_card_model_border_color, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.BorderColor, arg2.ColorHexString);
                        Shared.SelectedCard.ShowFront();
                    }

                    else if (arg2.Title.Equals(NewCardShared.new_card_model_background_color, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.BackgroundColor, arg2.ColorHexString);
                        Shared.SelectedCard.ShowBack();
                    }

                    else if (arg2.Title.Equals(NewCardShared.new_card_model_company_name_text_color, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.CompanyNameTextColor, arg2.ColorHexString);
                        Shared.SelectedCard.ShowBack();
                    }


                    HeaderView.Update(false);
                    TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic);
                };

                var flyingObjectsContainerViewController = new FlyingObjectsContainterViewController();
                var clearNavigationController            = flyingObjectsContainerViewController.ContainerNavigationController;
                clearNavigationController.SetViewControllers(new UIViewController[] { vc }, false);
                PresentViewController(flyingObjectsContainerViewController, false, null);
            };
            TableSource.RowDeleted += (NSIndexPath arg1, NewCardModel arg2) =>
            {
                if (arg2.Outlet == null)
                {
                    return;
                }

                Shared.SelectedCard.RemoveOutlet(arg2.Outlet);
                TableSource.TableItems.Remove(arg2);
                HeaderView.Update(false);
            };
            TableView.Source = TableSource;

            HeaderView.Editable     = true;
            HeaderView.SelectedCard = Shared.SelectedCard;
            HeaderView.View.Frame   = new CGRect(0, 0, TableView.Frame.Width, CardViewController.GetCalculatedHeight());
            AddChildViewController(HeaderView);
            TableView.TableHeaderView = HeaderView.View;


            AddRowViewController FooterView = new AddRowViewController();

            FooterView.LabelAddText = NewCardShared.AddNewOutlet;
            FooterView.Clicked     += (editing) =>
            {
                ShowMyOutletsViewController();
            };
            FooterView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight());
            TableView.TableFooterView = FooterView.View;
            AddChildViewController(FooterView);
        }