Example #1
0
 public int CreateRoom(Room room)
 {
     var requestId = Interlocked.Increment(ref freeRequestId);
     pendingInRequests.InQueue(
         new Cortege3<IClientCallback, RequestCode, List<object>>(
             OperationContext.Current.GetCallbackChannel<IClientCallback>(), RequestCode.CreateRoom,
             new List<object> {requestId, room}), lockTimeout);
     return requestId;
 }
Example #2
0
 public Room(Room room)
 {
     Id = room.Id;
     Name = room.Name;
     Owner = room.Owner;
     Description = room.Description;
     Greeting = room.Greeting;
     Password = room.Password;
     ExpireTime = room.ExpireTime;
     IsBound = room.IsBound;
     UserCount = room.UserCount;
 }
Example #3
0
 public Room GetRoom()
 {
     var result = new Room
         {
             Id = roomId,
             Name = nameTextBox.Text,
             Owner = ownerComboBox.SelectedItem != null ? ((User)ownerComboBox.SelectedItem).ID : 0,
             Description = descriptionRichTextBox.Text,
             Greeting = greetingRichTextBox.Text,
             Password = passwordTextBox.Text,
             IsBound = isBoundCheckBox.Checked
         };
     return result;
 }
Example #4
0
 public void SetRoom(Room room)
 {
     roomId = room.Id;
     nameTextBox.Text = room.Name;
     var owner = AllUsers.Instance.GetAllUsers().FirstOrDefault(u => u.ID == room.Owner);
     if (owner != null)
         ownerComboBox.SelectedItem = owner;
     else if (room.Owner == 0)
         ownerComboBox.SelectedIndex = 0;
     else
     {
         MessageBox.Show(this,
                         "Пользователь-владелец комнаты с идентификатором " + room.Owner + " отсутствует в БД",
                         "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     descriptionRichTextBox.Text = room.Description;
     greetingRichTextBox.Text = room.Greeting;
     // TODO: аккуратнее с паролем - с сервера приходят звездочки, вместо подлинного
     // TODO: за этим нужно проследить во время измненения комнаты
     passwordTextBox.Text = room.Password;
     passwordConfirmationTextBox.Text = room.Password;
     isBoundCheckBox.Checked = room.IsBound;
     if (!room.IsBound && room.ExpireTime.HasValue)
     {
         expireLabel.Visible = true;
         expireTimeLabel.Visible = true;
         expireTimeLabel.Text = room.ExpireTime.Value.ToString();
     }
     nameTextBox.ReadOnly = true;
     var admin = ((int)currentUser.RoleMask & (int)UserRole.Administrator) != 0;
     if (!admin && owner != currentUser)
     {
         //nameTextBox.ReadOnly = true;
         descriptionRichTextBox.ReadOnly = true;
         greetingRichTextBox.ReadOnly = true;
         passwordTextBox.ReadOnly = true;
         passwordConfirmationTextBox.ReadOnly = true;
     }
 }
Example #5
0
 public int CreateRoom(Room room)
 {
     QueueRequest(new ChatRequest(RequestCode.CreateRoom, new List<object> { room }));
     return 0;
 }
 public int CreateRoom(Room room)
 {
     return chatSender.CreateRoom(room);
 }