Exemplo n.º 1
0
        // Implement a call with the right signature for events going off
        private static void myEvent(object source, ElapsedEventArgs e)
        {
            ++filecounter;
            Console.WriteLine("getting data with id =" + currentId);
            var content = WebRequester.GET(POEStashURL + "/?id=" + currentId);

            FileCreator.CreateFileAndWriteContent("file" + filecounter + ".txt", content);

            dynamic response = JsonConvert.DeserializeObject(content);

            currentId = response.next_change_id;
            AddInfoFromJSON(response.stashes);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // Initial request
            var content = WebRequester.GET(POEStashURL);

            FileCreator.CreateFileAndWriteContent("file" + filecounter + ".txt", content);

            dynamic response = JsonConvert.DeserializeObject(content);

            currentId = response.next_change_id;
            AddInfoFromJSON(response.stashes);

            // Timer
            var myTimer = new System.Timers.Timer();

            myTimer.Elapsed += new ElapsedEventHandler(myEvent);
            myTimer.Interval = 2000;
            myTimer.Enabled  = true;

            // Console so app doesn't close
            Console.WriteLine("Press the Enter key to exit the program.");
            Console.ReadLine();
        }