private async void GoButton_Click(object sender, RoutedEventArgs e)
{
WeatherSoapClient proxy = new WeatherSoapClient();
WeatherReturn result = await proxy.GetCityWeatherByZIPAsync(inputZipCode.Text);
ForecastReturn fr = await proxy.GetCityForecastByZIPAsync(inputZipCode.Text);
Forecast[] f = fr.ForecastResult;
if (result.Success)
{
resultCityState.Text = String.Format("{0}, {1}", result.City, result.State);
resultDetails.Text = String.Format("\n conditions-{0}\n temperature-{1} ");
}
GetWeatherInformationResponse result1 = await proxy.GetWeatherInformationAsync();
WeatherDescription[] r = result1.GetWeatherInformationResult;
foreach (WeatherDescription d in r)
if (d.WeatherID == result.WeatherID)
{
image i = new image();
i.imageurl = d.PictureURL;
myimage.DataContext = i;
break;
}
}
}
public class image
{
public string imageurl
{
get;
set;
}
}
xaml file
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="#FFD81337" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>
<StackPanel Orientation="Horizontal">
<TextBlock HorizontalAlignment="Left" Height="68" TextWrapping="Wrap" Text="Use of Whether Web Service" VerticalAlignment="Top" Width="1306" FontFamily="Verdana"
FontSize="48" Margin="38,20,0,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Name="inputZipCode" HorizontalAlignment="Left" Height="58" Margin="10,127,0,0" VerticalAlignment="Top" Width="477" FontFamily="Verdana"
FontSize="36"/>
<Button Name="GoButton" Content="Go" HorizontalAlignment="Left" Height="58" Margin="40,127,0,0" VerticalAlignment="Top" Width="136" FontFamily="Verdana"
FontSize="36" Click="GoButton_Click"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock HorizontalAlignment="Left" Height="27" Margin="38,90,0,0" TextWrapping="Wrap" Text="Enter the zip code below (U.S. only, e.g. 48653)" VerticalAlignment="Top"
Width="494" FontFamily="Verdana" FontSize="20"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Image Name="myimage" HorizontalAlignment="Left" Height="200" Margin="10,190,0,0" VerticalAlignment="Top" Width="737" Source="{Binding imageurl}"/>
</StackPanel>
<StackPanel>
<TextBlock x:Name="resultCityState" Height="100" HorizontalAlignment="Left" TextWrapping="Wrap" FontFamily="Verdana" Width="300" FontSize="36"
Margin="15,400,0,0" />
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock x:Name="resultDetails" HorizontalAlignment="Left" Height="365" Margin="30,400,0,-39" TextWrapping="Wrap" VerticalAlignment="Top" Width="704"
FontFamily="Verdana" FontSize="25"/>
</StackPanel>
</Grid>
i will be getting the error
The remote server returned an unexpected response: (407) Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. ).
amair