Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new ConnectionsTableViewSource();
            ((ConnectionsTableViewSource)TableSource).CardSelected += (NSIndexPath arg1, Card arg2) =>
            {
                var vc = new SharingViewController();
                vc.Title = arg2.Name;
                (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2;
                ApplicationExtensions.PushViewController(vc, true);
            };
            TableView.Source         = TableSource;
            TableView.SeparatorStyle = UIKit.UITableViewCellSeparatorStyle.None;


            var label = LabelWithActivityIndicatorView.Create();

            label.BindDataToView("No Connections", true);
            TableViewEmptyBackground = label;

            var swipeGesture = new UISwipeGestureRecognizer((obj) =>
            {
                var swipeLocatioin = obj.LocationInView(TableView);

                var indexPath = TableView.IndexPathForRowAtPoint(swipeLocatioin);
                if (indexPath == null)
                {
                    return;
                }

                var cell = TableView.CellAt(indexPath) as MyCardsTableViewCell;
                if (cell == null)
                {
                    return;
                }

                var model = ((ConnectionsTableViewSource)TableSource).GetCardAtIndexPath(indexPath);
                if (model == null)
                {
                    return;
                }

                cell.Flip(model);
            });

            swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right;
            TableView.AddGestureRecognizer(swipeGesture);
        }
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new MyOutletsTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, Outlet arg2) =>
            {
                OutletSelected?.Invoke(arg2);
            };
            TableSource.RowDeleted += (NSIndexPath arg1, Outlet arg2) =>
            {
                RealmServices.DeleteOutlet(arg2);
                TableSource.TableItems = RealmServices.GetMyOutlets();
            };
            TableView.Source = TableSource;


            var label = LabelWithActivityIndicatorView.Create();

            label.BindDataToView("No Outlets", true);
            TableViewEmptyBackground = label;


            AddRowViewController FooterView = new AddRowViewController();

            FooterView.LabelAddText = Strings.TableViewFooters.table_view_footer_create_new_outlet;
            FooterView.Clicked     += (editing) =>
            {
                CATransition transition = CATransition.CreateAnimation();
                transition.Duration = 0.3;
                transition.Type     = CATransition.TransitionFade;
                NavigationController.View.Layer.AddAnimation(transition, null);
                NavigationController.PushViewController(new NewOutletViewController(), false);
            };
            FooterView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight());
            TableView.TableFooterView = FooterView.View;
            AddChildViewController(FooterView);
        }
Exemplo n.º 3
0
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();


            TableSource = new MyCardsTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, Card arg2) =>
            {
                var vc = new SharingViewController();
                (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2;
                ApplicationExtensions.PushViewController(vc, true);
            };
            TableView.Source         = TableSource;
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            var label = LabelWithActivityIndicatorView.Create();

            label.BindDataToView("No Cards", true);
            TableViewEmptyBackground = label;

            AddRowViewController FooterView = new AddRowViewController();

            FooterView.LabelAddText = MyCardsShared.CreateNewCard;
            FooterView.Clicked     += (editingCreateNewCard) =>
            {
                var vc = new NewCardViewController();
                (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = Card.Create();
                ApplicationExtensions.PushViewController(vc, true);
            };
            FooterView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight());
            TableView.TableFooterView = FooterView.View;
            AddChildViewController(FooterView);



            var swipeGesture = new UISwipeGestureRecognizer((obj) =>
            {
                var swipeLocatioin = obj.LocationInView(TableView);

                var indexPath = TableView.IndexPathForRowAtPoint(swipeLocatioin);
                if (indexPath == null)
                {
                    return;
                }

                var cell = TableView.CellAt(indexPath) as MyCardsTableViewCell;
                if (cell == null)
                {
                    return;
                }

                var model = TableSource.GetModelInList(indexPath);
                if (model == null)
                {
                    return;
                }

                cell.Flip(model);
            });

            swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right;
            TableView.AddGestureRecognizer(swipeGesture);
        }