예제 #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;
        }