1using CommunityToolkit.Mvvm.ComponentModel;
22 this.ConnectionStateColor =
new SolidColorBrush(Colors.Red);
23 this.StateSummaryText =
string.Empty;
29 await base.OnInitialize();
38 await base.OnDispose();
47 private string connectionStateText;
53 private Brush connectionStateColor;
59 private string stateSummaryText;
65 private bool isConnected;
75 this.ConnectionStateText = State.ToDisplayText();
76 this.ConnectionStateColor =
new SolidColorBrush(State.ToColor());
77 this.IsConnected = State ==
XmppState.Connected;
78 this.StateSummaryText = (
ServiceRef.
TagProfile.LegalIdentity?.State)?.ToString() +
" - " + this.ConnectionStateText;
88 if (MainThread.IsMainThread)
91 return Task.CompletedTask;
95 return MainThread.InvokeOnMainThreadAsync(() =>
Base class that references services in the app.
static ITagProfile TagProfile
TAG Profile service.
static IStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
A view model that holds the XMPP state.
override async Task OnInitialize()
Method called when view is initialized for the first time. Use this method to implement registration ...
XmppViewModel()
Creates an instance of a XmppViewModel.
override async Task OnDispose()
Method called when the view is disposed, and will not be used more. Use this method to unregister eve...
virtual void SetConnectionStateAndText(XmppState State)
Sets both the connection state and connection text to the appropriate value.
virtual Task XmppService_ConnectionStateChanged(object? _, XmppState NewState)
Listens to connection state changes from the XMPP server.
XmppState
State of XMPP connection.