public void checkConfig()
        {
            bool configured = false;
            bool configCrashed = false;

            try
            {
                configured = CAwsConfig.Instance.isConfigured();
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "EC2 Bootstrapper", MessageBoxButton.OK,
                    MessageBoxImage.Error);
                configCrashed = true;
            }

            if(configured == true)
            {
                configurationReady();
            }
            else if (configCrashed == true)
            {
                configMenu.IsEnabled = false;
            }
            else
            {
                ProgBar.Visibility = Visibility.Hidden;

                AwsConfiguration config = new AwsConfiguration();
                config.dashboard = this;
                config.ShowDialog();
            }
        }
 public AmazonProductApi(AwsConfiguration configuration)
 {
     this._awskey = configuration.AwsKey;
     this._awsSecretKey = configuration.AwsSecretKey;
     this._destination = configuration.Destination;
     this._xmlnamespace = configuration.XmlNamespace;
     requestparameters = new Dictionary<string, string>() { { "Service", "AWSECommerceService" }, { "Version", configuration.ApiVersion }, { "AssociateTag", configuration.AssociateTag } };
 }
        public AmazonProductApiTests()
        {
            var awsconfiguration = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, xmlnamespace);
            amazonapi = new AmazonProductApi(awsconfiguration);
            productids = new string[] { "B004YLCJXC", "B006GOSIYY", "B00KHR4T8U", "B00MHIWT8O", "B00NH2VLGK" };
            retrievelfunc = (url) => Task.FromResult(XDocument.Load(@"Assets\amazon.xml"));
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\addtocart.xml"));
            funcForCreteCart = (url) => Task.FromResult(XDocument.Load(@"Assets\createcart.xml"));
            funcForGetCart = (url) => Task.FromResult(XDocument.Load(@"Assets\getcart.xml"));
            funcForItemSearch = (url) => Task.FromResult(XDocument.Load(@"Assets\ItemSearch.xml"));
            AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory);

        }
 public async void AddToCartUrlShouldContainAssociateTag()
 {
     string asin = "B00MHIWT8O";
     string offerlistingid = "GT5MOtJKMw77jOdMW4BTQj5%2B7tzBJuDfhgPgizmTlVpta1FvMD5GdoAedgwNH%2FFLrD1ZTXIliEGoE0VilYpxIUpnga3C%2BgE7ak6ILebxaKlu6Dl8Ad5%2BGNwqV8dM9uHbNqzTCj7n6C8c%2F13NocmgVdqxvviGmfNh";
     funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\cartcreate.xml"));
     var awsconfigurationforcartCreate = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, "http://webservices.amazon.com/AWSECommerceService/2011-08-01");
     var amazonapiforcartCreate = new AmazonProductApi(awsconfigurationforcartCreate);
     AmazonShoppingCart shoppingCart = await amazonapiforcartCreate.AddToCart(offerlistingid, asin, funcForAddToCart);
     Assert.Contains(associateTag, shoppingCart.PurchaseUrl);
 }
        public async void GetCartShouldNotBeEmptyOrNull()
        {
            string asin = "B00MHIWT8O";
            string offerlistingid = "GT5MOtJKMw77jOdMW4BTQj5%2B7tzBJuDfhgPgizmTlVpta1FvMD5GdoAedgwNH%2FFLrD1ZTXIliEGoE0VilYpxIUpnga3C%2BgE7ak6ILebxaKlu6Dl8Ad5%2BGNwqV8dM9uHbNqzTCj7n6C8c%2F13NocmgVdqxvviGmfNh";
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\cartcreate.xml"));
            var awsconfigurationforcartCreate = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, "http://webservices.amazon.com/AWSECommerceService/2011-08-01");
            var amazonapiforcartCreate = new AmazonProductApi(awsconfigurationforcartCreate);
            AmazonShoppingCart shoppingCart = await amazonapiforcartCreate.AddToCart(offerlistingid, asin, funcForAddToCart);

            // add multiple items..
            string secondOfferlistingId = "zd2pVJTM5AmYa6u1atwuQvHljDgDEozIAObG38viMz21SO5PNOSFB4Y4uke%2BRImUem3L2A6uciG6%2F2EjYgnufv0eZv%2BVcQ2FRL54S8LHhwitXUkG4ZFMgA%3D%3D";
            asin = "B00ZQ4JQAA";
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\addtocartmultipleitem.xml"));
            AmazonShoppingCart shoppingCartItems = await amazonapiforcartCreate.AddToCart(secondOfferlistingId, asin, shoppingCart.CartId, shoppingCart.Hmac, funcForAddToCart);

            ////get the cart details with getcart operations...
            var getCart = await amazonapi.GetCart(shoppingCart.CartId, shoppingCart.Hmac);
            Assert.Contains(associateTag, getCart.PurchaseUrl);
        }
 //view menu
 private void configureMenu_Click(object sender, RoutedEventArgs e)
 {
     AwsConfiguration config = new AwsConfiguration();
     config.dashboard = this;
     config.ShowDialog();
 }