PWA Fundvelo der Caritas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OnlineStatusIndicator.razor 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. @using cwebplusApp.Shared.Services;
  2. @implements IDisposable;
  3. @inject OnlineStatusProvider OnlineStatusProvider;
  4. <div class="row no-gutters w-100 justify-content-end" style="position: absolute;">
  5. @if (isOffline) {
  6. <MatIcon Style="padding-right:0.5rem">
  7. <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
  8. <path d="M0 0h24v24H0V0z" fill="none" />
  9. <path d="M21 11l2-2c-3.73-3.73-8.87-5.15-13.7-4.31l2.58 2.58c3.3-.02 6.61 1.22 9.12 3.73zm-2 2c-1.08-1.08-2.36-1.85-3.72-2.33l3.02 3.02.7-.69zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zM3.41 1.64L2 3.05 5.05 6.1C3.59 6.83 2.22 7.79 1 9l2 2c1.23-1.23 2.65-2.16 4.17-2.78l2.24 2.24C7.79 10.89 6.27 11.74 5 13l2 2c1.35-1.35 3.11-2.04 4.89-2.06l7.08 7.08 1.41-1.41L3.41 1.64z" />
  10. </svg>
  11. </MatIcon>
  12. }
  13. </div>
  14. @code {
  15. private bool isOffline;
  16. public void Dispose() {
  17. OnlineStatusProvider.RemoveOnlineStatusChangeCallBack(OnOnlineStatusChanged);
  18. }
  19. protected override void OnInitialized() {
  20. base.OnInitialized();
  21. OnlineStatusProvider.AddOnlineStatusChangeCallBack(OnOnlineStatusChanged);
  22. OnOnlineStatusChanged(OnlineStatusProvider.Online);
  23. }
  24. private void OnOnlineStatusChanged(bool isOnline) {
  25. this.isOffline = !isOnline;
  26. StateHasChanged();
  27. }
  28. }