Skip to content

Commit 133768e

Browse files
authored
Merge pull request #82 from signal-csharp/add-contact-page
Update AddContactPage
2 parents 0f686dc + dd4e7d5 commit 133768e

16 files changed

+1103
-662
lines changed

Signal-Windows.sln

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.3
3+
VisualStudioVersion = 15.0.27004.2002
54
MinimumVisualStudioVersion = 10.0.40219.1
65
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signal-Windows", "Signal-Windows\Signal-Windows.csproj", "{41736A64-5B66-44AF-879A-501192A46920}"
76
EndProject
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<UserControl
2+
x:Class="Signal_Windows.Controls.AddContactListElement"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Signal_Windows.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
d:DesignHeight="80"
10+
d:DesignWidth="500">
11+
12+
<Grid>
13+
<Grid.ColumnDefinitions>
14+
<ColumnDefinition Width="Auto" />
15+
<ColumnDefinition Width="*" />
16+
<ColumnDefinition Width="Auto" />
17+
</Grid.ColumnDefinitions>
18+
<Ellipse Grid.Column="0" Width="64" Height="64" Margin="8">
19+
<Ellipse.Fill>
20+
<ImageBrush ImageSource="{x:Bind ContactPhoto, Mode=OneWay}"/>
21+
</Ellipse.Fill>
22+
</Ellipse>
23+
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,8,0">
24+
<TextBlock Grid.Column="0" Name="ConversationDisplayName" FontSize="24" FontWeight="SemiLight" Text="{x:Bind DisplayName, Mode=OneWay}" TextTrimming="CharacterEllipsis"/>
25+
<TextBlock Text="{x:Bind PhoneNumber, Mode=OneWay}" FontSize="20"/>
26+
</StackPanel>
27+
<SymbolIcon Grid.Column="2" Symbol="Message" Margin="0,0,8,0" Foreground="#FF2190EA" Visibility="{x:Bind OnSignal, Mode=OneWay}"/>
28+
</Grid>
29+
</UserControl>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Runtime.InteropServices.WindowsRuntime;
7+
using Signal_Windows.Models;
8+
using Windows.Foundation;
9+
using Windows.Foundation.Collections;
10+
using Windows.UI.Xaml;
11+
using Windows.UI.Xaml.Controls;
12+
using Windows.UI.Xaml.Controls.Primitives;
13+
using Windows.UI.Xaml.Data;
14+
using Windows.UI.Xaml.Input;
15+
using Windows.UI.Xaml.Media;
16+
using Windows.UI.Xaml.Navigation;
17+
18+
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
19+
20+
namespace Signal_Windows.Controls
21+
{
22+
public sealed partial class AddContactListElement : UserControl, INotifyPropertyChanged
23+
{
24+
public event PropertyChangedEventHandler PropertyChanged;
25+
26+
public AddContactListElement()
27+
{
28+
this.InitializeComponent();
29+
this.DataContextChanged += AddContactListElement_DataContextChanged;
30+
}
31+
32+
public string _DisplayName;
33+
public string DisplayName
34+
{
35+
get { return _DisplayName; }
36+
set
37+
{
38+
_DisplayName = value;
39+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisplayName)));
40+
}
41+
}
42+
43+
public string _PhoneNumber;
44+
public string PhoneNumber
45+
{
46+
get { return _PhoneNumber; }
47+
set
48+
{
49+
_PhoneNumber = value;
50+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PhoneNumber)));
51+
}
52+
}
53+
54+
public ImageSource _ContactPhoto = null;
55+
public ImageSource ContactPhoto
56+
{
57+
get { return _ContactPhoto; }
58+
set
59+
{
60+
_ContactPhoto = value;
61+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ContactPhoto)));
62+
}
63+
}
64+
65+
public bool _OnSignal;
66+
public bool OnSignal
67+
{
68+
get { return _OnSignal; }
69+
set
70+
{
71+
_OnSignal = value;
72+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OnSignal)));
73+
}
74+
}
75+
76+
public PhoneContact Model
77+
{
78+
get
79+
{
80+
return DataContext as PhoneContact;
81+
}
82+
set
83+
{
84+
DataContext = value;
85+
}
86+
}
87+
88+
private void AddContactListElement_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
89+
{
90+
if (Model != null)
91+
{
92+
Model.View = this;
93+
DisplayName = Model.Name;
94+
PhoneNumber = Model.PhoneNumber;
95+
ContactPhoto = Model.Photo;
96+
OnSignal = Model.OnSignal;
97+
}
98+
}
99+
}
100+
}

0 commit comments

Comments
 (0)