diff --git a/Account.cpp b/Account.cpp index 43cd68fa5c7f56beb928fc9e45ec2ec35dcf9f45..7f1c97d58ca9c686c600645a2dbf849b20a0b313 100644 --- a/Account.cpp +++ b/Account.cpp @@ -38,6 +38,7 @@ Account::Account(String^ name, accountType_ = accountType; accountID_ = accountID; _deviceId = deviceId; + _isSelected = false; } void diff --git a/Account.h b/Account.h index 6f11812af5717d6c90d15b1468e6f9df3a236af3..224e1fa9bea4a66de4b79c0ca8cb22799dc8f5be 100644 --- a/Account.h +++ b/Account.h @@ -45,12 +45,22 @@ public: devicesIdList_ = value; } } + property bool _isSelected { + void set(bool value) { + // isSelected_ = value; disabled on purpose for future use + PropertyChanged(this, ref new PropertyChangedEventArgs("_isSelected")); + } + bool get() { + return isSelected_; + } + } protected: void NotifyPropertyChanged(String^ propertyName); private: Windows::Foundation::Collections::IVector<String^>^ devicesIdList_; + bool isSelected_; }; } diff --git a/AccountsViewModel.h b/AccountsViewModel.h index b4a3e9219716cd7375f8f2ebbedcb90147a6b754..5612b108e4059ea83713f8a771095813b4516de9 100644 --- a/AccountsViewModel.h +++ b/AccountsViewModel.h @@ -56,7 +56,11 @@ internal: void set(Account^ value) { oldItem_ = currentItem_; + if (oldItem_) + oldItem_->_isSelected = false; currentItem_ = value; + if (currentItem_) + currentItem_->_isSelected = true; if (value) newAccountSelected(); else diff --git a/Assets/AccountTypeRING.png b/Assets/AccountTypeRING.png new file mode 100644 index 0000000000000000000000000000000000000000..7d61ed6e6c47a40dd760dea611313c66983e06b7 Binary files /dev/null and b/Assets/AccountTypeRING.png differ diff --git a/Assets/AccountTypeSIP.png b/Assets/AccountTypeSIP.png new file mode 100644 index 0000000000000000000000000000000000000000..21464eaf7193e5d8a8172de53afb32b382e8dea6 Binary files /dev/null and b/Assets/AccountTypeSIP.png differ diff --git a/SmartPanel.xaml b/SmartPanel.xaml index 0ac9e7b1f7eb9cf1f3c5cf700b0aa5875ae42884..213c1385dfdf4cb968259d842e9c56c8a0ee4c21 100644 --- a/SmartPanel.xaml +++ b/SmartPanel.xaml @@ -32,6 +32,8 @@ <views:IncomingVisibility x:Key="_IncomingVisibility_" /> <views:OutGoingVisibility x:Key="_OutGoingVisibility_" /> <views:HasAnActiveCall x:Key="_HasAnActiveCall_" /> + <views:AccountTypeToSourceImage x:Key="_AccountTypeToSourceImage_" /> + <views:AccountSelectedToVisibility x:Key="_AccountSelectedToVisibility_" /> <Style x:Key="addContactTextBoxStyle" TargetType="TextBox"> @@ -171,36 +173,42 @@ <!-- template for accounts. --> <DataTemplate x:Key="AccountTemplate" x:DataType="local:Account"> - <Grid> + <Grid Margin="0,10"> <Grid.ColumnDefinitions> - <ColumnDefinition Width="260"/> - <ColumnDefinition Width="60"/> + <ColumnDefinition Width="40"/> + <ColumnDefinition Width="290"/> </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" + <Border Grid.Column="0" + Margin="5,0" + Style="{StaticResource BorderStyle3}"> + <Image x:Name="_AccountTypeIcon_" + VerticalAlignment="Center" + HorizontalAlignment="Center" + Source="{x:Bind accountType_, Converter={StaticResource _AccountTypeToSourceImage_}, Mode=OneWay}"/> + </Border> + <Button x:Name="_editAccountMenuButton_" + HorizontalAlignment="Right" + VerticalAlignment="Top" + Content="" + FontFamily="Segoe MDL2 Assets" + FontSize="20" + Foreground="White" + Background="Transparent" + Visibility="{x:Bind _isSelected, Converter={StaticResource _AccountSelectedToVisibility_}, Mode=OneWay}" + Grid.Column="1"> + <Button.RenderTransform> + <TranslateTransform X="-5" Y="-5"/> + </Button.RenderTransform> + </Button> + <StackPanel Grid.Column="1"> + <TextBlock x:Name="_accountName_" + Style="{StaticResource TextStyle5}" 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" + <TextBlock x:Name="_ringID_" Grid.ColumnSpan="2" - Grid.Row="1" - Foreground="Crimson" - Margin="10,5,10,0" - FontSize="14" - TextTrimming="CharacterEllipsis" + Style="{StaticResource TextStyle6}" Text="{x:Bind ringID_}"/> + </StackPanel> </Grid> </DataTemplate> <!-- template for smartpanelitems. --> diff --git a/SmartPanel.xaml.cpp b/SmartPanel.xaml.cpp index bee9236b4eb150a251e42d514aba82f90b912b7c..2af55275b649666afa28fa1524b1f2687afed47f 100644 --- a/SmartPanel.xaml.cpp +++ b/SmartPanel.xaml.cpp @@ -667,3 +667,39 @@ void RingClientUWP::Views::SmartPanel::_shareMenuDone__Click(Platform::Object^ s _shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; } + +Object ^ RingClientUWP::Views::AccountTypeToSourceImage::Convert(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + auto accountType = dynamic_cast<String^>(value); + Uri^ uri = (accountType == "RING") + ? ref new Uri("ms-appx:///Assets/AccountTypeRING.png") + : ref new Uri("ms-appx:///Assets/AccountTypeSIP.png"); + + return ref new BitmapImage(uri); +} + +Object ^ RingClientUWP::Views::AccountTypeToSourceImage::ConvertBack(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + throw ref new Platform::NotImplementedException(); +} + +RingClientUWP::Views::AccountTypeToSourceImage::AccountTypeToSourceImage() +{} + +Object ^ RingClientUWP::Views::AccountSelectedToVisibility::Convert(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + //auto accountId = static_cast<bool(value); + + if (/*AccountsViewModel::instance->selectedAccount->_isSelected ==*/ (bool)value == true) + return Windows::UI::Xaml::Visibility::Visible; + + return Windows::UI::Xaml::Visibility::Collapsed; +} + +Object ^ RingClientUWP::Views::AccountSelectedToVisibility::ConvertBack(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + throw ref new Platform::NotImplementedException(); +} + +RingClientUWP::Views::AccountSelectedToVisibility::AccountSelectedToVisibility() +{} diff --git a/SmartPanel.xaml.h b/SmartPanel.xaml.h index 74d8bcb2311e24805ecabe4cc288b7f915ff2ad3..84b38f7f271709e251d0fd65c7163f004d22c1f4 100644 --- a/SmartPanel.xaml.h +++ b/SmartPanel.xaml.h @@ -50,6 +50,20 @@ public: HasAnActiveCall(); }; +public ref class AccountTypeToSourceImage sealed : IValueConverter { +public: + virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + virtual Object^ ConvertBack(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + AccountTypeToSourceImage(); +}; + +public ref class AccountSelectedToVisibility sealed : IValueConverter { +public: + virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + virtual Object^ ConvertBack(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + AccountSelectedToVisibility(); +}; + public ref class NewMessageBubleNotification sealed : IValueConverter { public: virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); diff --git a/Styles.xaml b/Styles.xaml index aa8e173aea832b69c688449f32582dc16f65e10c..8f43934ca7df337c435fbc3f99fb142d49bfd152 100644 --- a/Styles.xaml +++ b/Styles.xaml @@ -67,6 +67,30 @@ <Setter Property="Foreground" Value="Black"/> </Style> + <Style x:Key="TextStyle5" + TargetType="TextBlock"> + <Setter Property="FontSize" + Value="15"/> + <Setter Property="HorizontalAlignment" + Value="Left"/> + <Setter Property="VerticalAlignment" + Value="Center"/> + <Setter Property="FontStyle" + Value="Italic"/> + <Setter Property="Foreground" + Value="Black"/> + </Style> + <Style x:Key="TextStyle6" + TargetType="TextBlock"> + <Setter Property="FontSize" + Value="12"/> + <Setter Property="HorizontalAlignment" + Value="Left"/> + <Setter Property="VerticalAlignment" + Value="Center"/> + <Setter Property="Foreground" + Value="Black"/> + </Style> <Style x:Key="TextSegoeStyle1" TargetType="TextBlock"> <Setter Property="FontFamily" @@ -165,6 +189,19 @@ <Setter Property="Background" Value="Transparent"/> </Style> + <Style x:Key="ButtonStyle7" + TargetType="Button"> + <Setter Property="Width" + Value="20"/> + <Setter Property="Height" + Value="20"/> + <Setter Property="FontFamily" + Value="Segoe MDL2 Assets"/> + <Setter Property="Foreground" + Value="White"/> + <Setter Property="Background" + Value="Transparent"/> + </Style> <Style x:Key="ToggleButtonStyle1" TargetType="ToggleButton"> <Setter Property="Width" @@ -279,6 +316,16 @@ <Setter Property="Height" Value="23"/> <Setter Property="Padding" Value="4"/> </Style> + <Style x:Key="BorderStyle3" + TargetType="Border"> + <Setter Property="Background" Value="LightBlue"/> + <Setter Property="CornerRadius" Value="6"/> + <Setter Property="Width" Value="28"/> + <Setter Property="Height" Value="50"/> + <Setter Property="BorderThickness" Value="2"/> + <Setter Property="BorderBrush" Value="white"/> + <Setter Property="Padding" Value="4"/> + </Style> <Style x:Key="messageBubleStyle" TargetType="ListBoxItem"> <Setter Property="HorizontalAlignment" Value="Stretch" /> diff --git a/ring-client-uwp.vcxproj b/ring-client-uwp.vcxproj index f40930b57b65a11ff48122e1d450f10c0f5ee665..2c4350a9db48a53e39e810168ae27ff31e648b5a 100644 --- a/ring-client-uwp.vcxproj +++ b/ring-client-uwp.vcxproj @@ -262,6 +262,8 @@ <None Include="ring-client-uwp_TemporaryKey.pfx" /> </ItemGroup> <ItemGroup> + <Image Include="Assets\AccountTypeRING.png" /> + <Image Include="Assets\AccountTypeSIP.png" /> <Image Include="Assets\LockScreenLogo.scale-200.png" /> <Image Include="Assets\qrCodeIcon.png" /> <Image Include="Assets\SplashScreen.scale-200.png" /> diff --git a/ring-client-uwp.vcxproj.filters b/ring-client-uwp.vcxproj.filters index ff410359e4137939cfc46c6cc92068b191741eb7..e06ba95009b307a7125af73badaa940b5bf235c1 100644 --- a/ring-client-uwp.vcxproj.filters +++ b/ring-client-uwp.vcxproj.filters @@ -217,6 +217,12 @@ <Image Include="Assets\qrCodeIcon.png"> <Filter>Assets</Filter> </Image> + <Image Include="Assets\AccountTypeSIP.png"> + <Filter>Assets\TESTS</Filter> + </Image> + <Image Include="Assets\AccountTypeRING.png"> + <Filter>Assets\TESTS</Filter> + </Image> </ItemGroup> <ItemGroup> <AppxManifest Include="Package.appxmanifest" />