示例#1
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, AudioSource source)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clip  = source.clip,
                    pitch = source.pitch,
                };
            }

            var defaults = Defaults[key];

            if (soundDefinition == null)
            {
                source.clip  = defaults.clip;
                source.pitch = defaults.pitch;
                return;
            }

            source.clip  = soundDefinition.filename.Map(FileAudio.Load) ?? defaults.clip;
            source.pitch = soundDefinition.pitch ?? defaults.pitch;
        }
示例#2
0
        partial void ResolveGenerated(ref object service,
                                      Type serviceType, object serviceKey, Type requiredServiceType, Request preRequestParent, object[] args)
        {
            if (serviceType == typeof(IocPerformance.Classes.Conditions.IExportConditionInterface))
            {
                if ((serviceKey == null || DefaultKey.Of(1).Equals(serviceKey)) &&
                    requiredServiceType == null &&
                    Equals(preRequestParent, Request.Empty.Push(typeof(IocPerformance.Classes.Conditions.ImportConditionObject2), default(System.Type), (object)null, 68, FactoryType.Service, typeof(IocPerformance.Classes.Conditions.ImportConditionObject2), Reuse.Transient, RequestFlags.IsResolutionCall)))
                {
                    service = GetDep0_IExportConditionInterface(this);
                }

                else
                if ((serviceKey == null || DefaultKey.Of(0).Equals(serviceKey)) &&
                    requiredServiceType == null &&
                    Equals(preRequestParent, Request.Empty.Push(typeof(IocPerformance.Classes.Conditions.ImportConditionObject1), default(System.Type), (object)null, 67, FactoryType.Service, typeof(IocPerformance.Classes.Conditions.ImportConditionObject1), Reuse.Transient, RequestFlags.IsResolutionCall)))
                {
                    service = GetDep1_IExportConditionInterface(this);
                }

                else
                if ((serviceKey == null || DefaultKey.Of(2).Equals(serviceKey)) &&
                    requiredServiceType == null &&
                    Equals(preRequestParent, Request.Empty.Push(typeof(IocPerformance.Classes.Conditions.ImportConditionObject3), default(System.Type), (object)null, 69, FactoryType.Service, typeof(IocPerformance.Classes.Conditions.ImportConditionObject3), Reuse.Transient, RequestFlags.IsResolutionCall)))
                {
                    service = GetDep2_IExportConditionInterface(this);
                }
            }
        }
示例#3
0
    public void Example()
    {
        var container = new Container();

        container.Register <I, X>();
        container.Register <I, Y>();
        container.Register <I, Z>(serviceKey: "z");

        // use an `object` key to get all of the registrations
        var items = container.Resolve <KeyValuePair <object, I>[]>();

        // the keys of resolved items
        CollectionAssert.AreEqual(
            new object[] { DefaultKey.Of(0), DefaultKey.Of(1), "z" },
            items.Select(x => x.Key));

        // you may get only services with default keys
        var defaultItems = container.Resolve <KeyValuePair <DefaultKey, I>[]>();

        Assert.AreEqual(2, defaultItems.Length);

        // or the one with string key
        var z = container.Resolve <KeyValuePair <string, I>[]>().Single().Value;

        Assert.IsInstanceOf <Z>(z);
    }
示例#4
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, ref AudioClip[] clips)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clips = clips
                }
            }
            ;

            if (soundDefinition != null && (soundDefinition.filenames?.Length ?? 0) > 0)
            {
                clips = soundDefinition.filenames.Select(FileAudio.Load).ToArray();
            }
            else if (soundDefinition?.filename != null)
            {
                clips = new AudioClip[] { FileAudio.Load(soundDefinition.filename) }
            }
            ;
            else
            {
                clips = Defaults[key].clips !;
            }
        }
示例#5
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, LayeredAudio audio)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            var mainLayer = audio.layers[0];

            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clip        = mainLayer.source.clip,
                    pitch       = mainLayer.startPitch,
                    minPitch    = audio.minPitch,
                    maxPitch    = audio.maxPitch,
                    pitchCurve  = mainLayer.pitchCurve,
                    volumeCurve = mainLayer.volumeCurve,
                };
                Main.DebugLog(() => $"Saved default settings for {key}: {Defaults[key]}");
            }

            var defaults = Defaults[key];

            if (soundDefinition == null)
            {
                audio.minPitch        = defaults.minPitch !;
                audio.maxPitch        = defaults.maxPitch !;
                mainLayer.source.clip = defaults.clip;
                mainLayer.startPitch  = defaults.pitch;
                mainLayer.pitchCurve  = defaults.pitchCurve;
                mainLayer.volumeCurve = defaults.volumeCurve;
                for (int i = 1; i < audio.layers.Length; i++)
                {
                    audio.layers[i].source.mute = false;
                }
            }
            else
            {
                audio.minPitch        = soundDefinition.minPitch ?? defaults.minPitch * defaults.pitch;
                audio.maxPitch        = soundDefinition.maxPitch ?? defaults.maxPitch * defaults.pitch;
                mainLayer.source.clip = soundDefinition.filename.Map(FileAudio.Load) ?? defaults.clip;
                mainLayer.startPitch  = 1f;
                mainLayer.pitchCurve  = AnimationCurve.EaseInOut(
                    0f, soundDefinition.minPitch ?? defaults.pitchCurve.Evaluate(0),
                    1f, soundDefinition.maxPitch ?? defaults.pitchCurve.Evaluate(1));
                mainLayer.volumeCurve = AnimationCurve.EaseInOut(
                    0f, soundDefinition.minVolume ?? defaults.volumeCurve.Evaluate(0),
                    1f, soundDefinition.maxVolume ?? defaults.volumeCurve.Evaluate(1));

                for (int i = 1; i < audio.layers.Length; i++)
                {
                    audio.layers[i].source.mute = true;
                }
            }
        }
        partial void ResolveGenerated(ref object service,
                                      Type serviceType, object serviceKey, Type requiredServiceType, Request preRequestParent, object[] args)
        {
            if (serviceType == typeof(Prism.Navigation.INavigationService))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get13_INavigationService(this);
                }

                else
                if ("PageNavigationService".Equals(serviceKey))
                {
                    service = Get14_INavigationService(this);
                }
            }

            else
            if (serviceType == typeof(object))
            {
                if ("NavigationPage".Equals(serviceKey))
                {
                    service = Get17_Object(this);
                }

                else
                if ("SecondPage".Equals(serviceKey))
                {
                    service = Get18_Object(this);
                }

                else
                if ("MainPage".Equals(serviceKey))
                {
                    service = Get19_Object(this);
                }
            }
        }
示例#7
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, ref AudioClip clip)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clip = clip
                }
            }
            ;

            if (soundDefinition?.filename != null)
            {
                clip = FileAudio.Load(soundDefinition.filename);
            }
            else
            {
                clip = Defaults[key].clip !;
            }
        }
 public IKey CreateFromString(string key) => DefaultKey.FromString(key);
示例#9
0
 /// <summary>
 /// Gets a value from the local storage.
 /// </summary>
 /// <param name="defaultKey">Which key to retrieve.</param>
 /// <param name="defaultValue">Default value if not found</param>
 /// <returns>The value corresponding to the key; the default value if not found.</returns>
 protected static float GetValueFromLocalStorage(DefaultKey defaultKey, float defaultValue)
 {
     return(PlayerPrefs.GetFloat(defaultKey.ToString(), defaultValue));
 }
 // typeof(MediatR.INotificationHandler<MediatR.Examples.Pinged>)
 internal static object Get19_INotificationHandler(IResolverContext r)
 {
     return(new MediatR.Examples.PingedAlsoHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.INotificationHandler <MediatR.Examples.Pinged>), default(System.Type), (object)DefaultKey.Of(1), 43, FactoryType.Service, typeof(MediatR.Examples.PingedAlsoHandler), Reuse.Transient, RequestFlags.IsResolutionCall), default(object[]))));
 }
 // typeof(MediatR.IPipelineBehavior<MediatR.Examples.Jing, MediatR.Unit>)
 internal static object Get13_IPipelineBehavior(IResolverContext r)
 {
     return(new MediatR.Examples.GenericPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IPipelineBehavior <,>), (object)DefaultKey.Of(2), 58, FactoryType.Service, typeof(MediatR.Examples.GenericPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall), default(object[]))));
 }
 // typeof(MediatR.IPipelineBehavior<MediatR.Examples.Jing, MediatR.Unit>)
 internal static object Get11_IPipelineBehavior(IResolverContext r)
 {
     return(new MediatR.Pipeline.RequestPreProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>(new MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing>[] { new MediatR.Examples.GenericRequestPreProcessor <MediatR.Examples.Jing>((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>), typeof(MediatR.IPipelineBehavior <,>), (object)DefaultKey.Of(1), 55, FactoryType.Service, typeof(MediatR.Pipeline.RequestPreProcessorBehavior <MediatR.Examples.Jing, MediatR.Unit>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.Pipeline.IRequestPreProcessor <MediatR.Examples.Jing>), default(System.Type), (object)DefaultKey.Of(0), IfUnresolved.ReturnDefaultIfNotRegistered, 56, FactoryType.Service, typeof(MediatR.Examples.GenericRequestPreProcessor <MediatR.Examples.Jing>), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) }));
 }
        private IEnumerable <ResolveManyResult> ResolveManyGenerated(Type serviceType)
        {
            if (serviceType == typeof(MediatR.IRequestHandler <MediatR.Examples.Jing>))
            {
                yield return(Of(Get0_IRequestHandler));
            }

            if (serviceType == typeof(MediatR.IMediator))
            {
                yield return(Of(Get1_IMediator));
            }

            if (serviceType == typeof(MediatR.INotification))
            {
                yield return(Of(Get2_INotification, DefaultKey.Of(0)));

                yield return(Of(Get3_INotification, DefaultKey.Of(1)));
            }

            if (serviceType == typeof(MediatR.IRequestHandler <MediatR.Examples.Ping, MediatR.Examples.Pong>))
            {
                yield return(Of(Get4_IRequestHandler));
            }

            if (serviceType == typeof(MediatR.IRequest <MediatR.Examples.Pong>))
            {
                yield return(Of(Get5_IRequest));
            }

            if (serviceType == typeof(MediatR.INotificationHandler <MediatR.Examples.Ponged>))
            {
                yield return(Of(Get6_INotificationHandler));

                yield return(Of(Get7_INotificationHandler)); // co-variant
            }

            if (serviceType == typeof(MediatR.INotificationHandler <MediatR.INotification>))
            {
                yield return(Of(Get7_INotificationHandler));
            }

            if (serviceType == typeof(MediatR.IPipelineBehavior <MediatR.Examples.Ping, MediatR.Examples.Pong>))
            {
                yield return(Of(Get8_IPipelineBehavior, DefaultKey.Of(0), typeof(MediatR.IPipelineBehavior <,>)));

                yield return(Of(Get10_IPipelineBehavior, DefaultKey.Of(1), typeof(MediatR.IPipelineBehavior <,>)));

                yield return(Of(Get12_IPipelineBehavior, DefaultKey.Of(2), typeof(MediatR.IPipelineBehavior <,>)));
            }

            if (serviceType == typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>))
            {
                yield return(Of(Get9_IPipelineBehavior, DefaultKey.Of(0), typeof(MediatR.IPipelineBehavior <,>)));

                yield return(Of(Get11_IPipelineBehavior, DefaultKey.Of(1), typeof(MediatR.IPipelineBehavior <,>)));

                yield return(Of(Get13_IPipelineBehavior, DefaultKey.Of(2), typeof(MediatR.IPipelineBehavior <,>)));
            }

            if (serviceType == typeof(MediatR.IBaseRequest))
            {
                yield return(Of(Get14_IBaseRequest, DefaultKey.Of(0)));

                yield return(Of(Get15_IBaseRequest, DefaultKey.Of(1)));
            }

            if (serviceType == typeof(MediatR.INotificationHandler <MediatR.Examples.Pinged>))
            {
                yield return(Of(Get16_INotificationHandler, typeof(MediatR.INotificationHandler <>)));

                yield return(Of(Get18_INotificationHandler, DefaultKey.Of(0)));

                yield return(Of(Get19_INotificationHandler, DefaultKey.Of(1)));

                yield return(Of(Get7_INotificationHandler)); // co-variant
            }

            if (serviceType == typeof(MediatR.IRequest))
            {
                yield return(Of(Get17_IRequest));
            }

            if (serviceType == typeof(MediatR.IRequest <MediatR.Unit>))
            {
                yield return(Of(Get20_IRequest));
            }
        }
        partial void ResolveGenerated(ref object service,
                                      Type serviceType, object serviceKey, Type requiredServiceType, Request preRequestParent, object[] args)
        {
            if (serviceType == typeof(MediatR.INotification))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get2_INotification(this);
                }

                else
                if (DefaultKey.Of(1).Equals(serviceKey))
                {
                    service = Get3_INotification(this);
                }
            }

            else
            if (serviceType == typeof(MediatR.IPipelineBehavior <MediatR.Examples.Ping, MediatR.Examples.Pong>))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get8_IPipelineBehavior(this);
                }

                else
                if (DefaultKey.Of(1).Equals(serviceKey))
                {
                    service = Get10_IPipelineBehavior(this);
                }

                else
                if (DefaultKey.Of(2).Equals(serviceKey))
                {
                    service = Get12_IPipelineBehavior(this);
                }
            }

            else
            if (serviceType == typeof(MediatR.IPipelineBehavior <MediatR.Examples.Jing, MediatR.Unit>))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get9_IPipelineBehavior(this);
                }

                else
                if (DefaultKey.Of(1).Equals(serviceKey))
                {
                    service = Get11_IPipelineBehavior(this);
                }

                else
                if (DefaultKey.Of(2).Equals(serviceKey))
                {
                    service = Get13_IPipelineBehavior(this);
                }
            }

            else
            if (serviceType == typeof(MediatR.IBaseRequest))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get14_IBaseRequest(this);
                }

                else
                if (DefaultKey.Of(1).Equals(serviceKey))
                {
                    service = Get15_IBaseRequest(this);
                }
            }

            else
            if (serviceType == typeof(MediatR.INotificationHandler <MediatR.Examples.Pinged>))
            {
                if (DefaultKey.Of(0).Equals(serviceKey))
                {
                    service = Get18_INotificationHandler(this);
                }

                else
                if (DefaultKey.Of(1).Equals(serviceKey))
                {
                    service = Get19_INotificationHandler(this);
                }
            }
        }
示例#15
0
 /// <summary>
 /// Gets a value from the local storage.
 /// </summary>
 /// <param name="defaultKey">Which key to retrieve.</param>
 /// <param name="defaultValue">Default value if not found</param>
 /// <returns>The value corresponding to the key; the default value if not found.</returns>
 protected static string GetValueFromLocalStorage(DefaultKey defaultKey, string defaultValue)
 {
     return(PlayerPrefs.GetString(defaultKey.ToString(), defaultValue));
 }
示例#16
0
 /// <summary>
 /// Sets a value to the local storage.
 /// </summary>
 /// <param name="defaultKey">Which key to set.</param>
 /// <param name="value">The value to set.</param>
 protected static void SetValueToLocalStorage(DefaultKey defaultKey, float value)
 {
     PlayerPrefs.SetFloat(defaultKey.ToString(), value);
 }
        public override IPreingestCommand FactoryMethod(Guid guid, dynamic data)
        {
            if (data == null)
            {
                Logger.LogInformation("FactoryMethod :: {1} : {0}.", "Incoming data is empty", guid);
                return(null);
            }

            Plan[]            plans   = data.scheduledPlan == null ? null : JsonConvert.DeserializeObject <Plan[]>(data.scheduledPlan.ToString());
            PreingestAction[] actions = data.preingest == null ? null : JsonConvert.DeserializeObject <PreingestAction[]>(data.preingest.ToString());

            if (plans == null)
            {
                Logger.LogInformation("FactoryMethod :: {1} : {0}.", "No scheduled plan found, just exit", guid);
                return(null);
            }

            Queue <Plan> queue = new Queue <Plan>(plans);

            Plan next     = null;
            Plan previous = null;

            while (queue.Count > 0)
            {
                Plan item = queue.Peek();
                //found one running (should not), just break it
                if (item.Status == ExecutionStatus.Executing)
                {
                    break;
                }

                //found one done (previous), peek if null done else next
                if (item.Status == ExecutionStatus.Done)
                {
                    previous = queue.Dequeue();
                    Plan peek = queue.Count > 0 ? queue.Peek() : null;

                    if (peek == null) //done just exit
                    {
                        Logger.LogInformation("FactoryMethod :: {1} : {0}.", "Peek queue. See nothing. Probably done with the plan", guid);
                        return(null);
                    }

                    if (peek.Status == ExecutionStatus.Done)
                    {
                        continue;
                    }

                    if (peek.Status == ExecutionStatus.Pending)
                    {
                        next = queue.Dequeue();
                        break;
                    }
                }
                //found one pending, just fire next
                if (item.Status == ExecutionStatus.Pending)
                {
                    next = queue.Dequeue();
                    break;
                }
            }

            if (next == null)
            {
                Logger.LogInformation("FactoryMethod :: {1} : {0}.", "Exit the factory method, no next task planned", guid);
                return(null);
            }

            if (previous == null && next != null)
            {
                IKey key = new DefaultKey(next.ActionName);
                if (!this._executionCommand.ContainsKey(key))
                {
                    Logger.LogInformation("FactoryMethod :: {1} : No key found in dictionary with {0}.", key, guid);
                    return(null);
                }
                bool isNextOverallStatusOk2Run = OnStartError(previous, next, plans, actions);
                if (!isNextOverallStatusOk2Run)
                {
                    Logger.LogInformation("FactoryMethod :: {1} : Overall status tell us not to continue {0}.", key, guid);
                    return(new FailCommand(next.ActionName, Logger, _webapiUrl));
                }

                IPreingestCommand command = this._executionCommand[key];
                return(command);
            }

            if (previous != null && next != null)
            {
                if (actions == null)
                {
                    Logger.LogInformation("FactoryMethod :: {0} : Plan described previous and next action, but there is no actions list returned. Hmmm....", guid);
                    return(null);
                }

                var action = actions.Where(item => item.Name == previous.ActionName.ToString()).FirstOrDefault();
                if (action == null)
                {
                    Logger.LogInformation("FactoryMethod :: {1} : No action found in the list with the name {0}.", previous.ActionName.ToString(), guid);
                    return(null);
                }

                IKey key = new DefaultKey(next.ActionName);
                if (!this._executionCommand.ContainsKey(key))
                {
                    Logger.LogInformation("FactoryMethod :: {1} : No key found in dictionary with {0}.", key, guid);
                    return(null);
                }

                bool isPreviousOk2Run = false;
                switch (action.ActionStatus)
                {
                case "Error":
                    if (previous.ContinueOnError)
                    {
                        isPreviousOk2Run = true;
                    }
                    break;

                case "Failed":
                    if (previous.ContinueOnFailed)
                    {
                        isPreviousOk2Run = true;
                    }
                    break;

                case "Success":
                {
                    isPreviousOk2Run = true;
                }
                break;

                default:
                    isPreviousOk2Run = false;
                    break;
                }

                bool isNextOverallStatusOk2Run = OnStartError(previous, next, plans, actions);
                if (isPreviousOk2Run)
                {
                    if (!isNextOverallStatusOk2Run)
                    {
                        Logger.LogInformation("FactoryMethod :: {1} : Overall status tell us not to continue {0}.", key, guid);
                        return(new FailCommand(next.ActionName, Logger, _webapiUrl));
                    }
                    IPreingestCommand command = this._executionCommand[key];
                    return(command);
                }
                Logger.LogInformation("FactoryMethod :: {1} : Not OK to run {0}.", key, guid);
            }
            return(null);
        }
示例#18
0
 // typeof(MediatR.INotificationMediator<MediatR.Examples.Ponged>)
 internal static object Get1_INotificationMediator(IResolverContext r)
 {
     return(new MediatR.NotificationMediator <MediatR.Examples.Ponged>(new MediatR.INotificationHandler <MediatR.Examples.Ponged>[] { new MediatR.Examples.GenericHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.INotificationMediator <MediatR.Examples.Ponged>), typeof(MediatR.INotificationMediator <>), (object)null, 52, FactoryType.Service, typeof(MediatR.NotificationMediator <MediatR.Examples.Ponged>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.INotificationHandler <MediatR.Examples.Ponged> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.INotificationHandler <MediatR.Examples.Ponged>), typeof(MediatR.INotificationHandler <MediatR.INotification>), (object)null, IfUnresolved.ReturnDefaultIfNotRegistered, 34, FactoryType.Service, typeof(MediatR.Examples.GenericHandler), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))), new MediatR.Examples.PongedHandler((System.IO.TextWriter)r.Resolve(typeof(System.IO.TextWriter), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(MediatR.INotificationMediator <MediatR.Examples.Ponged>), typeof(MediatR.INotificationMediator <>), (object)null, 52, FactoryType.Service, typeof(MediatR.NotificationMediator <MediatR.Examples.Ponged>), Reuse.Transient, RequestFlags.IsResolutionCall).Push(typeof(System.Collections.Generic.IEnumerable <MediatR.INotificationHandler <MediatR.Examples.Ponged> >), default(System.Type), (object)null, 2, FactoryType.Wrapper, default(System.Type), Reuse.Transient, ((RequestFlags)0)).Push(typeof(MediatR.INotificationHandler <MediatR.Examples.Ponged>), default(System.Type), (object)DefaultKey.Of(0), IfUnresolved.ReturnDefaultIfNotRegistered, 43, FactoryType.Service, typeof(MediatR.Examples.PongedHandler), Reuse.Transient, ((RequestFlags)0), 0), default(object[]))) }));
 }
示例#19
0
 // typeof(Prism.Navigation.INavigationService)
 internal static object Get13_INavigationService(IResolverContext r)
 {
     return(new Prism.Navigation.PageNavigationService((Prism.Ioc.IContainerExtension)r.Resolve(typeof(Prism.Ioc.IContainerExtension), null, IfUnresolved.Throw, default(System.Type), Request.Empty.Push(typeof(Prism.Navigation.INavigationService), default(System.Type), DefaultKey.Of(0), 28, FactoryType.Service, typeof(Prism.Navigation.PageNavigationService), Reuse.Transient, RequestFlags.IsResolutionCall), default(object[])), new Prism.Common.ApplicationProvider(), new Prism.Behaviors.PageBehaviorFactory(), new Prism.Logging.EmptyLogger()));
 }
示例#20
0
        private IEnumerable <ResolveManyResult> ResolveManyGenerated(Type serviceType)
        {
            if (serviceType == typeof(Prism.AppModel.IApplicationStore))
            {
                yield return(Of(Get0_IApplicationStore));
            }

            if (serviceType == typeof(PrismZero.Services.Hello.IHelloService))
            {
                yield return(Of(Get1_IHelloService));
            }

            if (serviceType == typeof(Prism.Services.IPageDialogService))
            {
                yield return(Of(Get2_IPageDialogService));
            }

            if (serviceType == typeof(Prism.Modularity.IModuleInitializer))
            {
                yield return(Of(Get3_IModuleInitializer));
            }

            if (serviceType == typeof(Prism.Events.IEventAggregator))
            {
                yield return(Of(Get4_IEventAggregator));
            }

            if (serviceType == typeof(Prism.Modularity.IModuleCatalog))
            {
                yield return(Of(Get5_IModuleCatalog));
            }

            if (serviceType == typeof(Prism.Services.IDeviceService))
            {
                yield return(Of(Get6_IDeviceService));
            }

            if (serviceType == typeof(Prism.Behaviors.IPageBehaviorFactory))
            {
                yield return(Of(Get7_IPageBehaviorFactory));
            }

            if (serviceType == typeof(PrismZero.ViewModels.MainPageViewModel))
            {
                yield return(Of(Get8_MainPageViewModel));
            }

            if (serviceType == typeof(Prism.Modularity.IModuleManager))
            {
                yield return(Of(Get9_IModuleManager));
            }

            if (serviceType == typeof(Prism.Services.Dialogs.IDialogService))
            {
                yield return(Of(Get10_IDialogService));
            }

            if (serviceType == typeof(Prism.Common.IApplicationProvider))
            {
                yield return(Of(Get11_IApplicationProvider));
            }

            if (serviceType == typeof(PrismZero.ViewModels.SecondPageViewModel))
            {
                yield return(Of(Get12_SecondPageViewModel));
            }

            if (serviceType == typeof(Prism.Navigation.INavigationService))
            {
                yield return(Of(Get13_INavigationService, DefaultKey.Of(0)));

                yield return(Of(Get14_INavigationService, "PageNavigationService"));
            }

            if (serviceType == typeof(PrismZero.Views.MainPage))
            {
                yield return(Of(Get15_MainPage));
            }

            if (serviceType == typeof(PrismZero.Views.SecondPage))
            {
                yield return(Of(Get16_SecondPage));
            }

            if (serviceType == typeof(object))
            {
                yield return(Of(Get17_Object, "NavigationPage"));

                yield return(Of(Get18_Object, "SecondPage"));

                yield return(Of(Get19_Object, "MainPage"));
            }

            if (serviceType == typeof(Prism.Logging.ILoggerFacade))
            {
                yield return(Of(Get20_ILoggerFacade));
            }
        }
 public IKey CreateNewAutoId() => DefaultKey.FromId(null);
 public IKey CreateFromId(long id) => DefaultKey.FromId(id);
示例#23
0
        public void Can_register_multiple_placeholders()
        {
            var c = new Container();

            c.RegisterPlaceholder <IN>();
            c.RegisterPlaceholder <IN>();

            var arrFuncN = c.Resolve <Func <IN>[]>();

            Assert.AreEqual(2, arrFuncN.Length);

            c.Register <IN, N1>(ifAlreadyRegistered: IfAlreadyRegistered.Replace, serviceKey: DefaultKey.Of(0));
            c.Register <IN, N2>(ifAlreadyRegistered: IfAlreadyRegistered.Replace, serviceKey: DefaultKey.Of(1));
            Assert.IsInstanceOf <N1>(arrFuncN[0]());
            Assert.IsInstanceOf <N2>(arrFuncN[1]());
        }
示例#24
0
 /// <summary>
 /// Gets a value from the local storage.
 /// </summary>
 /// <param name="defaultKey">Which key to retrieve.</param>
 /// <param name="defaultValue">Default value if not found</param>
 /// <returns>The value corresponding to the key; the default value if not found.</returns>
 protected static int GetValueFromLocalStorage(DefaultKey defaultKey, int defaultValue)
 {
     return(PlayerPrefs.GetInt(defaultKey.ToString(), defaultValue));
 }