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

Commit 66352ba

Browse files
authored
Revert "Profile v2"
1 parent aa5561f commit 66352ba

17 files changed

Lines changed: 113 additions & 472 deletions

Gateway/ProfileDataAccess.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

Model/Student.cs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,50 @@ public class Student
1313
//public Account Account { get; set; }
1414
public int ID { get; set; }
1515
public string Email { get; set; }
16-
public string City { get; set; }
16+
public string City { get; set; }
1717
public DateTime DateOfBirth { get; set; }
18+
1819
public string Age { get; set; }
1920
public School School { get; set; }
2021
public HashSet<Relationships> Relationships { get; set; }
2122
public Profile Profile { get; set; }
2223
public string Name { get; set; }
23-
public string FirstName { get; set; }
24-
public string LastName { get; set; }
25-
public bool Sex { get; set; }
2624

2725
public Student(string email)
2826
{
2927
//Account = account;
3028
Email = email;
31-
City = (string)"";
32-
DateOfBirth = (DateTime)DateTime.MaxValue;
29+
City = (string)LoadObject(DataKeys.City);
30+
DateOfBirth = (DateTime)LoadObject(DataKeys.DateOfBirth);
3331
Age = CalculateAge(DateOfBirth).ToString() + " Jaar";
34-
School = (School)new School("", "", "");
35-
Relationships = (HashSet<Relationships>)new HashSet<Relationships>();
36-
32+
School = (School)LoadObject(DataKeys.School);
33+
Relationships = (HashSet<Relationships>)LoadObject(DataKeys.Relationships);
3734
Profile = new Profile(this);
3835
}
3936

4037
public Student()
4138
{
42-
Profile = new Profile(this);
39+
}
40+
41+
private object LoadObject(DataKeys data)
42+
{
43+
44+
//this method will connect to the database and load the correct data for the object
45+
switch (data)
46+
{
47+
case DataKeys.City:
48+
break;
49+
case DataKeys.DateOfBirth:
50+
break;
51+
case DataKeys.School:
52+
break;
53+
case DataKeys.Relationships:
54+
break;
55+
default:
56+
break;
57+
}
58+
59+
return null;
4360
}
4461

4562
private static int CalculateAge(DateTime birthDay)

View/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:local="clr-namespace:View"
5+
xmlns:stylingHelperTools="clr-namespace:View.StylingHelperTools"
56
StartupUri="MainWindow.xaml">
67
<Application.Resources>
78
<ResourceDictionary Source="Styling/Main.xaml"/>

View/Converters/MultiPageEqualsConverter.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

View/HomePage.xaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

View/HomePage.xaml.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

View/MainWindow.xaml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
xmlns:local="clr-namespace:View"
77
xmlns:vm="clr-namespace:ViewModel;assembly=ViewModel"
88
xmlns:vmc="clr-namespace:ViewModel.Commands;assembly=ViewModel"
9-
xmlns:converters="clr-namespace:View.Converters"
109
mc:Ignorable="d"
1110
Style="{StaticResource {x:Type Window}}"
1211
Title="Stugether" Height="450" Width="800">
@@ -22,19 +21,16 @@
2221
<RowDefinition Height="35"/>
2322
<RowDefinition Height="1*"/>
2423
</Grid.RowDefinitions>
25-
<Grid Height="{Binding ActualHeight, ElementName=tbContentTitle, Mode=OneWay}" Background="{StaticResource BackgroundSecundary}">
24+
<Grid Height="{Binding ActualHeight, ElementName=tbContentTitle, Mode=OneWay}">
2625
<Grid.ColumnDefinitions>
2726
<ColumnDefinition Width="1*" />
2827
<ColumnDefinition Width="1*" />
2928
</Grid.ColumnDefinitions>
30-
<Button x:Name="btPreviousButton" Margin="5,5,5,5" Command="NavigationCommands.BrowseBack" CommandTarget="{Binding ElementName=frContent}">
31-
<Path Margin="0,0,2,0" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 4 0 L 0 4 L 4 8 Z" Fill="#FF444444"/>
32-
</Button>
33-
<Button x:Name="btNextButton" Grid.Column="1" Margin="5" Command="NavigationCommands.BrowseForward" CommandTarget="{Binding ElementName=frContent}">
34-
<Path Margin="0,0,2,0" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 0 8 Z" Fill="#FF444444"/>
35-
</Button>
29+
<Button x:Name="btPreviousButton" Content="&lt;" Margin="5,5,5,5" Click="NavigationNextPreviousButton_Click"/>
30+
<Button x:Name="btNextButton" Content="&gt;" Grid.Column="1" Margin="5" Click="NavigationNextPreviousButton_Click"/>
3631
</Grid>
3732
<!-- The Stackpanel doesn't allow a binding for its children, so we use a ItemsControl instead -->
33+
<StackPanel Grid.Row="1"> <!-- TEMPORARY for login button -->
3834
<ItemsControl x:Name="icMenuItems" Grid.Row="1" ItemsSource="{Binding MainNavigationItems}">
3935
<ItemsControl.ItemsPanel>
4036
<ItemsPanelTemplate>
@@ -43,25 +39,15 @@
4339
</ItemsControl.ItemsPanel>
4440
<ItemsControl.ItemTemplate>
4541
<ItemContainerTemplate>
46-
<local:MainWindowNavigationItem
47-
Content="{Binding Title}" Page="{Binding Page}" ExtraNavigationInformation="{Binding ExtraInformation}"
48-
Command="{Binding Path=DataContext.NavigateButtonCommand, RelativeSource={RelativeSource AncestorType=Window},Mode=Default}" CommandParameter="{Binding Mode=OneWay}">
49-
<local:MainWindowNavigationItem.IsChecked>
50-
<MultiBinding Mode="OneWay">
51-
<MultiBinding.Converter>
52-
<converters:MultiPageEqualsConverter/>
53-
</MultiBinding.Converter>
54-
<Binding Path="Page" Mode="OneWay"/>
55-
<Binding Path="DataContext.CurrentVisiblePage" RelativeSource="{RelativeSource AncestorType=Window}" Mode="OneWay"/>
56-
</MultiBinding>
57-
</local:MainWindowNavigationItem.IsChecked>
58-
</local:MainWindowNavigationItem>
42+
<local:MainWindowNavigationItem Content="{Binding Title}" Page="{Binding Page}" ExtraNavigationInformation="{Binding ExtraInformation}" Command="{Binding Path=DataContext.NavigateButtonCommand, RelativeSource={RelativeSource AncestorType=Window},Mode=Default}" CommandParameter="{Binding Mode=OneWay}"/>
5943
</ItemContainerTemplate>
6044
</ItemsControl.ItemTemplate>
6145
</ItemsControl>
62-
<TextBlock x:Name="tbContentTitle" Grid.Column="1" FontSize="22" FontWeight="Bold" Text="{Binding Content.Title, ElementName=frContent}"/>
46+
<local:MainWindowNavigationItem Content="Login" ExtraNavigationInformation="" Click="Login_Click"/>
47+
</StackPanel>
48+
<TextBlock x:Name="tbContentTitle" Grid.Column="1" FontSize="22" FontWeight="Bold" Text="{Binding Title}"/>
6349
<ScrollViewer Grid.Column="1" Grid.Row="1" VerticalScrollBarVisibility="Auto" >
64-
<Frame x:Name="frContent" Grid.Column="1" Grid.Row="1" NavigationUIVisibility="Hidden" Source="{Binding CurrentVisiblePage, Mode=TwoWay}"/>
50+
<Frame x:Name="frContent" Grid.Column="1" Grid.Row="1" NavigationUIVisibility="Hidden" Navigated="frContent_Navigated" Source="{Binding CurrentVisiblePage}"/>
6551
</ScrollViewer>
6652
</Grid>
6753
</Window>

View/MainWindow.xaml.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,49 @@ public MainWindow()
1616
InitializeComponent();
1717
SSHConnection.InitializeSsh(); // TODO: Not MVVM, this needs to be moved somewhere soon
1818
}
19+
20+
21+
/// <summary>
22+
/// Occurs when the back/forward buttons are clicked
23+
/// </summary>
24+
/// <param name="sender">The source of the event.</param>
25+
/// <param name="e">The event data.</param>
26+
private void NavigationNextPreviousButton_Click(object sender, RoutedEventArgs e)
27+
{
28+
if ((Button)sender == btPreviousButton)
29+
{
30+
frContent.GoBack();
31+
}
32+
else if ((Button)sender == btNextButton)
33+
{
34+
frContent.GoForward();
35+
}
36+
}
37+
38+
/// <summary>
39+
/// Occurs when navigation happened in the frame
40+
/// </summary>
41+
/// <param name="sender">The source of the event.</param>
42+
/// <param name="e">The event data.</param>
43+
private void frContent_Navigated(object sender, NavigationEventArgs e)
44+
{
45+
btPreviousButton.IsEnabled = ((Frame)sender).CanGoBack;
46+
btNextButton.IsEnabled = ((Frame)sender).CanGoForward;
47+
if (((Frame)sender).Content.GetType() == typeof(Page))
48+
{
49+
tbContentTitle.Text = ((Page)((Frame)sender).Content).Title;
50+
}
51+
}
52+
53+
private void MainWindowNavigationItem_Checked(object sender, RoutedEventArgs e)
54+
{
55+
56+
}
57+
58+
private void Login_Click(object sender, RoutedEventArgs e)
59+
{
60+
AuthenticationWindow authenticationWindow = new AuthenticationWindow();
61+
authenticationWindow.Show();
62+
}
1963
}
2064
}

View/MainWindowNavigationItem.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ namespace View
2020
public partial class MainWindowNavigationItem : RadioButton
2121
{
2222
public static readonly DependencyProperty PageProperty = DependencyProperty.Register(
23-
"Page", typeof(string), typeof(MainWindowNavigationItem));
23+
"Page", typeof(UIElement), typeof(MainWindowNavigationItem));
2424
/// <summary>
2525
/// The page to be navigated to
2626
/// </summary>
27-
public string Page
27+
public UIElement Page
2828
{
29-
get { return GetValue(PageProperty) as string; }
29+
get { return GetValue(PageProperty) as UIElement; }
3030
set { SetValue(PageProperty, value); }
3131
}
3232

View/ProfilePage.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ScrollViewer VerticalScrollBarVisibility="Auto">
1818

19-
<Grid x:Name="AllGrids" DataContext="{StaticResource vm}">
19+
<Grid x:Name="AllGrids" Background="White" DataContext="{StaticResource vm}">
2020

2121
<Grid.RowDefinitions>
2222
<RowDefinition Height="5*"/>
@@ -36,7 +36,7 @@
3636
<ColumnDefinition Width="1*"/>
3737
</Grid.ColumnDefinitions>
3838

39-
<Canvas x:Name="PhotoCarousel" Grid.Column="1" Grid.Row ="1" Grid.ColumnSpan="3" Grid.RowSpan="1" Background="#23000000" MinHeight="450px"/>
39+
<Canvas x:Name="PhotoCarousel" Grid.Column="1" Grid.Row ="1" Grid.ColumnSpan="3" Grid.RowSpan="1" Background="#23000000"/>
4040
<Grid x:Name="MainInfoGrid" Grid.Column="2" Grid.Row="2" Background="{StaticResource BackgroundSecundary}">
4141

4242
<Grid.ColumnDefinitions>
@@ -103,7 +103,7 @@
103103
<ProgressBar x:Name="ClimateProgressBar" Grid.Column="1" Grid.Row="6" Background="{StaticResource BackgroundSecundary}" Margin="10,10,10,10" Value="10" Foreground="{StaticResource BackgroundQuaternary}" MaxHeight="12" MinHeight="12"/>
104104

105105
</Grid>
106-
<Grid Grid.Column="2" Grid.Row="7" Background="{StaticResource BackgroundSecundary}"/>
107-
</Grid>
106+
107+
</Grid>
108108
</ScrollViewer>
109109
</Page>

0 commit comments

Comments
 (0)