You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
2.6 KiB

1 year ago
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
1 year ago
xmlns:cvt="clr-namespace:WeatherClient.Converters"
xmlns:vm="clr-namespace:WeatherClient.ViewModels"
1 year ago
x:Class="WeatherClient.MainPage">
<ContentPage.BindingContext>
<vm:WeatherViewModel/>
</ContentPage.BindingContext>
1 year ago
<ContentPage.Resources>
<cvt:WeatherConditionToImageConverter x:Key="WeatherToImage"/>
</ContentPage.Resources>
1 year ago
<Grid RowDefinitions="Auto,Auto,*,Auto" Margin="5">
<VerticalStackLayout>
<Label Text="Welcome to the weather app! Press the 'Refresh' button to get the latest forecast. Remember to provide an address for the forecast!" />
<Rectangle BackgroundColor="Black" HeightRequest="4" Margin="2,10" />
<HorizontalStackLayout>
<Label Text="Postal Code:" VerticalOptions="Center" Margin="0,0,20,0" />
<Entry x:Name="txtPostalCode" WidthRequest="100" Margin="0,0,20,0" />
<Button x:Name="btnRefresh" Text="Refresh" Grid.Row="3" Clicked="btnRefresh_Clicked" />
<ActivityIndicator x:Name="actIsBusy" Margin="5,0,0,0" />
</HorizontalStackLayout>
<Rectangle BackgroundColor="Black" HeightRequest="4" Margin="2,10" />
<Grid Grid.Row="2" RowDefinitions="Auto, Auto, Auto, Auto, Auto" ColumnDefinitions="Auto, Auto" Margin="0,5,0,0">
<Label Grid.Row="0" Grid.Column="0" Text="Condition" VerticalOptions="Center" />
<Image Grid.Row="0" Grid.Column="1" HeightRequest="25" WidthRequest="25" Source="{Binding WeatherData.Condition, Converter={StaticResource WeatherToImage}}" HorizontalOptions="Start" />
1 year ago
<Label Grid.Row="1" Grid.Column="0" Text="Temperature" Margin="0,0,20,0" />
<Label Grid.Row="1" Grid.Column="1" Text="{Binding WeatherData.Condition}" />
1 year ago
<Label Grid.Row="2" Grid.Column="0" Text="Humidity" Margin="0,0,20,0" />
<Label Grid.Row="2" Grid.Column="1" Text="{Binding WeatherData.Humidity}" />
1 year ago
<Label Grid.Row="3" Grid.Column="0" Text="Precipitation" Margin="0,0,20,0" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding WeatherData.Humidity}" />
1 year ago
<Label Grid.Row="4" Grid.Column="0" Text="Wind" Margin="0,0,20,0" />
<Label Grid.Row="4" Grid.Column="1" Text="{Binding WeatherData.Wind}" />
1 year ago
</Grid>
</VerticalStackLayout>
</Grid>
</ContentPage>