Skip to content

Commit

Permalink
Add more loading info
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jul 3, 2018
1 parent fc6d8bd commit d8fcbb0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion GameFinder/Finder/FinderViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private async Task Load(PlayerSummaryModel you, IList<PlayerSummaryModel> profil
if (Session.SteamUser == null)
return;

DialogViewModel = new LoadingDialogViewModel();
DialogViewModel = new LoadingDialogViewModel("Matching games...");
try
{
// Load mutual games
Expand Down
29 changes: 19 additions & 10 deletions GameFinder/FriendChooser/FriendChooserViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,28 @@ public ICommand OkCommand

private async void OkAction(object o)
{
var you = await SteamHelper.GetProfile(Session.UserId);
DialogViewModel = new LoadingDialogViewModel("Loading games...");
try
{
var you = await SteamHelper.GetProfile(Session.UserId);

var feed = MessageFeed<FriendsLoadedStruct>.Feed;
IList<PlayerSummaryModel> profiles = new List<PlayerSummaryModel>();
foreach (var friend in ChosenFriends)
{
var profile = await SteamHelper.GetProfile(friend.UserId);
profiles.Add(profile);
}

IList<PlayerSummaryModel> profiles = new List<PlayerSummaryModel>();
foreach (var friend in ChosenFriends)
var feed = MessageFeed<FriendsLoadedStruct>.Feed;
feed.Notify(new FriendsLoadedStruct(profiles, you));

IsDialogOpen = false;
Transitioner.MoveNextCommand.Execute(null, null);
} catch (Exception ex)
{
var profile = await SteamHelper.GetProfile(friend.UserId);
profiles.Add(profile);
DialogViewModel = new ErrorDialogViewModel(
$"Could not load friends! Check your API Key, User ID and profile visibility!\n\r{ex.Message}");
}

feed.Notify(new FriendsLoadedStruct(profiles, you));
Transitioner.MoveNextCommand.Execute(null, null);
}


Expand All @@ -95,7 +104,7 @@ private async Task LoadAsync()
if (Session.SteamUser == null)
return;

DialogViewModel = new LoadingDialogViewModel();
DialogViewModel = new LoadingDialogViewModel("Loading friends...");
try
{
var friends = await SteamHelper.GetFriends();
Expand Down
2 changes: 1 addition & 1 deletion GameFinder/LoadingDialog/LoadingDialogView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Text="Loading..." />
Text="{Binding Title, FallbackValue=Loading...}" />

<ProgressBar
Grid.Row="1"
Expand Down
13 changes: 13 additions & 0 deletions GameFinder/LoadingDialog/LoadingDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,18 @@ public int Progress
get => _progress;
set => Set(ref _progress, value);
}

private string _title;

public string Title
{
get => _title;
set => Set(ref _title, value);
}

public LoadingDialogViewModel(string title)
{
Title = title;
}
}
}
2 changes: 1 addition & 1 deletion GameFinder/Login/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public bool IsDialogOpen

private void LoginAction(object o)
{
DialogViewModel = new LoadingDialogViewModel("Loading...");
try
{
DialogViewModel = new LoadingDialogViewModel();
Model.Login(ApiKey, UserId);
IsDialogOpen = false;
} catch
Expand Down

0 comments on commit d8fcbb0

Please sign in to comment.