Example #1
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                SharedAccountService           = ScopedServices.GetRequiredService <ISharedAccountService>();
                RemoteDeviceConnectionsService = ScopedServices.GetRequiredService <IRemoteDeviceConnectionsService>();

                ModalDialogService.OnCancel += OnCancelAsync;

                Account = await SharedAccountService.GetSharedAccountByIdAsync(AccountId);

                if (Account == null)
                {
                    throw new Exception("Account not found");
                }

                EntityBeingEdited = MemoryCache.TryGetValue(Account.Id, out object _);
                if (!EntityBeingEdited)
                {
                    MemoryCache.Set(Account.Id, Account);
                }

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }