Пример #1
0
        public BrowserElement(UWPHttpProviderSelector selector, LayoutSetting layoutSetting)
        {
            defaultUrl    = new Uri(selector.Settings.DefaultUrl.Value);
            LayoutSetting = layoutSetting;
            InitializeComponent();

            if (selector.Settings.Debug.InitialValue)
            {
                Visibility = Visibility.Collapsed;
            }
            else
            {
                Transformer.Child            = WebView = new WebView(WebViewExecutionMode.SeparateThread);
                WebView.NavigationStarting  += (s, e) => AddressBox.Text = e.Uri.ToString();
                WebView.NavigationCompleted += (s, e) =>
                {
                    if (LockGame)
                    {
                        _ = s.InvokeScriptAsync("eval", new[] { BrowserSetting.StyleSheetSetJs });
                    }
                };
                WebView.FrameNavigationStarting += (s, e) =>
                {
                    if (LockGame)
                    {
                        _ = s.InvokeScriptAsync("eval", new[] { BrowserSetting.StyleSheetSetJs });
                    }
                };
                WebView.WebResourceRequested += ((EdgeHttpProvider)selector.Current).WebResourceRequested;
                WebView.Navigate(defaultUrl);

                layoutSetting.LayoutScale.ValueChanged  += _ => UpdateBrowserScale();
                layoutSetting.BrowserScale.ValueChanged += _ => UpdateBrowserScale();
                UpdateBrowserScale();
            }
        }
Пример #2
0
 public DebugSettingView(UWPHttpProviderSelector selector)
 {
     DebugData     = selector.Settings.Debug;
     DebugProvider = selector.Current as DebugHttpProvider;
     InitializeComponent();
 }
Пример #3
0
        public AotCompositor()
        {
            var ntp            = Information <ITimingService> .Static = new NTPService();
            var data           = Information <IDataService> .Static = new DataService();
            var settings       = Information <ISettingsManager> .Static = new SettingsManager(data);
            var toastNotifier  = new ToastNotifier();
            var browserSetting = Information <BrowserSetting> .Static = new BrowserSetting(settings);
            var layoutSetting  = Information <LayoutSetting> .Static = new LayoutSetting(settings);
            var localeSetting  = Information <LocaleSetting> .Static = new LocaleSetting(settings);
            var localization   = Information <ILocalizationService> .Static = new LocalizationService(localeSetting);
            var shell          = Information <IShell> .Static = new UWPShell(layoutSetting, localeSetting, localization);
            var shellContext   = Information <IShellContextService> .Static = new UWPShellContextService(localization);
            var proxySetting   = Information <ProxySetting> .Static = new ProxySetting(settings);
            var selector       = new UWPHttpProviderSelector(shellContext, browserSetting, proxySetting);

            Information <IHttpProviderSelector> .Static = selector;
            var gameProvider        = Information <GameProvider> .Static = new GameProvider(selector, settings);
            var notificationManager = Information <NotificationManager> .Static = new NotificationManager(new[] { toastNotifier }, settings, localization, shell, localeSetting);
            var statePersist        = Information <IStatePersist> .Static = new LoggerStatePersist(data);
            var questKnowledges     = Information <IQuestKnowledges> .Static = new QuestKnowledges(statePersist);
            var navalBase           = Information <NavalBase> .Static = new NavalBase(gameProvider, ntp, notificationManager, statePersist, questKnowledges);
            var logger          = Information <Logger> .Static = new Logger(data, gameProvider, navalBase, statePersist);
            var currentBattleVM = Information <CurrentBattleVM> .Static = new CurrentBattleVM(navalBase, shell);

            var migrators = new LogMigrator[]
            {
                Information <AdmiralRoomMigrator> .Static        = new AdmiralRoomMigrator(),
                Information <ElectronicObserverMigrator> .Static = new ElectronicObserverMigrator(),
                Information <INGLegacyMigrator> .Static          = new INGLegacyMigrator(),
                Information <LogbookMigrator> .Static            = new LogbookMigrator(),
                Information <PoiMigrator> .Static = new PoiMigrator(),
            };

            Information <LogMigrationVM> .Factory             = () => new LogMigrationVM(logger, migrators, shellContext, localization);
            Information <BattleLogsVM> .Factory               = () => new BattleLogsVM(logger, navalBase, gameProvider, localization, shell);
            Information <EquipmentCreationLogsVM> .Factory    = () => new EquipmentCreationLogsVM(logger, navalBase, localization);
            Information <ExpeditionCompletionLogsVM> .Factory = () => new ExpeditionCompletionLogsVM(logger, navalBase, localization);
            Information <ShipCreationLogsVM> .Factory         = () => new ShipCreationLogsVM(logger, navalBase, localization);
            Information <MaterialsChangeLogsVM> .Factory      = () => new MaterialsChangeLogsVM(logger, ntp);
            Information <EquipmentCatalogVM> .Factory         = () => new EquipmentCatalogVM(navalBase);

            Information <ApiDebugView> .Factory                 = () => new ApiDebugView(gameProvider);
            Information <CurrentBattleView> .Factory            = () => new CurrentBattleView(currentBattleVM);
            Information <AdmiralView> .Factory                  = () => new AdmiralView(navalBase);
            Information <DocksView> .Factory                    = () => new DocksView(navalBase);
            Information <ExpeditionView> .Factory               = () => new ExpeditionView(navalBase);
            Information <FleetsView> .Factory                   = () => new FleetsView(navalBase);
            Information <LogMigrationView> .Factory             = () => new LogMigrationView(Information <LogMigrationVM> .Factory());
            Information <BattleLogsView> .Factory               = () => new BattleLogsView(Information <BattleLogsVM> .Factory());
            Information <EquipmentCreationLogsView> .Factory    = () => new EquipmentCreationLogsView(Information <EquipmentCreationLogsVM> .Factory());
            Information <ExpeditionCompletionLogsView> .Factory = () => new ExpeditionCompletionLogsView(Information <ExpeditionCompletionLogsVM> .Factory());
            Information <ShipCreationLogsView> .Factory         = () => new ShipCreationLogsView(Information <ShipCreationLogsVM> .Factory());
            Information <MaterialsChangeView> .Factory          = () => new MaterialsChangeView(Information <MaterialsChangeLogsVM> .Factory());

            Information <MasterDataView> .Factory       = () => new MasterDataView(navalBase);
            Information <BrowserElement> .Factory       = () => new BrowserElement(selector, layoutSetting);
            Information <ActiveQuestsView> .Factory     = () => new ActiveQuestsView(navalBase);
            Information <MapHPView> .Factory            = () => new MapHPView(navalBase);
            Information <ShipCatalogView> .Factory      = () => new ShipCatalogView(navalBase);
            Information <EquipmentCatalogView> .Factory = () => new EquipmentCatalogView(Information <EquipmentCatalogVM> .Factory());

            Information <LocaleSettingView> .Factory = () => new LocaleSettingView(localeSetting);
            Information <ProxySettingView> .Factory  = () => new ProxySettingView(proxySetting);
#if DEBUG
            Information <DebugSettingView> .Factory = () => new DebugSettingView(selector);
#endif
            Information <NotificationSettingView> .Factory = () => new NotificationSettingView(notificationManager);
        }