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