Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Signal-Windows.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signal-Windows", "Signal-Windows\Signal-Windows.csproj", "{41736A64-5B66-44AF-879A-501192A46920}"
EndProject
Expand Down
29 changes: 29 additions & 0 deletions Signal-Windows/Controls/AddContactListElement.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<UserControl
x:Class="Signal_Windows.Controls.AddContactListElement"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Signal_Windows.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="80"
d:DesignWidth="500">

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Width="64" Height="64" Margin="8">
<Ellipse.Fill>
<ImageBrush ImageSource="{x:Bind ContactPhoto, Mode=OneWay}"/>
</Ellipse.Fill>
</Ellipse>
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,8,0">
<TextBlock Grid.Column="0" Name="ConversationDisplayName" FontSize="24" FontWeight="SemiLight" Text="{x:Bind DisplayName, Mode=OneWay}" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{x:Bind PhoneNumber, Mode=OneWay}" FontSize="20"/>
</StackPanel>
<SymbolIcon Grid.Column="2" Symbol="Message" Margin="0,0,8,0" Foreground="#FF2190EA" Visibility="{x:Bind OnSignal, Mode=OneWay}"/>
</Grid>
</UserControl>
100 changes: 100 additions & 0 deletions Signal-Windows/Controls/AddContactListElement.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Signal_Windows.Models;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

namespace Signal_Windows.Controls
{
public sealed partial class AddContactListElement : UserControl, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

public AddContactListElement()
{
this.InitializeComponent();
this.DataContextChanged += AddContactListElement_DataContextChanged;
}

public string _DisplayName;
public string DisplayName
{
get { return _DisplayName; }
set
{
_DisplayName = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisplayName)));
}
}

public string _PhoneNumber;
public string PhoneNumber
{
get { return _PhoneNumber; }
set
{
_PhoneNumber = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PhoneNumber)));
}
}

public ImageSource _ContactPhoto = null;
public ImageSource ContactPhoto
{
get { return _ContactPhoto; }
set
{
_ContactPhoto = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ContactPhoto)));
}
}

public bool _OnSignal;
public bool OnSignal
{
get { return _OnSignal; }
set
{
_OnSignal = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OnSignal)));
}
}

public PhoneContact Model
{
get
{
return DataContext as PhoneContact;
}
set
{
DataContext = value;
}
}

private void AddContactListElement_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (Model != null)
{
Model.View = this;
DisplayName = Model.Name;
PhoneNumber = Model.PhoneNumber;
ContactPhoto = Model.Photo;
OnSignal = Model.OnSignal;
}
}
}
}
Loading