public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            AddPullToRefresh ();

            // add the nav button.
            UIBarButtonItem addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add);
            addButton.Clicked += async (sender, e) => {

                var addController = new AddCheckinViewController();
                this.NavigationController.PushViewController(addController,true);
                _dataSource.Clear();

                var result = await Buddy.RecordMetricAsync("adding_checkin", null, TimeSpan.FromDays(1));

                if (result.IsSuccess) {
                    _timedMetric = result.Value;
                }
            };

            this.NavigationItem.RightBarButtonItem = addButton;

            UIBarButtonItem logoutButton = new UIBarButtonItem ("Logout", UIBarButtonItemStyle.Plain, 
                async (s, e) => {
                    await Buddy.LogoutUserAsync();
                });

            this.NavigationItem.LeftBarButtonItem = logoutButton;

            _dataSource = new CheckinDataSource (this);
            this.checkinTable.Source = _dataSource;
        }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddPullToRefresh();

            // add the nav button.
            UIBarButtonItem addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            addButton.Clicked += async(sender, e) => {
                var addController = new AddCheckinViewController();
                this.NavigationController.PushViewController(addController, true);
                _dataSource.Clear();

                var result = await Buddy.RecordMetricAsync("adding_checkin", null, TimeSpan.FromDays(1));

                if (result.IsSuccess)
                {
                    _timedMetric = result.Value;
                }
            };

            this.NavigationItem.RightBarButtonItem = addButton;

            UIBarButtonItem logoutButton = new UIBarButtonItem("Logout", UIBarButtonItemStyle.Plain,
                                                               async(s, e) => {
                await Buddy.LogoutUserAsync();
            });

            this.NavigationItem.LeftBarButtonItem = logoutButton;

            _dataSource = new CheckinDataSource(this);
            this.checkinTable.Source = _dataSource;
        }