Example #1
0
    public RGSender(RGTracker.MainPage mainPage)
    {
        this.runnerName    = (String)IsolatedStorageSettings.ApplicationSettings["RunnerName"];
        this.runnerId      = (int)IsolatedStorageSettings.ApplicationSettings["RunnerID"];
        this.serverAddress = (String)IsolatedStorageSettings.ApplicationSettings["ServerAddress"];
        this.password      = (String)IsolatedStorageSettings.ApplicationSettings["Password"];

        this.mainPage = mainPage;

        // Initialize send timer
        sendTimer          = new DispatcherTimer();
        sendTimer.Tick    += new EventHandler(DoSend);
        sendTimer.Interval = new TimeSpan(0, 0, SEND_INTERVAL_SECONDS);
        sendTimer.Start();

        // Initialize send timeout timer. This checks if send takes too long and cancels request.
        sendTimeout          = new DispatcherTimer();
        sendTimeout.Tick    += SendTimeout;
        sendTimeout.Interval = new TimeSpan(0, 0, SEND_TIMEOUT_SECONDS);

        // We send points using WebClient
        webClient = new WebClient();
        webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(RequestCompleted);
    }
Example #2
0
    public RGSender(RGTracker.MainPage mainPage)
    {
        this.runnerName = (String)IsolatedStorageSettings.ApplicationSettings["RunnerName"];
        this.runnerId = (int)IsolatedStorageSettings.ApplicationSettings["RunnerID"];
        this.serverAddress = (String)IsolatedStorageSettings.ApplicationSettings["ServerAddress"];
        this.password = (String)IsolatedStorageSettings.ApplicationSettings["Password"];

        this.mainPage = mainPage;

        // Initialize send timer
        sendTimer = new DispatcherTimer();
        sendTimer.Tick += new EventHandler(DoSend);
        sendTimer.Interval = new TimeSpan(0, 0, SEND_INTERVAL_SECONDS);
        sendTimer.Start();

        // Initialize send timeout timer. This checks if send takes too long and cancels request.
        sendTimeout = new DispatcherTimer();
        sendTimeout.Tick += SendTimeout;
        sendTimeout.Interval = new TimeSpan(0, 0, SEND_TIMEOUT_SECONDS);

        // We send points using WebClient
        webClient = new WebClient();
        webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(RequestCompleted);
    }