Esempio 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);
        }
Esempio n. 2
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            CollectionViewTappedNotificaion = NSNotificationCenter.DefaultCenter.AddObserver(new NSString(Strings.InternalNotifications.notification_collection_view_tapped), (obj) =>
            {
                InvokeOnMainThread(() =>
                {
                    var indexPath = obj.Object as NSIndexPath;
                    if (indexPath == null)
                    {
                        return;
                    }

                    var card = TableSource.GetModelInList(indexPath);

                    var vc = new SharingViewController();
                    (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = card;
                    ApplicationExtensions.PushViewController(vc, true);
                });
            });
        }
Esempio 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);
        }