Ejemplo n.º 1
0
        private PostSignIn.Result SignInRemotely(string userName, string password, CancellationToken cancellationToken)
        {
            // If there is no network, we won't
            // even bother trying.
            if (false == NetworkStatus.IsReachable())
            {
                return(null);
            }

            var postSignIn = new PostSignIn().ExecuteAsync(userName, password, cancellationToken);

            // Let's wait for the synchronization
            // to complete, but within a timeout.
            var completed = postSignIn
                            .Wait(_timeout);

            // If the task did not complete, we'll
            // report the network is unreachable.
            if (false == completed)
            {
                return(null);
            }

            return(postSignIn.Result);
        }
Ejemplo n.º 2
0
        // ReSharper disable once UnusedMember.Local
        // ReSharper disable once UnusedParameter.Local
        async partial void Synchronize(NSObject sender)
        {
            if (false == NetworkStatus.IsReachable())
            {
                Alert.Show("No Connectivity", "Our server seems to be unreachable. Did you check your internet access?");
                return;
            }

            try {
                await SynchronizeAsync();
            } catch (Exception e) {
                //TODO: show user-friendly message.
                Alert.Show("Synchronization Failed", e.ToString());
            }
        }