private async void btn_create_Click(object sender, RoutedEventArgs e) { FormCreateRoom form = new FormCreateRoom(); form.ShowDialog(); if (form.status) { RoomRequest request = new RoomRequest(); request.outlet_id = Int32.Parse(outletid); request.room_name = form.Get_Roomname(); request.max_beds = form.Get_maxbed(); request.r_type = form.Get_RoomTypeID(); progress_bar.Visibility = Visibility.Visible; bool result = await RestAPI.CreateRoom(request); progress_bar.Visibility = Visibility.Collapsed; if (result) { if (send != null) { send.Invoke(outletid); } MessageBox.Show("Create Room Successful"); } else { MessageBox.Show("Create Room Fail"); } } }
private void tButCreateGroup_Click(object sender, EventArgs e) { if (frmCreateGroup == null || frmCreateGroup.IsDisposed) { frmCreateGroup = new FormCreateRoom(MyAuth.UserID,MyAuth.UserName, true); frmCreateGroup.CreateRoom += delegate(object senders, exRoom room) { ChangeRoom changeRoom = new ChangeRoom(); changeRoom.type = type.New;//标明是新建群 changeRoom.RoomID = room.RoomID; changeRoom.RoomName = room.RoomName; changeRoom.UserIDs = room.UserIDs; changeRoom.Notice = room.Notice; SendMessageToServer(changeRoom); //发送消息到服务器,创建群组 }; } frmCreateGroup.Show(); frmCreateGroup.Activate(); }