Beispiel #1
0
        async public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.Source = _dataSource = new DataSource(this);

            var gotToken = await CrmOauth.GetToken(this);

            if (!gotToken)
            {
                return;
            }

            Login.Title = "Logout";
            GetAccounts(NSUserDefaults.StandardUserDefaults.StringForKey("AccessToken"));
        }
Beispiel #2
0
        async partial void Login_Activated(UIBarButtonItem sender)
        {
            if (Login.Title == "Logout")
            {
                NSUserDefaults.StandardUserDefaults.RemoveObject("AccessToken");
                NSUserDefaults.StandardUserDefaults.RemoveObject("RefreshToken");
                NSUserDefaults.StandardUserDefaults.RemoveObject("AccessTokenExpirationDate");
                Login.Title = "Login";
                _dataSource.Objects.Clear();
                TableView.Source = _dataSource = new DataSource(this);
                TableView.ReloadData();
                return;
            }

            var gotToken = await CrmOauth.GetToken(this);

            if (!gotToken)
            {
                return;
            }

            Login.Title = "Logout";
            GetAccounts(NSUserDefaults.StandardUserDefaults.StringForKey("AccessToken"));
        }