示例#1
0
        public void LoginAsync()
        {
            if ((string.IsNullOrEmpty(_loginNickName)) || (string.IsNullOrEmpty(_loginPassword)))
                OnLoginCompleted(new List<string> { Constants.ERROR_INVALID_CREDENTIALS }, null);

            Console.WriteLine("LoginService: Attempting to login async...");
            var url = string.Format(_usersUrl, _loginNickName, _loginPassword, Constants.WEB_SERVER_URL);

            var client = new WebClientProxy();
            client.OnHttpGetCompleted += _HttpGetCompleted;
            client.HttpGetAsync(url);
        }
示例#2
0
        public void SubmitCard(Card card)
        {
            if (!AppManager.Current.ConfirmNetworkIsAvailable())
                return;

            AppManager.Current.OnNetworkUsageStarted("Tarjetas");

            Console.WriteLine("CardsService: Attempting to submit card async...");
            var url = string.Format(_cardsUrl, _loginNickName, _loginPassword, Constants.WEB_SERVER_URL);

            var client = new WebClientProxy();
            client.OnHttpPostCompleted += _HttpPostCompleted;
            client.HttpPostAsync(url, card.ToJson());
        }
        public void GetCommunityStatsAsync()
        {
            if (!AppManager.Current.ConfirmNetworkIsAvailable())
                return;

            AppManager.Current.OnNetworkUsageStarted("Estadísticas Comunidad");

            Console.WriteLine("CommunityService: Attempting to get community data async...");
            var url = string.Format(_communityUrl, _loginNickName, _loginPassword, Constants.WEB_SERVER_URL);

            var client = new WebClientProxy();
            client.OnHttpGetCompleted += _HttpGetCompleted;
            client.HttpGetAsync(url);
        }
示例#4
0
        public void GetCards()
        {
            if (!AppManager.Current.ConfirmNetworkIsAvailable())
                return;

            AppManager.Current.OnNetworkUsageStarted("Tarjetas");

            Console.WriteLine("CardsService: Attempting to get cards sync...");
            var url = string.Format(_cardsUrl, _loginNickName, _loginPassword, Constants.WEB_SERVER_URL);

            var client = new WebClientProxy();
            var result = client.HttpGet(url);

            if (!string.IsNullOrEmpty(result))
                AppManager.Current.Repository.Cards = Card.BuildListOfFromJson(result);

            AppManager.Current.OnNetworkUsageEnded();
        }