Show Notification When User Receives Contact Request (replaces label)

Add Logging
This commit is contained in:
Alan Moon 2025-12-14 13:59:11 -08:00
parent f154e937d8
commit bdbf685604

View File

@ -89,9 +89,12 @@ namespace qtcnet_client
private async void MainForm_Load(object sender, EventArgs e)
{
_loggingService.LogString("Checking For Updates...");
// first check for updates
await _updateService.CheckForUpdatesAsync();
_loggingService.LogString("Building Login UI...");
SuspendLayout();
Size = LoggedOutSize;
@ -651,6 +654,7 @@ namespace qtcnet_client
{
if (dto != null)
{
_loggingService.LogString("Logging In Using Info...");
// attempt login using dto
var res = await _apiService.LoginAsync(dto);
@ -667,6 +671,7 @@ namespace qtcnet_client
}
else
{
_loggingService.LogString("Logging In Using Refresh Token...");
// use refresh token
var _token = _credentialService.GetAccessToken();
if (_token != null)
@ -679,6 +684,7 @@ namespace qtcnet_client
if (_apiService.CurrentUser != null)
{
_loggingService.LogString("Logged In! Starting Up...");
// pause ui
SuspendLayout();
@ -708,12 +714,14 @@ namespace qtcnet_client
_gatewayService.OnServerConfigReceived += _gatewayService_OnServerConfigReceived;
_gatewayService.OnUserForceLogout += _gatewayService_OnUserForceLogout;
_loggingService.LogString("Starting Gateway Connection...");
// start connection
await _gatewayService.StartAsync();
var _res = _gatewayService.HubConnection != null && _gatewayService.HubConnection.State == Microsoft.AspNetCore.SignalR.Client.HubConnectionState.Connected;
if (_res)
{
_loggingService.LogString("Connected To Gateway");
// setup current profile control based on current user
CurrentProfileControl = new()
{
@ -741,6 +749,7 @@ namespace qtcnet_client
MainTabControl.OnStoreItemDoubleClicked += MainTabControl_OnStoreItemDoubleClicked;
MainTabControl.OnGameItemDoubleClicked += MainTabControl_OnGameItemDoubleClicked;
_loggingService.LogString("Loading Contacts...");
// get and set contacts
var _currentUserContacts = await _apiService.GetCurrentUserContacts();
if (_currentUserContacts.Success && _currentUserContacts.Data != null)
@ -750,16 +759,19 @@ namespace qtcnet_client
await SetupContactsUI(_currentUserContacts.Data);
}
_loggingService.LogString("Loading Rooms...");
// get and set rooms
var _roomList = await _apiService.GetAllRoomsAsync();
if (_roomList.Success && _roomList.Data != null)
await SetupRoomsUI(_roomList.Data);
_loggingService.LogString("Loading User Directory...");
// get and set user directory
var _currentUserDirectory = await _apiService.GetAllUsersAsync();
if (_currentUserDirectory.Success && _currentUserDirectory.Data != null)
await SetupDirectoryUI(_currentUserDirectory.Data);
_loggingService.LogString("Loading Store...");
// get and set store
var _currentStore = await _apiService.GetStoreItems();
if (_currentStore.Success && _currentStore.Data != null)
@ -1158,6 +1170,10 @@ namespace qtcnet_client
{
case Contact.ContactStatus.AwaitingApprovalFromSelf:
ctrl.Username = $"{user.Data.Username} [Contact Request]";
niMain.ShowBalloonTip(5,
"New Contact Request!",
$"You have a new contact request from {user.Data.Username}!",
ToolTipIcon.Info);
_audioService.PlaySoundEffect("sndContactRequest");
break;
case Contact.ContactStatus.Accepted: