예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (((SharingTableViewController)TargetViewController).Shared.SelectedCard.IsMine())
            {
                NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (sender, e) =>
                {
                    //this is used to counter the auto reload. See NewCardTableViewController
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedTransporterKey);
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedValueTransporterKey);

                    var vc = new NewCardViewController();
                    (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = (TargetViewController as SharingTableViewController).Shared.SelectedCard;
                    ApplicationExtensions.PushViewController(vc, true);
                });
            }
            else
            {
                NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Trash, (sender, e) =>
                {
                    ((SharingTableViewController)TargetViewController).Shared.DeleteCard();
                    NavigationController.PopViewController(true);
                });
            }

            RemoveBackBarButtonTitle();
        }
예제 #2
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);
        }