Esempio n. 1
0
        private static void ThrowExceptionsForViewsWithNoPresenterBound(PresenterDiscoveryResult result)
        {
            if (result.Bindings.Empty() && result.ViewInstances.Where(v => v.ThrowExceptionIfNoPresenterBound).Any())

                throw new InvalidOperationException(string.Format(
                    CultureInfo.InvariantCulture,
                    @"Failed to find presenter for view instance of {0}.{1} If you do not want this exception to be thrown, set ThrowExceptionIfNoPresenterBound to false on your view.",
                    result.ViewInstances.Where(v => v.ThrowExceptionIfNoPresenterBound).Single().GetType().FullName,
                    result.Message
                    ));
        }
Esempio n. 2
0
        private static string BuildTraceMessagesForBindings(IPresenterDiscoveryStrategy presenterDiscoveryStrategy,
            PresenterDiscoveryResult result)
        {
            var strategyName = presenterDiscoveryStrategy.GetType().FullName;

            return string.Format(
                CultureInfo.InvariantCulture,
                @"Found a presenter binding for {0} using {1}.{2}{3}",
                string.Join(", ", result.ViewInstances.Select(v => v.GetType().FullName).ToArray()),
                strategyName,
                string.Format("{0}{0}{1}{0}", Environment.NewLine, result.Message),
                string.Format("{0}{1}", Environment.NewLine,
                    string.Join(Environment.NewLine,
                        result.Bindings.Select(b => string.Format(CultureInfo.InvariantCulture,
                            @"Presenter type: {0} {1}View type: {2}",
                            b.PresenterType.FullName,
                            Environment.NewLine,
                            b.ViewType.FullName
                            )).ToArray()
                        ))
                );
        }