Beispiel #1
0
        private void checkVersion()
        {
            Webservices.TrayApplication ws;
            string  minVersionString;
            Version minVersion;

            ws = new Webservices.TrayApplication();
            minVersionString = ws.GetMinimumClientVersion();
            minVersion       = new Version(minVersionString);

            if (minVersion.CompareTo(new Version(Application.ProductVersion)) > 0)
            {
                MainApplicationContext.ShowMessageBox("The version of the RankTrend.com tray application that you are using is out of date, and must be upgraded, you will now be taken to the upgrade page.");
                System.Diagnostics.Process.Start("http://www.RankTrend.com/Members/Tray-Application/");
                Application.ExitThread();
            }
        }
        public void ExecutePendingJobs()
        {
            Webservices.TrayApplication ws;
            string requestKey;
            SerializableWebRequest  currentRequest;
            HttpWebResponse         httpResponse;
            SerializableWebResponse response;
            Random generator = new Random();

            ws     = new Webservices.TrayApplication();
            ws.Url = "http://www.RankTrend.com/Webservices/TrayApplication.asmx";
            //ws.Url = "http://localhost:4933/Rt.Website/Webservices/TrayApplication.asmx";

            for (requestKey = ws.QueueNextDatasource(_guidString);
                 requestKey != null;
                 requestKey = ws.QueueNextDatasource(_guidString))
            {
                _log.DebugFormat("A request was queued as key '{0}'", requestKey);

                _cookies = new CookieContainer();

                for (currentRequest = ws.GetDatasourceRequest(requestKey);
                     currentRequest != null;
                     currentRequest = ws.GetDatasourceRequest(requestKey))
                {
                    _log.DebugFormat("Executing a request for request key '{0}'", requestKey);

                    httpResponse = ProcessRequest(currentRequest);
                    response     = WrapHttpResponse(httpResponse);

                    _log.InfoFormat("Saving the response for request key '{0}'", requestKey);
                    ws.SaveDatasourceResponse(response, requestKey);
                }

                // Random delay between 30 seconds and 3 minutes
                int delay = generator.Next(2 * 60 * 1000 + 30000) + 30000;                              // Random number 0:00 - 2:30
                _log.DebugFormat("Waiting {0}ms before getting next pending datasource task.", delay);
                Thread.Sleep(delay);
            }
        }
Beispiel #3
0
        private bool changeCredentials()
        {
            Webservices.TrayApplication ws;
            Guid   guid;
            string guidString;

            if (txtPassword.Text == BLANK_PASSWORD)
            {
                MainApplicationContext.ShowMessageBox("If you change your user name, you need to re-enter your password. Your user name has not been changed.");
                return(false);
            }

            //The username or password has changed, so we need to get a new GUID
            ws = new Webservices.TrayApplication();

            Cursor = Cursors.WaitCursor;
            try
            {
                guidString = ws.Authenticate(txtUsername.Text, txtPassword.Text);
            }
            finally
            {
                Cursor = Cursors.Default;
            }

            if (guidString == null)
            {
                MainApplicationContext.ShowMessageBox("The user name and password you entered are not correct.");
                return(false);
            }

            guid = new Guid(guidString);

            Settings.UserName = txtUsername.Text;
            Settings.UserGuid = guid;

            return(true);
        }