//private static ViewModelLocator s_instance; //public static ViewModelLocator Instance => s_instance ?? (s_instance = (ViewModelLocator)Application.Current.FindResource("Locator")); /// <summary> /// Initializes a new instance of the ViewModelLocator class¸with Windsor Castle IoC. /// </summary> public ViewModelLocator() { var container = new WindsorContainer(); ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container)); container.AddFFmpeg(); container.Register(Component.For <IDialogService>().ImplementedBy <DialogService>() .DependsOn(Dependency.OnValue("dialogTypeLocator", new AppDialogTypeLocator())).LifeStyle.Transient); container.Register(Component.For <MainViewModel>().ImplementedBy <MainViewModel>().LifeStyle.Transient); container.Register(Component.For <IFFmpegErrorViewModel>().ImplementedBy <FFmpegErrorViewModel>().LifeStyle.Transient); container.Register(Component.For <IFFmpegUiViewModel>().ImplementedBy <FFmpegUiViewModel>().LifeStyle.Transient); container.Register(Component.For <IUserInterfaceManager>().ImplementedBy <FFmpegUserInterfaceManager>().LifeStyle.Singleton); container.Register(Component.For <IFFmpegUserInterfaceFactory>().ImplementedBy <FFmpegUserInterfaceFactory>().LifeStyle.Singleton); container.Dispose(); }