Пример #1
0
        public MessagePage(Theme theme)
        {
            timer.Tick    += Timer_Tick;
            timer.Interval = new TimeSpan(0, 0, 3);
            timer.Start();
            InitializeComponent();
            timer.Interval = new TimeSpan(0, 0, 3);
            timer.Tick    += Timer_Tick;
            timer.Start();

            string accName = "";

            foreach (var item in messageService.GetMessages())
            {
                foreach (var user in accService.GetAccounts())
                {
                    if (item.UserId == user.Id)
                    {
                        accName = user.FirstName + " " + user.LastName;
                    }
                }
                if (item.ThemeId == theme.Id)
                {
                    lv_Chat.Items.Add(new ListViewMessageModel {
                        Name = accName, UserRole = item.UserId.ToString(), Content = item.Content.ToString()
                    });
                }
            }
            Theme = theme;
        }
Пример #2
0
 public ThemePage(Genre genre, SomeGame game, int userId)
 {
     Genre = genre;
     InitializeComponent();
     CurrentUserId = userId;
     foreach (var item in themeService.GetThemes())
     {
         if (item.GameId == game.Id)
         {
             int countOfMess = messageService.GetMessages().Where(t => t.ThemeId == item.Id).Count();
             listView.Items.Add(new ListViewModel()
             {
                 Name = item.Name, Description = "Count of messages: " + countOfMess.ToString()
             });
         }
     }
 }