Exemplo n.º 1
0
        public override void Initialize()
        {
            InitializeLogging();

            RxApp.DefaultExceptionHandler = new RxExceptionHandler();

            // Need to call ForContext *afer* calling InitializeLogging()
            var log = Log.ForContext <App>();

            log.Information("MHWAppearanceEditor v" + Assembly.GetExecutingAssembly() !.GetName().Version);
            log.Information("Cirilla.Core v" + Assembly.GetAssembly(typeof(Cirilla.Core.Models.SaveData)) !.GetName().Version);

            // Settings
            var settingsService = new SettingsService();

            Locator.CurrentMutable.RegisterConstant(settingsService);

            // Backup service
            Locator.CurrentMutable.RegisterConstant(new BackupService());

            // Start assets loading
            AssetsService assetsService = new AssetsService("assets");

            Task.Run(() => assetsService.Initialize());
            Locator.CurrentMutable.RegisterConstant(assetsService);

            Locator.CurrentMutable.RegisterConstant(new ColorValueConverter(), typeof(IBindingTypeConverter));
            Locator.CurrentMutable.RegisterConstant(new SteamWebApiService(SuperSecret.STEAM_WEB_API_KEY));

            Locator.CurrentMutable.Register(() => new StartScreenView(), typeof(IViewFor <StartScreenViewModel>));
            Locator.CurrentMutable.Register(() => new SaveDataView(), typeof(IViewFor <SaveDataViewModel>));
            Locator.CurrentMutable.Register(() => new ExceptionView(), typeof(IViewFor <ExceptionViewModel>));
            Locator.CurrentMutable.Register(() => new CharacterAssetView(), typeof(IViewFor <CharacterAssetViewModel>));

            // Tabs
            Locator.CurrentMutable.Register(() => new SaveDataInfoView(), typeof(IViewFor <SaveDataInfoViewModel>));
            Locator.CurrentMutable.Register(() => new SaveSlotView(), typeof(IViewFor <SaveSlotViewModel>));

            AvaloniaXamlLoader.Load(this);
        }