private async Task <INavItem> ParseNavItem(JsonObject data, ControlPaletteExportProvider controlPaletteExportProvider)
        {
            string type = data.GetOptionalString("Type");

            switch (type)
            {
            case nameof(ControlPalette):
            {
                var paletteModel = new ControlPaletteModel();
                await paletteModel.InitializeData(_stringProvider, _stringProvider.GetString("ControlPaletteDataPath"));

                return(ControlPalette.ControlPaletteViewModel.Parse(_stringProvider, data, paletteModel, controlPaletteExportProvider));
            }

            case nameof(ThemePalette):
            {
                var paletteModel = new ThemePaletteModel();
                await paletteModel.InitializeData(_stringProvider, _stringProvider.GetString("ThemePaletteDataPath"));

                return(ThemePalette.ThemePaletteViewModel.Parse(_stringProvider, data, paletteModel, controlPaletteExportProvider));
            }

            default:
                throw new Exception(string.Format("Unknown nav item type {0}", type));
            }
        }
示例#2
0
        private async Task SetupDependencies()
        {
            var stringProvider = new StringProvider(Windows.ApplicationModel.Resources.ResourceLoader.GetForViewIndependentUse());
            var exportProvider = new ControlPaletteExportProvider();

            var paletteModel = new ControlPaletteModel();
            await paletteModel.InitializeData(stringProvider, stringProvider.GetString("ControlPaletteDataPath"));

            var navModel = new MainNavModel(stringProvider);
            await navModel.InitializeData(stringProvider.GetString("MainDataPath"), paletteModel, exportProvider);

            lock (_initLock)
            {
                _stringProvider = stringProvider;
                _exportProvider = exportProvider;

                _paletteModel = paletteModel;

                _mainNavModel      = navModel;
                _outerNavViewModel = new OuterNavViewModel(_mainNavModel.NavItems, _mainNavModel.DefaultNavItem);
            }
        }