It takes 5 minutes to beat cream into butter, write half of your name in Elvish, or create a homemade tattoo gun.Â Or if
you want to get really wild, you could spend your next 5 minutes
creating a Windows application to get real-time precious metal
quotes.Â If that's a little too wild for you, you could
also live vicariously through us by watching
a video of us doing it.Â But if you're ready to throw
caution to the wind and give it a try for yourself, here's how:
Step 1: Start a new Windows application project in Visual Studio using VB.NET as the language.Â (You can use any language, but this example just happens to use VB.NET.)
Step 2: Create a web reference to http://www.xignite.com/xMetals.asmx?WSDL and call it XigniteMetals.
Step 3: On the Form1 design, drag and drop 2 text boxes, 3 labels, and a button, arranging them as shown in the picture.Â Give the left-most text box a name of tbMetal and default text of XAU.Â Give the right-most text box a name of tbCurrency and a default text of USD.Â From left to right, the labels should be given the following names and default text values:Â lIntro defaults to "Right now ", lCosts defaults to " costs ", Â PriceLabel defaults to "0.00."Â The button should have a default text value of "Get Quote."
Step 4: Double-click the button to create its click event handler.Â Then add the following lines of code inside the event handler:
Dim xHeader As New XigniteMetals.Header()
xHeader.Username = "MYAUTHENTICATIONKEY"
Dim XigniteMetalsWebService As New XigniteMetals.XigniteMetals()
XigniteMetalsWebService.HeaderValue = xHeader
Dim Quote As XigniteMetals.MetalQuote = _
DirectCast([Enum].Parse(GetType(XigniteMetals.MetalTypes), tbMetal.Text), XigniteMetals.MetalTypes), _
DirectCast([Enum].Parse(GetType(XigniteMetals.MetalCurrencyTypes), tbCurrency.Text), XigniteMetals.MetalCurrencyTypes))
PriceLabel.Text = Quote.Rate.ToString("#,###.00″)
Step 5: Replace "MYAUTHENTICATIONKEY" in the second line of code with your Xignite authentication key.Â Don't have one?Â Just sign up for a free trial and use your e-mail address as your initial authentication key.
Step 6: Compile and run.
Congratulations! You might make a lousy tattooed elf chef, but you'll be the life of the party with precious metal traders.