Esempio n. 1
0
        public string getCredits()
        {
            if (creditsInit)
            {
                //Log in to myVMK (if have not already) and load index.
                string getUrl = serverUrl + "security_check.php";

                CookieAwareWebClient client = new CookieAwareWebClient(cookie);

                client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCallback);

                //Get credits
                client.DownloadStringAsync(new Uri(getUrl));
                return(this.credits);
            }
            else
            {
                return("err");
            }
        }
Esempio n. 2
0
 public void ExecuteJob(CookieAwareWebClient cawc, string address)
 {
     cawc.DownloadStringAsync(new Uri(NetworkAddresses.ObtainExhibitsListAddress(), UriKind.Absolute));
 }
Esempio n. 3
0
 public void ExecuteJob(CookieAwareWebClient cawc, string address)
 {
     //MessageBox.Show(NetworkAddresses.ObtainItemInfoAddress(itemQR));
       cawc.DownloadStringAsync(new Uri(NetworkAddresses.ObtainItemInfoAddress(itemQR), UriKind.Absolute));
 }
        public void downloadJsonPet()
        {
            randomPet = new CookieAwareWebClient(); //creates a WebClient with cookie support

            Uri URL = new Uri("http://" + Urls.getUrl + Urls.getApiRandom); //Builds the url to server
            randomPet.DownloadStringCompleted += new DownloadStringCompletedEventHandler(processJsonPet); //adds new event

            try
            {
                randomPet.DownloadStringAsync(URL); //Download randomPetJson asynchronously

            }
            catch (Exception e)
            {
                error_encountered = true;
                System.Diagnostics.Debug.WriteLine("An exception occured while downloading /api/random Json !" + e.Message);
                lock (_locker)
                {
                    _go = true;
                    Monitor.Pulse(_locker); //Notify that download is finished so we can start parsing
                }
                throw new Exception("dl_json_pet_exception");
            }
        }
        //Downloads Json with next pet
        public void downloadNextJsonPet()
        {
            nextPet = new CookieAwareWebClient(Urls.getCookie); //Creates a new webClient with the saved cookie

            Uri URL = new Uri("http://" + Urls.getUrl + Urls.getApiNext);   //creates url to /api/next
            nextPet.DownloadStringCompleted += new DownloadStringCompletedEventHandler(processJsonPet);
            try
            {
                nextPet.DownloadStringAsync(URL);
            }
            catch (Exception)
            {
                error_encountered = true;
                System.Diagnostics.Debug.WriteLine("An exception occured while downloading /api/next Json !");
                lock (_locker)
                {
                    _go = true;
                    Monitor.Pulse(_locker); //Notify that download is finished so we can start parsing
                }
                throw new Exception("dl_next_json_pet_exception");
            }
        }
        public void downloadJsonPetDetails()
        {
            CookieAwareWebClient petDetails = new CookieAwareWebClient(Urls.getCookie); //Creates a new webclient with saved cookie session

            Uri URL = new Uri("http://" + Urls.getUrl + Urls.getApiDetails); //builds url

            petDetails.DownloadStringCompleted += processJsonPetDetails;
            try
            {
                petDetails.DownloadStringAsync(URL);
            }
            catch (Exception)
            {
                error_encountered = true;
                System.Diagnostics.Debug.WriteLine("An exception occured while downloading /api/details Json !");
                lock (_locker)
                {
                    _go = true;
                    Monitor.Pulse(_locker); //Notify that download is finished so we can start parsing
                }
                throw new Exception("dl_json_pet_details_exception");
            }
        }