Commit 586e3620 authored by Nicolas Jager's avatar Nicolas Jager

smartpanel : add account type icons

Change-Id: I90d0b543568f268d6c9161de80bdd3df01f7ed68
Tuleap: #1237
parent 95c526b2
......@@ -38,6 +38,7 @@ Account::Account(String^ name,
accountType_ = accountType;
accountID_ = accountID;
_deviceId = deviceId;
_isSelected = false;
}
void
......
......@@ -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_;
};
}
......
......@@ -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
......
......@@ -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="&#xE104;"
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. -->
......
......@@ -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()
{}
......@@ -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);
......
......@@ -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" />
......
......@@ -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" />
......
......@@ -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" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment