Пример #1
0
        protected override bool CustomReloadCache()
        {
            var smqGuest = new SMQGuest(this.amqps);

            //  - smqGuest.GetProducts();

            // or load other "slow moving" data available globally.
            return(true);
        }
Пример #2
0
        public static List <BrandLicense> GetBrandLicenses(string brandPrefix)
        {
            var licenses = new List <BrandLicense>();
            var guest    = new SMQGuest(SMQGuest.C_AMQPS);
            var payload  = guest.CreatePayload();

            guest.GetBrandLicenses(payload, (reply, bdea) =>
            {
                if (reply.HasNoErrors(bdea))
                {
                    licenses = reply.BrandLicenses;
                }
            }).Wait(30000);
            return(licenses);
        }
Пример #3
0
        static void Main(string[] args)
        {
            var amqps   = "amqps://*****:*****@effortlessapi-rmq.ssot.me/ej-authorizersbysubscription";
            var guest   = new SMQGuest(amqps);
            var payload = guest.CreatePayload();

            payload.EmailAddress = "*****@*****.**";
            payload.DemoPassword = "******";
            var waiting = false;

            guest.ValidateTemporaryAccessToken(payload, (reply, bdea) =>
            {
                if (!String.IsNullOrEmpty(reply.ErrorMessage))
                {
                    throw new Exception("Invalid username/password");
                }
                var user         = new SMQSSioUser(amqps);
                user.AccessToken = reply.AccessToken;
                payload          = user.CreatePayload();

                user.GetLicenseBundles(payload, (nsReply, nsBdea) =>
                {
                    Console.WriteLine(JsonConvert.SerializeObject(nsReply.LicenseBundles, Formatting.Indented));
                    waiting = false;
                }, (error, ebdea) =>
                {
                    Console.WriteLine("ERROR: {0}", error.ErrorMessage);
                    waiting = false;
                });
            }, (error, ebdea) =>
            {
                Console.WriteLine("ERROR: {0}", error.ErrorMessage);
                waiting = false;
            });
            Task.Factory.StartNew(() =>
            {
                while (waiting)
                {
                    Thread.Sleep(10);
                }
            }).Wait();
        }
Пример #4
0
        static void Main(string[] args)
        {
            var amqps   = "amqps://*****:*****@effortlessapi-rmq.ssot.me/YOUR-PROJECT-URL";
            var guest   = new SMQGuest(amqps);
            var payload = guest.CreatePayload();

            payload.EmailAddress = "*****@*****.**";
            payload.DemoPassword = "******";
            var waiting = false;

            guest.ValidateTemporaryAccessToken(payload, (reply, bdea) =>
            {
                var admin         = new SMQAdmin(amqps);
                admin.AccessToken = reply.AccessToken;
                payload           = admin.CreatePayload();

                admin.GetTABLEXYZ(payload, (nsReply, nsBdea) =>
                {
                    Console.WriteLine(JsonConvert.SerializeObject(nsReply.TABLEXYZs, Formatting.Indented));
                    waiting = false;
                }, (error, ebdea) =>
                {
                    Console.WriteLine("ERROR: {0}", error.ErrorMessage);
                    waiting = false;
                });
            }, (error, ebdea) =>
            {
                Console.WriteLine("ERROR: {0}", error.ErrorMessage);
                waiting = false;
            });
            Task.Factory.StartNew(() =>
            {
                while (waiting)
                {
                    Thread.Sleep(10);
                }
            }).Wait();
        }
Пример #5
0
 internal bool AuthenticateUser(SMQGuest guest, Action <string, object[]> showError)
 {
     this.Guest     = guest;
     this.ShowError = showError;
     return(this.ShowDialog() == DialogResult.OK);
 }