Пример #1
0
        public override void Initialize(LocalizerKernel kernel)
        {
            if (LanguageManager.Instance.ActiveCulture != GameCulture.Chinese)
            {
                return;
            }

            HarmonyInstance = HarmonyInstance.Create("ModBrowserMirror");

            ReplaceURLs.Patch();
        }
Пример #2
0
        public override void Initialize(LocalizerKernel kernel)
        {
            Kernel = kernel;
            kernel.Load(new[] { new WPFModule() });

            if (Application.Current == null)
            {
                var thread = new Thread(() =>
                {
                    var a = new App();
                    a.InitializeComponent();
                    a.ShutdownMode = ShutdownMode.OnExplicitShutdown;

                    a.Run();
                });
                thread.SetApartmentState(ApartmentState.STA);
                thread.IsBackground = true;

                thread.Start();
            }
            else
            {
                var app = Application.Current;
                app.Dispatcher.Invoke(() =>
                {
                    var locator = app.TryFindResource("Locator");
                    if (locator != null)
                    {
                        app.Resources.Remove("Locator");
                    }
                    app.Resources.Add("Locator", new ViewModelLocator());
                    app.MainWindow = new MainWindow();
                    if (Localizer.Localizer.Config.ShowUI)
                    {
                        app.MainWindow.Show();
                        Localizer.Localizer.Log.Info("Window showed.");
                    }
                });
            }
        }