public async Task LoadUsers() { try { Users = new BindingList <UserModel>(await _userEndPoint.GetAll()); } catch (Exception ex) { dynamic settings = new ExpandoObject(); settings.WindowStartupLocation = WindowStartupLocation.CenterOwner; settings.ResizeMode = ResizeMode.NoResize; settings.Title = "Authorization Failed"; StatusInfoViewModel status = new StatusInfoViewModel(); if (ex.Message == "Unauthorized") { status.UpdateMessage("Unauthorized Access!!", "You do not have permission to access the Sales Screen."); } else { status.UpdateMessage("Fatal Error", ex.Message); } await _windowManager.ShowDialogAsync(status, null, settings); await TryCloseAsync(); } }
protected override async void OnViewLoaded(object view) { base.OnViewLoaded(view); try { await LoadProducts(); } catch (System.Exception ex) { dynamic settings = new ExpandoObject(); settings.WindowStartUpLocation = WindowStartupLocation.CenterOwner; settings.ResizeMode = ResizeMode.NoResize; settings.Title = "System Error"; if (ex.Message == "Unauthorized") { _status.UpdateMessage("Unauthorized Access", "You don't have permissions to interact SalesView Form"); _window.ShowDialog(_status, null, settings); } else { _status.UpdateMessage("Fatal Exceprion", ex.Message); _window.ShowDialog(_status, null, settings); } TryClose(); } }
protected override async void OnViewLoaded(object view) { base.OnViewLoaded(view); try { await LoadUsers(); } catch (Exception ex) { dynamic setting = new ExpandoObject(); setting.WindowStartupLocation = WindowStartupLocation.CenterOwner; setting.ResizeMode = ResizeMode.NoResize; setting.Title = "System Error"; if (ex.Message == "Unauthorized") { _status.UpdateMessage("Unauthorize Access", "You don't have permision"); await _window.ShowDialogAsync(_status, null, setting); } else { _status.UpdateMessage("Fatal", ex.Message); await _window.ShowDialogAsync(_status, null, setting); } TryCloseAsync(); } }
protected override async void OnViewLoaded(object view) { base.OnViewLoaded(view); try { await LoadUsers(); } catch (System.Exception ex) { dynamic settings = new ExpandoObject(); settings.WindowStartupLocation = WindowStartupLocation.CenterOwner; settings.Resize = ResizeMode.NoResize; settings.Title = "System Error"; if (ex.Message == "Unauthorized") { status.UpdateMessage("Unaothorized Access", "You do not have permission to interact with the sales form"); await window.ShowDialogAsync(status, null, settings); } else { status.UpdateMessage("Fatal Exception", ex.Message); await window.ShowDialogAsync(status, null, settings); } await TryCloseAsync(); } }