public void ShowException(Exception ex, Action <AlertAction> onClose = null) { _title = ex.GetType().Name; _body = Layout.Vertical(Typography.P(ex.Message), new CollapsablePanel("Stack Trace", Typography.Code(ex.StackTrace))); _actions.Add(AlertAction.Ok); Show(onClose); }
public async Task <object> Render() { Container?.RemoveClass("blade-hidden"); try { var dc = new DumpContainer(); var buttons = new List <Control>(); if (Index != -1) { buttons.Add(new IconButton(Icons.Refresh, (_) => { Manager.PopTo(Index, true); }, theme: Theme.PrimaryAlternate)); } if (Index == 0 && Manager.ShowDebugButton) { buttons.Add(new IconButton(Icons.Duck, (_) => { Manager.DebugHtml(); }, theme: Theme.PrimaryAlternate)); } if (Index != 0) { buttons.Add(new IconButton(Icons.Close, (_) => { if (Index == -1) { Manager.CloseSideBlade(false); } else { Manager.PopTo(Index - 1, false); } }, theme: Theme.PrimaryAlternate)); } _titleH1 = Element("h1", null, string.IsNullOrEmpty(Title) ? " " : Title); var div = Div("blade-panel", Div("blade-header", _titleH1, Element("aside", null, buttons.ToArray()) ), Div("blade-content", dc) ); await ControlExtensions.AddPadding(dc, Renderer.Render(this)); return(div); } catch (Exception ex) { return(Layout.Padding(true).Vertical( Typography.H2(ex.GetType().Name), Typography.P(ex.Message), new CollapsablePanel("Stack Trace", Typography.Code(ex.StackTrace)))); } }