Fix DM Spacing Issue

Fix Add Contact Button Not Showing On Other Users If You Have A Contact
This commit is contained in:
Alan Moon 2025-06-21 10:40:42 -07:00
parent b502b47a39
commit f772058b1d
2 changed files with 12 additions and 4 deletions

View File

@ -69,8 +69,8 @@ namespace qtc_net_client_2.Forms
if (!string.IsNullOrEmpty(rtxtChatbox.Text))
{
await _gatewayService.SendDirectMessageAsync(User, new QtCNETAPI.Models.Message { Content = rtxtChatbox.Text, AuthorId = _apiService.CurrentUser.Id });
Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}\n");
rtxtChatbox.Clear();
BeginInvoke(delegate () { Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}\n"); });
BeginInvoke(delegate () { rtxtChatbox.Clear(); });
AudioService.PlaySoundEffect("sndSendClick");
}
}
@ -92,14 +92,14 @@ namespace qtc_net_client_2.Forms
Invoke(delegate ()
{
var msg = e.NewItems.Cast<string>().FirstOrDefault();
rtxtChat.AppendText(msg + Environment.NewLine);
rtxtChat.AppendText(msg);
if (!msg!.Contains(_apiService.CurrentUser.Username)) AudioService.PlaySoundEffect("sndMessage");
});
}
else
{
var msg = e.NewItems.Cast<string>().FirstOrDefault();
rtxtChat.AppendText(msg + Environment.NewLine);
rtxtChat.AppendText(msg);
if (!msg!.Contains(_apiService.CurrentUser.Username)) AudioService.PlaySoundEffect("sndMessage");
}
}

View File

@ -68,6 +68,7 @@ namespace qtc_net_client_2.Forms
btnMessage.Visible = false;
return; // do not run contact getting code
}
else btnAddContact.Visible = true;
var contactsResult = await _apiService.GetCurrentUserContacts();
if (contactsResult.Success && contactsResult.Data != null)
@ -87,6 +88,7 @@ namespace qtc_net_client_2.Forms
btnCancelRequest.Visible = true;
break;
case Contact.ContactStatus.Accepted:
btnAddContact.Visible = true;
btnAddContact.Enabled = true;
btnAddContact.Image = Resources.RemoveContactIcon;
btnAddContact.Click += btnAddContact_Click_Remove;
@ -112,6 +114,7 @@ namespace qtc_net_client_2.Forms
btnCancelRequest.Visible = false;
btnAddContact.Visible = true;
btnAddContact.Enabled = true;
btnAddContact.Image = Resources.RemoveContactIcon;
btnAddContact.Click += btnAddContact_Click_Remove;
if (_userInformationDto.Status >= 1) btnMessage.Visible = true;
@ -119,6 +122,11 @@ namespace qtc_net_client_2.Forms
}
}
}
else
{
btnAddContact.Visible = true;
btnAddContact.Click += btnAddContact_Click_Add;
}
}
else
{