Ejemplo n.º 1
0
        private static void Main()
        {
            var city = SelectCity();

            var storage   = new NativeStorageProvider();
            var authToken = storage.AuthToken;

            if (string.IsNullOrEmpty(authToken))
            {
                var credentialsProvider = new ConsoleCredentialsProvider();
                var loginRequest        = new LoginRequest(credentialsProvider.Login, credentialsProvider.Password);
                var response            = ImaxApi.Login(loginRequest).Result;
                if (response.Succeeded)
                {
                    authToken = storage.AuthToken = response.Token;
                }
                else
                {
                    return;
                }
            }

            var profileRequest  = new ProfileRequest(authToken);
            var profileResponse = ImaxApi.Profile(profileRequest).Result;

            var registerRequest  = new RegisterRequest(new CustomerName("Vasya", null, "Pupkin"), Gender.Male, new DateTime(2012, 12, 21), PhoneNumber.Parse("+380123456789"), "*****@*****.**", "qwerty");
            var registerResponse = ImaxApi.Register(registerRequest).Result;
        }
Ejemplo n.º 2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                var authToken       = (string)ApplicationData.Current.LocalSettings.Values["AuthToken"];
                var profileRequest  = new ProfileRequest(authToken);
                var profileResponse = await ImaxApi.Profile(profileRequest);

                CustomerNameBlock.Text = profileResponse.CustomerName.FullName;
                CustomerIdBlock.Text   = profileResponse.UserId;
                CardNumberBlock.Text   = Ean13Generator.GenerateBarCode(profileResponse.CustomerCard);
                BonusesBlock.Text      = profileResponse.Bonuses;
            }
        }