Ejemplo n.º 1
0
		public bool TryGetInfo(IViewController controller, out IPresentInfo info)
		{
			if (_controllerMap.TryGetValue(controller, out var result))
			{
				info = result;
				return true;
			}

			info = null;
			return false;
		}
Ejemplo n.º 2
0
        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}.");
            }
        }
Ejemplo n.º 3
0
 /// <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;
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PresentException"/> class.
 /// </summary>
 public PresentException(IPresentInfo presentInfo)
     : base(GetMessage(presentInfo, null))
 {
     _controllerType = presentInfo.ControllerType;
 }
Ejemplo n.º 6
0
 /// <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;
 }