2025-01-18 20:25:39 -06:00
|
|
|
@implements IDisposable
|
|
|
|
|
@inject KeepAliveService KeepAliveService
|
|
|
|
|
@inject IMessageService MessageService
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2025-01-18 20:25:39 -06:00
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
string ConnectionMessageKey = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
KeepAliveService.ConnectionSevered += OnConnectionSevered;
|
2025-06-16 01:36:39 +02:00
|
|
|
KeepAliveService.ConnectionRetryNext += OnConnectionRetryNext;
|
2025-01-18 20:25:39 -06:00
|
|
|
KeepAliveService.ConnectionLostPermanently += OnConnectionLostPermanently;
|
|
|
|
|
KeepAliveService.ConnectionEstablished += OnConnectionEstablished;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnConnectionSevered(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var messageConfig = new MessageConfig
|
|
|
|
|
{
|
|
|
|
|
Key = ConnectionMessageKey,
|
|
|
|
|
Type = MessageType.Loading,
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Content = LocalizationService.GetString("LostConnectionRetrying"),
|
2025-01-18 20:25:39 -06:00
|
|
|
Duration = 0,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MessageService.Open(messageConfig);
|
|
|
|
|
}
|
2025-06-16 01:36:39 +02:00
|
|
|
|
|
|
|
|
void OnConnectionRetryNext(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// show same lost-connection-message by replacing the message by its key
|
|
|
|
|
var retry = KeepAliveService.GetRetryCount();
|
|
|
|
|
var messageConfig = new MessageConfig
|
|
|
|
|
{
|
|
|
|
|
Key = ConnectionMessageKey,
|
|
|
|
|
Type = MessageType.Loading,
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Content = LocalizationService.GetString("LostConnectionRetryingWithCount", retry.current, retry.total),
|
2025-06-16 01:36:39 +02:00
|
|
|
Duration = 0,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MessageService.Open(messageConfig);
|
|
|
|
|
}
|
2025-01-18 20:25:39 -06:00
|
|
|
|
|
|
|
|
void OnConnectionLostPermanently(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var messageConfig = new MessageConfig
|
|
|
|
|
{
|
|
|
|
|
Key = ConnectionMessageKey,
|
|
|
|
|
Type = MessageType.Error,
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Content = LocalizationService.GetString("ServerUnavailableEnablingOfflineMode"),
|
2025-01-18 20:25:39 -06:00
|
|
|
Duration = 2.5,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MessageService.Open(messageConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnConnectionEstablished(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var messageConfig = new MessageConfig
|
|
|
|
|
{
|
|
|
|
|
Key = ConnectionMessageKey,
|
|
|
|
|
Type = MessageType.Success,
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Content = LocalizationService.GetString("ConnectionEstablished"),
|
2025-01-18 20:25:39 -06:00
|
|
|
Duration = 2.5,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MessageService.Open(messageConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
KeepAliveService.ConnectionSevered -= OnConnectionSevered;
|
2025-06-16 01:36:39 +02:00
|
|
|
KeepAliveService.ConnectionRetryNext -= OnConnectionRetryNext;
|
2025-01-18 20:25:39 -06:00
|
|
|
KeepAliveService.ConnectionLostPermanently -= OnConnectionLostPermanently;
|
|
|
|
|
KeepAliveService.ConnectionEstablished -= OnConnectionEstablished;
|
|
|
|
|
}
|
|
|
|
|
}
|