This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
UserProfile.xaml.cs
51 lines (46 loc) · 1.66 KB
/
UserProfile.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Coolapk_UWP.ViewModels;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Coolapk_UWP.Pages {
public sealed partial class UserProfile : Page {
public readonly UserProfileViewModel ViewModel;
public UserProfile() {
ViewModel = new UserProfileViewModel();
DataContext = ViewModel;
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e) {
base.OnNavigatedTo(e);
var parameter = e.Parameter;
if (parameter != null) {
switch (parameter) {
case uint _uintUid:
case int _intUid:
var uid = (uint)parameter;
if (uid != ViewModel.Uid) {
ViewModel.Uid = uid;
ViewModel.Reload();
}
break;
case string username:
if (username != ViewModel.Username) {
ViewModel.Username = username;
ViewModel.Reload();
}
break;
}
}
}
private void RetryButton_Click(object sender, RoutedEventArgs e) {
ViewModel.Reload();
}
private void Pivot_PivotItemLoaded(Pivot sender, PivotItemEventArgs args) {
ViewModel.OnPiovtSelect(args.Item.Content.ToString());
}
}
}