Esempio n. 1
0
        public void DebugAlerts()
        {
            if (this.Context.Accounts.Count == 0)
            {
                return;
            }

            Account account     = this.Context.Accounts[0];
            string  sessionData = account.SessionData;

            IJsonWebRequest jsonService = new JsonServiceStub(
                Test.StartJson
                + Test.FeedbackReceivedJson + ","
                + Test.AskSellerQuestion + ","
                + Test.AskSellerQuestion2 + ","
                + Test.FixedPriceTransactionJson
                + Test.EndJson);

            ItGoesChaChing.Ebay.ILogger logger = this.Logger as ItGoesChaChing.Ebay.ILogger;

            GetUserAlertsCall alertsCall = new GetUserAlertsCall(logger, jsonService);

            GetUserAlertsJob job = new GetUserAlertsJob(this.Logger, alertsCall);

            List <AlertBase> alerts = job.GetUserAlerts(account);

            alerts[0].Timestamp = System.DateTime.Now.AddSeconds(1);
            alerts[1].Timestamp = System.DateTime.Now.AddSeconds(4);
            alerts[2].Timestamp = System.DateTime.Now.AddSeconds(8);
            alerts[3].Timestamp = System.DateTime.Now.AddSeconds(12);

            QueueAlerts(alerts);

            account.SessionData = sessionData;
        }
Esempio n. 2
0
        private void GetUserAlerts(Account account)
        {
            try
            {
                if (!account.IsConnected())
                {
                    LoginAlert alert = null;
                    App.Current.Dispatcher.Invoke((Action) delegate
                    {
                        alert = new LoginAlert(account.UserId, "", account.AccountUrl);
                        OnAlertRaised(alert);
                    });
                    Task <LoginAlert> .Factory.StartNew(() => LoginAccount(account, alert));

                    return;
                }

                // GetUserAlerts
                GetUserAlertsJob job    = new GetUserAlertsJob();
                List <AlertBase> alerts = job.GetUserAlerts(account);

                QueueAlerts(alerts);
            }
            catch (Exception ex)
            {
                // Log the exception... We could optionally display the exception the the user's
                this.Logger.Log(LogLevel.Error, "Exception:", ex);
            }
        }