📄
src/App/Views/Panels/WeatherPanel.axaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:MMirror.App.ViewModels.Panels"
xmlns:v="using:MMirror.App.Views.Panels"
mc:Ignorable="d"
d:DesignWidth="720"
d:DesignHeight="1280"
x:Class="MMirror.App.Views.Panels.WeatherPanel"
x:DataType="vm:WeatherPanelViewModel">
<Design.DataContext>
<vm:WeatherPanelViewModel/>
</Design.DataContext>
<UserControl.Resources>
<x:Double x:Key="spacing">4</x:Double>
<v:WeatherSymbolIconConverter x:Key="weatherSymbolIconConverter" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="Grid.period">
<Setter Property="RowSpacing" Value="{StaticResource spacing}" />
<Setter Property="ColumnSpacing" Value="{StaticResource spacing}" />
</Style>
<Style Selector="TextBlock.number">
<Setter Property="FontFeatures" Value="+tnum" />
</Style>
<Style Selector="Svg">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="CurrentColor" Value="#ffffff" />
</Style>
</UserControl.Styles>
<StackPanel Spacing="16">
<TextBlock Classes="h1 label" Text="{Binding LocationName}" />
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,*"
HorizontalAlignment="Center"
RowSpacing="{StaticResource spacing}" ColumnSpacing="{StaticResource spacing}"
IsVisible="{Binding Forecast, Converter={x:Static ObjectConverters.IsNotNull}}">
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Classes="period" ColumnDefinitions="Auto,*"
HorizontalAlignment="Center">
<Svg Path="{Binding Forecast.Now.Forecast.Symbol, Converter={StaticResource weatherSymbolIconConverter}}"
Width="128" Height="128" Grid.Column="0" />
<StackPanel Grid.Column="1" Spacing="{StaticResource spacing}" VerticalAlignment="Center">
<Grid ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto" ColumnSpacing="{StaticResource spacing}">
<TextBlock Classes="h1 number" Grid.Row="0" Grid.Column="0" Text="{Binding Forecast.Now.Forecast.TemperatureCelsius, StringFormat={}{0:0} °C}" TextAlignment="End" />
<TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Bottom">Ute</TextBlock>
<TextBlock Classes="h2 number" Grid.Row="1" Grid.Column="0" Text="{Binding Forecast.Now.Forecast.InsideTemperatureCelsius, StringFormat={}{0:0} °C}" TextAlignment="End" />
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom">Inne</TextBlock>
</Grid>
<TextBlock Classes="h2 number" Text="{Binding Forecast.Now.Forecast.PrecipitationMillimeters, StringFormat={}{0:0.0} mm}" />
<TextBlock Classes="label" Text="Nu" />
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Classes="period" ColumnDefinitions="Auto,*">
<Svg Path="{Binding Forecast.Next.Forecast.Symbol, Converter={StaticResource weatherSymbolIconConverter}}"
Width="64" Height="64" Grid.Column="0" />
<StackPanel Grid.Column="1" Spacing="{StaticResource spacing}" VerticalAlignment="Bottom">
<TextBlock Classes="h3 number" Text="{Binding Forecast.Next.Forecast.TemperatureCelsius, StringFormat={}{0:0} °C}" />
<TextBlock Classes="number" Text="{Binding Forecast.Next.Forecast.PrecipitationMillimeters, StringFormat={}{0:0.0} mm}" />
<TextBlock Classes="label" Text="{Binding Forecast.Next.PeriodName}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" Classes="period" ColumnDefinitions="Auto,*">
<Svg Path="{Binding Forecast.Following.Forecast.Symbol, Converter={StaticResource weatherSymbolIconConverter}}"
Width="64" Height="64" Grid.Column="0" />
<StackPanel Grid.Column="1" Spacing="{StaticResource spacing}" VerticalAlignment="Bottom">
<TextBlock Classes="h3 number" Text="{Binding Forecast.Following.Forecast.TemperatureCelsius, StringFormat={}{0:0} °C}" />
<TextBlock Classes="number" Text="{Binding Forecast.Following.Forecast.PrecipitationMillimeters, StringFormat={}{0:0.0} mm}" />
<TextBlock Classes="label" Text="{Binding Forecast.Following.PeriodName}" />
</StackPanel>
</Grid>
</Grid>
</StackPanel>
</UserControl>