Exemple #1
0
    public void LoadAward()
    {
        awards.Clear();
        ApplicationContext context = Context.GetApplicationContext();

        IRewardRepository rewardRepository = context.GetService <IRewardRepository>();

        IAsyncResult <List <Award> > result = rewardRepository.GetAwards();
        List <Award> awardList = result.Synchronized().WaitForResult();

        foreach (Award award in awardList)
        {
            AwardItemViewModel awardItemViewModel = new AwardItemViewModel();
            if (award.Quality == (int)QualityType.Orange)
            {
                awardItemViewModel.Name = $"<color=#FF7F00>{award.Name}  {award.Count}</color>";
            }
            else if (award.Quality == (int)QualityType.Purple)
            {
                awardItemViewModel.Name = $"<color=#8B00FF>{award.Name}  {award.Count}</color>";
            }
            else
            {
                awardItemViewModel.Name = $"<color=#00FF00>{award.Name}  {award.Count}</color>";
            }

            this.awards.Add(awardItemViewModel);
        }
    }