Esempio n. 1
0
 public App()
 {
     //https://docs.devexpress.com/WPF/400286/common-concepts/performance-improvement/reducing-the-application-launch-time
     // Defines where to store JIT profiles
     ProfileOptimization.SetProfileRoot(AppFileUtils.GetBaseAppFolder());
     // Enables Multicore JIT with the specified profile
     ProfileOptimization.StartProfile("Startup.Profile");
 }
Esempio n. 2
0
        public static IServiceCollection AddApplication(this IServiceCollection services, string ffmpegPath, string ffprobePath, string generatedFilesFolderPath = null)
        {
            if (string.IsNullOrWhiteSpace(generatedFilesFolderPath))
            {
                generatedFilesFolderPath = AppFileUtils.GetBaseAppFolder();
            }
            var fileService = new FileService(ffmpegPath, ffprobePath, generatedFilesFolderPath);

            services.AddSingleton <ICommonFileService>(fileService);
            services.AddSingleton <IFileService>(fileService);
            return(services.AddCommonServices().AddFFmpegService());
        }
Esempio n. 3
0
        public override void Initialize()
        {
            base.Initialize();

            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            SetupLogging();
            SetupMapper();

            //NPI WHY I NEED TO MANUALLY REGISTER THIS ONE
            Mvx.IoCProvider.RegisterSingleton <IMvxMessenger>(new MvxMessengerHub());

            string baseAppFolder = AppFileUtils.GetBaseAppFolder();
            var    fileService   = new FileService(baseAppFolder);

            Mvx.IoCProvider.RegisterSingleton(typeof(IFileService), () => fileService);
            Mvx.IoCProvider.RegisterSingleton(typeof(ICommonFileService), () => fileService);
            Mvx.IoCProvider.ConstructAndRegisterSingleton <ITelemetryService, TelemetryService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IAppSettingsService, AppSettingsService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IAppDataService, AppDataService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IYoutubeUrlDecoder, YoutubeUrlDecoder>();

            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IPlayer>(() =>
            {
                var logger = Mvx.IoCProvider.Resolve <ILogger <Player> >();
                return(new Player(logger, logToConsole: false));
            });

            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IFFmpegService, FFmpegService>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <ICastService, CastService>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IFileWatcherService, FileWatcherService>();

            Mvx.IoCProvider.ConstructAndRegisterSingleton <IAppWebServer, AppWebServer>();
            Mvx.IoCProvider.RegisterSingleton(typeof(IBaseWebServer), () => Mvx.IoCProvider.Resolve <IAppWebServer>());

            var messenger    = Mvx.IoCProvider.Resolve <IMvxMessenger>();
            var textProvider = new ResxTextProvider(Resource.ResourceManager, messenger);

            Mvx.IoCProvider.RegisterSingleton <ITextProvider>(textProvider);

            //since im using automapper to resolve this one, i need to explicit register it
            Mvx.IoCProvider.RegisterType <PlayListItemViewModel>();
            Mvx.IoCProvider.RegisterType <FileItemViewModel>();
            Mvx.IoCProvider.RegisterType <DeviceItemViewModel>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton(typeof(SettingsViewModel));

            RegisterAppStart <SplashViewModel>();
        }