aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml
blob: a8675f843865acbe22d47d6724c2ebf11210beba (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
<UserControl x:Class="Tango.PPC.Common.Connectivity.AvailableWiFiConnectionsControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.PPC.Common.Connectivity"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="350" d:DataContext="{d:DesignInstance Type=local:IConnectivityProvider, IsDesignTimeCreatable=False}">
    <Grid>
        <StackPanel>
            <DockPanel LastChildFill="False">
                <TextBlock DockPanel.Dock="Left" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center">Available WiFi Connections</TextBlock>
                <touch:TouchIconButton Padding="20" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="50" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding RefreshAvailableWiFiNetworksCommand}" DockPanel.Dock="Right" Icon="Refresh" Height="60" />
            </DockPanel>
            <touch:TouchNativeListBox PreventTouchDownSelect="False" Margin="0 20 0 30" Height="300" ItemsSource="{Binding AvailableWiFiNetworksViewSource}" SelectionMode="Single">
                <touch:TouchNativeListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
                                            <Setter Property="Background" Value="{StaticResource TangoMidBackgroundBrush}"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <StackPanel Orientation="Horizontal" Margin="10 15">
                                <touch:TouchIcon Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="48" Height="48">
                                    <touch:TouchIcon.Style>
                                        <Style TargetType="touch:TouchIcon">
                                            <Setter Property="Icon" Value="WifiStrengthOff"></Setter>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding SignalStrength,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter='0'}" Value="True">
                                                    <Setter Property="Icon" Value="WifiStrength1"></Setter>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding SignalStrength,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter='20'}" Value="True">
                                                    <Setter Property="Icon" Value="WifiStrength2"></Setter>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding SignalStrength,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter='50'}" Value="True">
                                                    <Setter Property="Icon" Value="WifiStrength3"></Setter>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding SignalStrength,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter='80'}" Value="True">
                                                    <Setter Property="Icon" Value="WifiStrength4"></Setter>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </touch:TouchIcon.Style>
                                </touch:TouchIcon>

                                <StackPanel Margin="20 0 0 0" VerticalAlignment="Center">
                                    <TextBlock VerticalAlignment="Center" Text="{Binding Name,Mode=OneWay}"></TextBlock>

                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Foreground="{StaticResource TangoPrimaryAccentBrush}" FontWeight="Normal" Text="Connected, " Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
                                        <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" FontWeight="Normal" Text="Secure" Visibility="{Binding IsSecure,Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
                                        <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" FontWeight="Normal" Text="Open" Visibility="{Binding IsSecure,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBlock>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>

                            <Grid Margin="20" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}">
                                <Grid Height="80">
                                    <touch:TouchCheckBox VerticalAlignment="Top" Margin="60 0 0 0" IsChecked="{Binding AutoConnect}" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect automatically</touch:TouchCheckBox>
                                    <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ConnectToWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect</touch:TouchButton>
                                    <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisconnectFromWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="45" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}">Disconnect</touch:TouchButton>
                                </Grid>

                                <Grid Visibility="{Binding Connecting,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoMidBackgroundBrush}">
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="60 0 0 0" VerticalAlignment="Center">
                                        <touch:TouchBusyIndicator IsIndeterminate="{Binding Connecting}" Width="50" Height="50" />
                                        <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Connecting...</TextBlock>
                                    </StackPanel>
                                </Grid>

                                <Grid Visibility="{Binding Disconnecting,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoMidBackgroundBrush}">
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="60 0 0 0" VerticalAlignment="Center">
                                        <touch:TouchBusyIndicator IsIndeterminate="{Binding Disconnecting}" Width="50" Height="50" />
                                        <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Disconnecting...</TextBlock>
                                    </StackPanel>
                                </Grid>
                            </Grid>
                        </StackPanel>
                    </DataTemplate>
                </touch:TouchNativeListBox.ItemTemplate>
            </touch:TouchNativeListBox>
        </StackPanel>
    </Grid>
</UserControl>