public bool TryGetInfo(IViewController controller, out IPresentInfo info) { if (_controllerMap.TryGetValue(controller, out var result)) { info = result; return true; } info = null; return false; }
private static string GetMessage(IPresentInfo controllerInfo, string message) { if (controllerInfo is null) { throw new ArgumentNullException(nameof(controllerInfo)); } if (string.IsNullOrEmpty(message)) { return($"Failed to present controller {controllerInfo.ControllerType.Name}."); } else { return($"Failed to present controller {controllerInfo.ControllerType.Name}: {message}."); } }
/// <summary> /// Initializes a new instance of the <see cref="PresentException"/> class. /// </summary> public PresentException(IPresentInfo controllerInfo, Exception innerException) : base(GetMessage(controllerInfo, null), innerException) { _controllerType = controllerInfo.ControllerType; }
/// <summary> /// Initializes a new instance of the <see cref="PresentException"/> class. /// </summary> public PresentException(IPresentInfo controllerInfo, string message) : base(GetMessage(controllerInfo, message)) { _controllerType = controllerInfo.ControllerType; }
/// <summary> /// Initializes a new instance of the <see cref="PresentException"/> class. /// </summary> public PresentException(IPresentInfo presentInfo) : base(GetMessage(presentInfo, null)) { _controllerType = presentInfo.ControllerType; }
/// <summary> /// Initializes a new instance of the <see cref="PresentCompletedEventArgs"/> class. /// </summary> public PresentCompletedEventArgs(IPresentInfo controllerInfo, Exception error, bool cancelled) : base(error, cancelled || error is OperationCanceledException, controllerInfo) { PresentInfo = controllerInfo; }