Esempio n. 1
0
        private async Task EditAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await WorkstationService.ApproveWorkstationAsync(Workstation);
                    await RemoteWorkstationConnectionsService.UpdateRfidStateAsync(Workstation.Id, Workstation.RFID);
                    await ToastService.ShowToastAsync("Workstation updated.", ToastType.Success);
                    await SynchronizationService.UpdateWorkstations(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
        public async Task DeleteAsync()
        {
            try
            {
                await WorkstationService.DeleteWorkstationAsync(Workstation.Id);

                await RemoteWorkstationConnectionsService.UpdateWorkstationApprovedAsync(Workstation.Id, isApproved : false);

                await ToastService.ShowToastAsync("Workstation deleted.", ToastType.Success);

                await SynchronizationService.UpdateWorkstations(ExceptPageId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                await ModalDialogService.CancelAsync();

                Logger.LogError(ex.Message, ex);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
        }