예제 #1
0
 private void UserEntered(User user, bool notify)
 {
     UserViewModel uvm = null;
     if (!ApplicationVM.LocalCache.AllUserVMs.ContainsKey(user.Id))
     {
         uvm = new UserViewModel(user);
         uvm.Initialize();
         ApplicationVM.LocalCache.AllUserVMs.Add(user.Id, uvm);
     }
     else
     {
         uvm = ApplicationVM.LocalCache.AllUserVMs[user.Id];
         if (!uvm.IsInitialized)
             uvm.Initialize();
     }
     lock (UserVMs)
     {
         uvm.RoomWindowVM = this;
         if (!UserVMs.Contains(uvm))
         {
             UserVMs.Add(uvm);
         }
     }
     if (notify)
     {
         CallJavaScript("UserEntered", uvm.GetJson(false));
     }
 }
예제 #2
0
        public async Task GetUsers()
        {
            HttpResponseMessage response = await client.GetAsync("/api/Paint/GetUsers");

            if (response.IsSuccessStatusCode)
            {
                string json = await response.Content.ReadAsStringAsync();

                List <User> users = JsonConvert.DeserializeObject <List <User> >(json);
                foreach (User u in users)
                {
                    UserVMs.Add(new UserVM(u));
                }
            }
            else
            {
                MessageBox.Show(response.RequestMessage.ToString(), "RequestError");
            }
        }