blob: 3876183179bbfa2b91eda7d35541d1db2320b57f [file] [log] [blame]
<!-- **********************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas<nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas<andreas.traczyk@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/> . *
*********************************************************************** -->
<Page x:Class="RingClientUWP.Views.SmartPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RingClientUWP"
xmlns:controls="using:RingClientUWP.Controls"
xmlns:views="using:RingClientUWP.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<!-- converters -->
<views:NewMessageBubleNotification x:Key="_NewMessageBubleNotification_" />
<views:IncomingVisibility x:Key="_IncomingVisibility_" />
<views:OutGoingVisibility x:Key="_OutGoingVisibility_" />
<views:HasAnActiveCall x:Key="_HasAnActiveCall_" />
<Style x:Key="addContactTextBoxStyle"
TargetType="TextBox">
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}"/>
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="white"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
<Setter Property="Padding" Value="4,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid>
<Grid.Resources>
<Style x:Name="DeleteButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid"
BorderThickness="5"
Background="Yellow">
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border x:Name="BackgroundElement"
Grid.Row="1"
Background="{TemplateBinding Background}"
Margin="5"
Opacity="1"
Grid.ColumnSpan="2"
Grid.RowSpan="1"/>
<ScrollViewer x:Name="ContentElement"
Grid.Row="1"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Margin="5"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
ZoomMode="Disabled"/>
<Button x:Name="DeleteButton"
Background="Transparent"
Grid.Row="1"
FontFamily="Segoe MDL2 Assets"
Foreground="LightBlue"
Content="&#xE1E2;"
Click="_ringTxtBx__Click"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{ThemeResource HelperButtonThemePadding}"
IsTabStop="False"
Grid.Column="1"
Visibility="Visible"
FontSize="20"
MinWidth="34"
VerticalAlignment="Stretch"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- template for contacts. -->
<DataTemplate x:Key="ContactTemplate"
x:DataType="local:Contact">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="310"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<!-- use the height of _contactBar_ to make it visible or collapsed. -->
<RowDefinition x:Name="_contactBar_"
Height="{x:Bind _contactBarHeight, Mode=OneWay}"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"
MinWidth="200"/>
</Grid.ColumnDefinitions>
<Image x:Name="_contactAvatar_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="0"
Width="55"
Height="55"
Source="Assets\TESTS\contactAvatar.png"/>
<!-- visual notifications. -->
<Border x:Name="_visualNotificationVideoChat_"
Visibility="Collapsed"
Style="{StaticResource BorderStyle1}">
<TextBlock Text="&#xE8AA;"
Style="{StaticResource TextSegoeStyle1}"/>
<Border.RenderTransform>
<TranslateTransform X="17" Y="-14"/>
</Border.RenderTransform>
</Border>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<!-- name of the contact. -->
<TextBlock x:Name="_contactName_"
Grid.Row="0"
Text="{x:Bind name_}"
TextTrimming="CharacterEllipsis">
</TextBlock>
</Grid>
</Grid>
</Grid>
</DataTemplate>
<!-- template for accounts. -->
<DataTemplate x:Key="AccountTemplate"
x:DataType="local:Account">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="260"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock x:Name="_accountName_"
Grid.Column="0"
Grid.Row="0"
Margin="10,5,10,0"
Text="{x:Bind name_}"/>
<TextBlock x:Name="_accountType_"
Grid.Column="1"
Grid.Row="0"
TextAlignment="Right"
Margin="0,5,18,0"
Foreground="ForestGreen"
Text="{x:Bind accountType_}"/>
<TextBlock x:Name="_ringID_"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="1"
Foreground="Crimson"
Margin="10,5,10,0"
FontSize="14"
TextTrimming="CharacterEllipsis"
Text="{x:Bind ringID_}"/>
</Grid>
</DataTemplate>
<!-- template for incoming calls. -->
<DataTemplate x:Key="IncomingCallTemplate" x:DataType="local:Call">
<Grid Width="320"
HorizontalAlignment="Left"
Background="DarkGray">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock x:Name="_contactCallStatus_"
Grid.Row="0"
Foreground="White"
Text="{x:Bind state, Mode=OneWay}"
Visibility="Visible"
HorizontalAlignment="Center">
</TextBlock>
<StackPanel Orientation="Horizontal"
Grid.Row="1"
HorizontalAlignment="Center">
<Button x:Name="_acceptIncomingCallBtn_"
Click="_acceptIncomingCallBtn__Click"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Accept"/>
<Button x:Name="_rejectIncomingCallBtn_"
Click="_rejectIncomingCallBtn__Click"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Reject"/>
</StackPanel>
</Grid>
</DataTemplate>
<!-- template for outgoing calls. -->
<DataTemplate x:Key="OutGoingCallTemplate" x:DataType="local:Call">
<Grid Width="320"
HorizontalAlignment="Left"
Background="DarkGray">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock x:Name="_contactCallStatus_"
Grid.Row="0"
Foreground="White"
Text="{x:Bind state, Mode=OneWay}"
Visibility="Visible"
HorizontalAlignment="Center">
</TextBlock>
<StackPanel Orientation="Horizontal"
Grid.Row="1"
HorizontalAlignment="Center">
<Button x:Name="_cancelCallBtn_"
Click="_cancelCallBtn__Click"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Cancel"/>
</StackPanel>
</Grid>
</DataTemplate>
<!-- template for smartpanelitems. -->
<DataTemplate x:Key="SmartPanelItemsTemplate"
x:DataType="controls:SmartPanelItem">
<Grid PointerEntered="Grid_PointerEntered" PointerExited="Grid_PointerExited">
<Grid.RowDefinitions>
<!-- row definition for the contact. -->
<RowDefinition Height="auto"/>
<!-- row definition for the incoming call bar. -->
<RowDefinition Height="auto"/>
<!-- row definition for the outgoing call bar. -->
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--helper to detect mouse overing-->
<Rectangle Fill="Transparent" Grid.Row="0"/>
<!-- contact. -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="310"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<!-- use the height of _contactBar_ to make it visible or collapsed. -->
<RowDefinition x:Name="_contactBar_"
Height="{x:Bind _contact._contactBarHeight, Mode=OneWay}"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"
MinWidth="200"/>
</Grid.ColumnDefinitions>
<Image x:Name="_contactAvatar_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="0"
Width="55"
Height="55"
Source="Assets\TESTS\contactAvatar.png"/>
<!-- visual notifications. -->
<Border x:Name="_visualNotificationVideoChat_"
Visibility="Collapsed"
Style="{StaticResource BorderStyle1}">
<TextBlock Text="&#xE8AA;"
Style="{StaticResource TextSegoeStyle1}"/>
<Border.RenderTransform>
<TranslateTransform X="17" Y="-14"/>
</Border.RenderTransform>
</Border>
<Border x:Name="_visualNotificationNewMessage_"
Visibility="{x:Bind _contact._unreadMessages, Converter={StaticResource _NewMessageBubleNotification_}, Mode=OneWay}"
Style="{StaticResource BorderStyle2}">
<TextBlock Text="{x:Bind _contact._unreadMessages, Mode=OneWay}"
Style="{StaticResource TextStyle3}"/>
<Border.RenderTransform>
<TranslateTransform X="-17" Y="-14"/>
</Border.RenderTransform>
</Border>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<!-- name of the contact. -->
<TextBlock x:Name="_contactName_"
Grid.Row="0"
Text="{x:Bind _contact.name_}"
TextTrimming="CharacterEllipsis">
</TextBlock>
<!-- call button. -->
<Button Grid.Row="0"
Visibility="{x:Bind _hovered, Mode=OneWay}"
Click="_callContact__Click"
VerticalAlignment="Bottom"
HorizontalAlignment="Left"
Margin="10,0"
Style="{StaticResource roundButtonTemplate}"
FontFamily="Segoe MDL2 Assets"
Content="&#xE116;">
<Button.RenderTransform>
<TranslateTransform X="90" Y="25"/>
</Button.RenderTransform>
</Button>
</Grid>
</Grid>
</Grid>
<!-- incomming call bar. -->
<Grid Width="320"
Grid.Row="1"
HorizontalAlignment="Left"
Background="DarkGray">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="_incommingCallStatus_"
Grid.Row="0"
Foreground="White"
Text="{x:Bind _call.state, Mode=OneWay}"
Visibility="{x:Bind _call.state, Converter={StaticResource _HasAnActiveCall_}, Mode=OneWay}"
HorizontalAlignment="Center">
</TextBlock>
<StackPanel Orientation="Horizontal"
Visibility="Visible"
Grid.Row="1"
HorizontalAlignment="Center">
<Button x:Name="_acceptIncomingCallBtn_"
Click="_acceptIncomingCallBtn__Click"
Visibility="{x:Bind _call.state, Converter={StaticResource _IncomingVisibility_}, Mode=OneWay}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Accept"/>
<Button x:Name="_rejectIncomingCallBtn_"
Click="_rejectIncomingCallBtn__Click"
Visibility="{x:Bind _call.state, Converter={StaticResource _IncomingVisibility_}, Mode=OneWay}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Reject"/>
<Button x:Name="_cancelCallBtn_"
Click="_cancelCallBtn__Click"
Visibility="{x:Bind _call.state, Converter={StaticResource _OutGoingVisibility_}, Mode=OneWay}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="Cancel"/>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<!-- where accounts and share menu drop down are. -->
<RowDefinition Height="auto"/>
<!-- where contacts and settings are. -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- drop down menus. -->
<Grid Background="LightBlue">
<Grid.RowDefinitions>
<!-- where the selected account is shown. -->
<RowDefinition x:Name="_selectedAccountRow_"
Height="90"/>
<!-- where the drop down menus are shown. -->
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!-- selected account. -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="_selectedAccountAvatarColumn_"
Width="90"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Ellipse
x:Name="_selectedAccountAvatarContainer_"
Height="80"
Width="80"
Grid.Column="0"
Margin="5">
<Ellipse.Fill>
<ImageBrush
x:Name="_selectedAccountAvatar_"
ImageSource="Assets\TESTS\contactAvatar.png"/>
</Ellipse.Fill>
</Ellipse>
<StackPanel Grid.Column="1"
VerticalAlignment="Bottom">
<TextBlock x:Name="_selectedAccountName_"
Text="[TEXT MISSING]"
Margin="10"
Style="{StaticResource TextStyle2}"/>
<StackPanel Orientation="Horizontal">
<!--Content="&#xE0A1;-->
<ToggleButton x:Name="_accountsMenuButton_"
VerticalAlignment="Bottom"
Content="&#xE168;"
Checked="_accountsMenuButton__Checked"
Unchecked="_accountsMenuButton__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
<ToggleButton x:Name="_shareMenuButton_"
VerticalAlignment="Bottom"
Content="&#xE72D;"
Checked="_shareMenuButton__Checked"
Unchecked="_shareMenuButton__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
</StackPanel>
</StackPanel>
<ToggleButton x:Name="_settingsTBtn_"
Grid.Column="2"
VerticalAlignment="Bottom"
Content="&#xE115;"
Checked="_settings__Checked"
Unchecked="_settings__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
</Grid>
<!--sub menus like the accounts list or the share menu are just below, technicaly they are nested inside the
same row. To summon them we use the visibility of their own grid, by linking it to a toggle button-->
<!-- accounts menu. -->
<Grid x:Name="_accountsMenuGrid_"
MaxHeight="350"
Grid.Row="1"
Visibility="Collapsed"
Background="LightBlue">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ScrollViewer x:Name="_accountsListScrollView_"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Enabled">
<ListBox x:Name="_accountsList_"
Grid.Row="0"
SelectionChanged="_accountList__SelectionChanged"
Width="320"
ItemContainerStyle="{StaticResource contactsListBoxStyle}"
Background="#FFE4F1F9"
ItemTemplate="{StaticResource AccountTemplate}"/>
</ScrollViewer>
<Button x:Name="_addAccountBtn_"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE948;"
Click="_addAccountBtn__Click"
Style="{StaticResource ButtonStyle6}"/>
</Grid>
<!-- account creation menu. -->
<Grid x:Name="_accountCreationMenuGrid_"
Grid.Row="2"
Visibility="Collapsed"
Background="LightBlue">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical"
Grid.Row="0"
Background="#FFE4F1F9">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="Account type : "
Margin="10,10,0,10"/>
<ComboBox x:Name="_accountTypeComboBox_"
SelectedIndex="0"
Margin="10"
VerticalAlignment="Center"
Width="195">
<ComboBoxItem Content="Ring"/>
<ComboBoxItem Content="Sip"/>
</ComboBox>
</StackPanel>
<!-- RING account. -->
<StackPanel x:Name="_ringAccountCreationStack_"
Visibility="Visible">
<TextBox x:Name="_aliasTextBox_"
Margin="10"
PlaceholderText="Enter your username"/>
<PasswordBox Margin="10"
PlaceholderText="Enter your password"/>
<PasswordBox Margin="10"
PlaceholderText="Repeat your Password"/>
</StackPanel>
</StackPanel>
<!-- buttons yes/no to create the new account. -->
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<Button x:Name="_createAccountYes_"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE081;"
Click="_createAccountYes__Click"
Style="{StaticResource ButtonStyle5}"/>
<Button x:Name="_createAccountNo_"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE106;"
Click="_createAccountNo__Click"
Style="{StaticResource ButtonStyle5}"/>
</StackPanel>
</Grid>
</Grid>
<!-- share menu. -->
<Grid x:Name="_shareMenuGrid_"
Grid.Row="2"
Visibility="Collapsed"
Background="LightBlue">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid Background="#FFE4F1F9">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Image x:Name="_selectedAccountQrCode_"
Source="Assets\TESTS\qrcode.png"
Width="200"
Margin="5"
Grid.Row="0"
Height="200"/>
<TextBlock Text="RingId:"
Grid.Row="1"
HorizontalAlignment="Center"/>
<TextBox Style="{StaticResource TextBoxStyle2}"
HorizontalAlignment="Center"
Text="c4fc649aed8b2497a5e98fd2d856222f07020044"
Grid.Row="2"/>
</Grid>
</Grid>
</Grid>
<!-- smartList and settings. -->
<Grid Grid.Row="1">
<!-- contacts + calls => smartpanelitems. -->
<Grid x:Name="_smartGrid_"
Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition x:Name="_rowRingTxtBx_"
Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBox x:Name="_ringTxtBx_"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="320"
TextWrapping="Wrap"
Style="{StaticResource addContactTextBoxStyle}"
KeyDown="_ringTxtBx__KeyDown"
Text=""/>
<ListBox x:Name="_smartList_"
Grid.Row="1"
Margin="0"
Padding="0"
SelectionChanged="_smartList__SelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"
ItemContainerStyle="{StaticResource contactsListBoxStyle}"
ItemTemplate="{StaticResource SmartPanelItemsTemplate}"/>
</Grid>
<!-- settings. -->
<Grid x:Name="_settings_"
Grid.Row="0"
Visibility="Collapsed">
<TextBlock>some settings</TextBlock>
</Grid>
</Grid>
</Grid>
</Page>