|
|
|
@ -15,7 +15,18 @@ namespace BookAStar.ViewModels
|
|
|
|
|
|
|
|
|
|
|
|
internal class DashboardViewModel : ViewModel
|
|
|
|
internal class DashboardViewModel : ViewModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public int Rating { get; set; }
|
|
|
|
int rating;
|
|
|
|
|
|
|
|
public int Rating
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return rating;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty<int>(ref rating, value, "Rating");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string UserId
|
|
|
|
public string UserId
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -101,7 +112,14 @@ namespace BookAStar.ViewModels
|
|
|
|
return performerStatus;
|
|
|
|
return performerStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string userQueries;
|
|
|
|
|
|
|
|
public string UserQueries
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return userQueries;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public string UserName
|
|
|
|
public string UserName
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get
|
|
|
|
get
|
|
|
|
@ -117,7 +135,7 @@ namespace BookAStar.ViewModels
|
|
|
|
Accounts = MainSettings.AccountList;
|
|
|
|
Accounts = MainSettings.AccountList;
|
|
|
|
User = MainSettings.CurrentUser;
|
|
|
|
User = MainSettings.CurrentUser;
|
|
|
|
UpdateUserMeta();
|
|
|
|
UpdateUserMeta();
|
|
|
|
|
|
|
|
Rating = 2;
|
|
|
|
UserNameGesture = new RelayGesture((g, x) =>
|
|
|
|
UserNameGesture = new RelayGesture((g, x) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (g.GestureType == GestureType.LongPress)
|
|
|
|
if (g.GestureType == GestureType.LongPress)
|
|
|
|
@ -135,31 +153,51 @@ namespace BookAStar.ViewModels
|
|
|
|
UpdateUserMeta();
|
|
|
|
UpdateUserMeta();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool haveAnUser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool HaveAnUser
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return User!=null; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool UserIsPro
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return User?.Roles?.Contains("Performer") ?? false ; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateUserMeta ()
|
|
|
|
private void UpdateUserMeta ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string newStatusString;
|
|
|
|
string newStatusString;
|
|
|
|
long newQueryCount;
|
|
|
|
long newQueryCount;
|
|
|
|
bool newUserIsPro;
|
|
|
|
bool newUserIsPro;
|
|
|
|
ImageSource newAvatar;
|
|
|
|
ImageSource newAvatar;
|
|
|
|
if (user==null)
|
|
|
|
string newQueriesButtonText;
|
|
|
|
{
|
|
|
|
bool newHaveAnUser = user == null;
|
|
|
|
|
|
|
|
if (newHaveAnUser) {
|
|
|
|
newQueryCount = 0;
|
|
|
|
newQueryCount = 0;
|
|
|
|
newUserIsPro = false;
|
|
|
|
newUserIsPro = false;
|
|
|
|
newStatusString = null;
|
|
|
|
newStatusString = null;
|
|
|
|
newAvatar = null;
|
|
|
|
newAvatar = null;
|
|
|
|
|
|
|
|
newQueriesButtonText = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
newUserIsPro = User.Roles?.Contains("Performer") ?? false;
|
|
|
|
newUserIsPro = UserIsPro;
|
|
|
|
|
|
|
|
|
|
|
|
newQueryCount = newUserIsPro ? DataManager.Current.BookQueries.Count : 0;
|
|
|
|
newQueryCount = newUserIsPro ? DataManager.Current.BookQueries.Count : 0;
|
|
|
|
|
|
|
|
|
|
|
|
newStatusString = newUserIsPro ?
|
|
|
|
newStatusString = newUserIsPro ?
|
|
|
|
$"Profile professionel renseigné,\n{newQueryCount} demandes valides en cours" :
|
|
|
|
$"Profile professionel renseigné" :
|
|
|
|
|
|
|
|
"Profile professionel non renseigné";
|
|
|
|
|
|
|
|
newQueriesButtonText = newUserIsPro ?
|
|
|
|
|
|
|
|
$"{newQueryCount} demandes valides en cours" :
|
|
|
|
"Profile professionel non renseigné";
|
|
|
|
"Profile professionel non renseigné";
|
|
|
|
newAvatar = UserHelpers.Avatar(user.Avatar);
|
|
|
|
newAvatar = UserHelpers.Avatar(user.Avatar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetProperty<bool>(ref haveAnUser, newHaveAnUser, "UserIsPro");
|
|
|
|
|
|
|
|
SetProperty<bool>(ref userIsPro, newUserIsPro, "UserIsPro");
|
|
|
|
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
|
|
|
|
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
|
|
|
|
|
|
|
|
SetProperty<string>(ref userQueries, newQueriesButtonText, "PerformerStatus");
|
|
|
|
SetProperty<long>(ref queryCount, newQueryCount, "QueryCount");
|
|
|
|
SetProperty<long>(ref queryCount, newQueryCount, "QueryCount");
|
|
|
|
SetProperty<ImageSource>(ref avatar, newAvatar, "Avatar");
|
|
|
|
SetProperty<ImageSource>(ref avatar, newAvatar, "Avatar");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|