Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Commit ada5c1c

Browse files
committed
profile page update
1 parent c8b71a8 commit ada5c1c

5 files changed

Lines changed: 68 additions & 12 deletions

File tree

Model/MatchList.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
namespace Model
66
{
7-
class MatchList
7+
public class MatchList
88
{
9-
10-
private HashSet<Match> Matches { get; set; }
9+
public HashSet<Match> Matches { get; set; }
1110
private Student Student;
1211

1312
public MatchList(Student student)

Model/Profile.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ public class Profile
88
{
99

1010
private Student Student { get; set; }
11-
private QAData QAData { get; set; }
12-
private MoralsData MoralsData { get; set; }
13-
private InterestsData InterestsData { get; set; }
14-
private string Description { get; set; }
15-
private Media Media { get; set; }
16-
private MatchList MatchList { get; set; }
17-
private BlockList BlockList { get; set; }
11+
public QAData QAData { get; set; }
12+
public MoralsData MoralsData { get; set; }
13+
public InterestsData InterestsData { get; set; }
14+
public string Description { get; set; }
15+
public Media Media { get; set; }
16+
public MatchList MatchList { get; set; }
17+
public BlockList BlockList { get; set; }
1818

1919
public Profile(Student student)
2020
{

Model/Student.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Student
1818
public DateTime DateOfBirth { get; set; }
1919
public School School { get; set; }
2020
public HashSet<Relationships> Relationships { get; set; }
21+
public Profile Profile { get; set; }
22+
23+
public string Name { get; set; }
2124

2225
public Student(string email)
2326
{
@@ -28,6 +31,12 @@ public Student(string email)
2831
DateOfBirth = (DateTime)LoadObject(DataKeys.DateOfBirth);
2932
School = (School)LoadObject(DataKeys.School);
3033
Relationships = (HashSet<Relationships>)LoadObject(DataKeys.Relationships);
34+
Profile = new Profile(this);
35+
}
36+
37+
public Student()
38+
{
39+
3140
}
3241

3342
private object LoadObject(DataKeys data)

View/ProfilePage.xaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="clr-namespace:View"
7+
xmlns:VM="clr-namespace:ViewModel;assembly=ViewModel"
78
mc:Ignorable="d"
89
d:DesignHeight="1920" d:DesignWidth="1080"
910
Title="Profile">
1011

11-
<Grid x:Name="AllGrids" Background="White">
12+
<Page.Resources>
13+
<VM:ProfilePageViewModel x:Key="vm"/>
14+
</Page.Resources>
15+
16+
<Grid x:Name="AllGrids" Background="White" DataContext="{StaticResource vm}">
1217
<Grid.RowDefinitions>
1318
<RowDefinition Height="5*"/>
1419
<RowDefinition Height="35*"/>
@@ -38,7 +43,7 @@
3843
<RowDefinition Height="60*"/>
3944
<RowDefinition Height="40*"/>
4045
</Grid.RowDefinitions>
41-
<Label x:Name="NameLabel" HorizontalAlignment="Center" Content="PETER JANSEN" Grid.ColumnSpan="4" Grid.RowSpan="1" FontSize="48"/>
46+
<Label x:Name="NameLabel" HorizontalAlignment="Center" Content="{Binding Name}" Grid.ColumnSpan="4" Grid.RowSpan="1" FontSize="48"/>
4247
<Label x:Name="AgeLabel" Content="24 jaar" HorizontalAlignment="Center" Grid.Row="1" VerticalAlignment="Stretch" FontSize="20"/>
4348
<Label x:Name="LocationLabel" Content="Zwolle" Grid.Column="1" HorizontalAlignment="Center" Grid.Row="1" FontSize="20" VerticalAlignment="Stretch"/>
4449
<Label x:Name="SchoolNameLabel" Content="Windesheim" Grid.Column="2" HorizontalAlignment="Center" Grid.Row="1" FontSize="20" VerticalAlignment="Stretch"/>

ViewModel/ProfilePageViewModel.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Text;
5+
using Model;
6+
namespace ViewModel
7+
{
8+
public class ProfilePageViewModel : INotifyPropertyChanged
9+
{
10+
public string Name {
11+
get
12+
{
13+
14+
return _student.Name;
15+
}
16+
set
17+
{
18+
_student.Name = value;
19+
OnPropertyChanged("Name");
20+
}
21+
}
22+
23+
private Student _student;
24+
25+
26+
public event PropertyChangedEventHandler PropertyChanged;
27+
28+
public ProfilePageViewModel()
29+
{
30+
31+
32+
33+
34+
_student = new Student();
35+
_student.Name = "";
36+
}
37+
38+
private void OnPropertyChanged(string property = null)
39+
{
40+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)