Пример #1
0
        private Func <BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();

            switch (count)
            {
            case 1:
                var chain = candidates.Single();
                return(() => chain);

            case 0:
                return(() =>
                {
                    throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                });

            default:
                var message = "More than one behavior chain matching criteria:  " + search;
                message += "\nMatches:";

                candidates.Each(x =>
                {
                    message += "\n" + x;
                });

                return(() =>
                {
                    throw new FubuException(2108, message);
                });
            }
        }
Пример #2
0
        private Func<BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();
            switch (count)
            {
                case 1:
                    var chain = candidates.Single();
                    return () => chain;

                case 0:
                    return () =>
                    {
                        throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                    };

                default:
                    var message = "More than one behavior chain matching criteria:  " + search;
                    message += "\nMatches:";

                    candidates.Each(x =>
                    {
                        message += "\n" + x;
                    });

                    return () =>
                    {
                        throw new FubuException(2108, message);
                    };
            }
        }
Пример #3
0
        private Func <BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();

            switch (count)
            {
            case 1:
                var chain = candidates.Single();
                return(() => chain);

            case 0:
                return(() =>
                {
                    throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                });

            default:
                var message = "More than one behavior chain matching criteria:  " + search;
                message += "\nMatches:";

                candidates.Each(x =>
                {
                    // TODO -- BehaviorChain needs a Description or a better ToString()

                    var description = "\n";
                    if (x.Route != null)
                    {
                        description += x.Route.Pattern + "  ";
                    }

                    if (x.FirstCall() != null)
                    {
                        description += " -- " + x.FirstCall().Description;
                    }

                    message += description;
                });

                return(() =>
                {
                    throw new FubuException(2108, message);
                });
            }
        }
Пример #4
0
        private Func<BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();
            switch (count)
            {
                case 1:
                    var chain = candidates.Single();
                    return () => chain;

                case 0:
                    return () =>
                    {
                        throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                    };

                default:
                    var message = "More than one behavior chain matching criteria:  " + search;
                    message += "\nMatches:";

                    candidates.Each(x =>
                    {
                        // TODO -- BehaviorChain needs a Description or a better ToString()

                        var description = "\n";
                        if (x.Route != null)
                        {
                            description += x.Route.Pattern + "  ";
                        }

                        if (x.FirstCall() != null)
                        {
                            description += " -- " + x.FirstCall().Description;
                        }

                        message += description;
                    });

                    return () =>
                    {
                        throw new FubuException(2108, message);
                    };
            }
        }