private void GetRoomResponse(Protocol.RoomInfoDetail e) { if (e.Success) { foreach (Protocol.DeskInfo item in e.Desks) { ViewModel.Desk desk = mDesks.FirstOrDefault(o => o.ID == item.DeskID); if (desk == null) { desk = new ViewModel.Desk(); desk.ID = item.DeskID; desk.Name = item.Name; desk.S1 = new ViewModel.Seat(); desk.S2 = new ViewModel.Seat(); desk.S3 = new ViewModel.Seat();; desk.S4 = new ViewModel.Seat();; mDesks.Add(desk); } desk.S1.FromSeatInfo(item.Seats[0]); desk.S2.FromSeatInfo(item.Seats[1]); desk.S3.FromSeatInfo(item.Seats[2]); desk.S4.FromSeatInfo(item.Seats[3]); desk.Selected = item.Seats[0].UserID == txtEMail.Text || item.Seats[1].UserID == txtEMail.Text || item.Seats[2].UserID == txtEMail.Text || item.Seats[3].UserID == txtEMail.Text; } } }
private void SelectDeskResponse(Protocol.SelectDeskResponse e) { if (e.Success) { ViewModel.Desk desk = mDesks.FirstOrDefault(o => o.ID == e.Desk); if (e.Seat == 1) { desk.S1.Use = true; } else if (e.Seat == 2) { desk.S2.Use = true; } else if (e.Seat == 3) { desk.S3.Use = true; } else if (e.Seat == 4) { desk.S4.Use = true; } else { } } else { MessageBox.Show(e.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { Button cmd = (Button)e.Source; ViewModel.Seat seat = (ViewModel.Seat)cmd.DataContext; ViewModel.Desk desk = (ViewModel.Desk)((FrameworkElement)cmd.Parent).DataContext; Protocol.SelectDesk selectDesk = new Protocol.SelectDesk(); selectDesk.Room = mSelectedRoom.ID; selectDesk.Desk = desk.ID; selectDesk.Seat = seat.Index; mClient.Send(selectDesk); }