Beispiel #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string languageCode = "en";

            var profileConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "config");
            var configFile        = Path.Combine(profileConfigPath, "config.json");
            var translationsDir   = Path.Combine(profileConfigPath, "Translations");
            var subPath           = "";
            var validateJSON      = false; // TODO Need to re-enable validation for GUI.

            if (File.Exists(configFile))
            {
                try {
                    var config = GlobalSettings.Load(subPath, validateJSON);
                    languageCode = config.ConsoleConfig.TranslationLanguageCode;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Config Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    Shutdown();
                }
            }

            if (!Directory.Exists(translationsDir))
            {
                Directory.CreateDirectory(translationsDir);
            }

            var uiTranslation = new UITranslation(languageCode);

            TinyIoCContainer.Current.Register(uiTranslation);

            MainWindow = new MainClientWindow();


            ConsoleHelper.AllocConsole();
            UILogger logger = new UILogger()
            {
                LogToUI = ((MainClientWindow)MainWindow).LogToConsoleTab
            };

            Logger.AddLogger(logger, string.Empty);

            Task.Run(() =>
            {
                NecroBot.CLI.Program.RunBotWithParameters(OnBotStartedEventHandler, new string[] { });
            });

            if (Settings.Default.ConsoleToggled == true)
            {
                ConsoleHelper.ShowConsoleWindow();
            }
            if (Settings.Default.ConsoleToggled == false)
            {
                ConsoleHelper.HideConsoleWindow();
            }

            MainWindow.Show();
        }
Beispiel #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // base.OnStartup(e);

            MainWindow = new MainClientWindow();


            ConsoleHelper.AllocConsole();
            UILogger logger = new UILogger();

            logger.LogToUI = ((MainClientWindow)MainWindow).LogToConsoleTab;

            Logger.AddLogger(logger, string.Empty);

            Task.Run(() =>
            {
                NecroBot.CLI.Program.RunBotWithParameters(OnBotStartedEventHandler, new string[] { });
            });
            ConsoleHelper.HideConsoleWindow();
            MainWindow.Show();
        }
Beispiel #3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string languageCode = "en";

            if (File.Exists("config\\config.json"))
            {
                var config = GlobalSettings.Load("config", false);
                languageCode = config.ConsoleConfig.TranslationLanguageCode;
            }

            if (!System.IO.Directory.Exists(@"config\Translations"))
            {
                System.IO.Directory.CreateDirectory(@"config\Translations");
            }

            var uiTranslation = new UITranslation(languageCode);

            TinyIoCContainer.Current.Register <UITranslation>(uiTranslation);

            MainWindow = new MainClientWindow();


            ConsoleHelper.AllocConsole();
            UILogger logger = new UILogger();

            logger.LogToUI = ((MainClientWindow)MainWindow).LogToConsoleTab;

            Logger.AddLogger(logger, string.Empty);

            Task.Run(() =>
            {
                NecroBot.CLI.Program.RunBotWithParameters(OnBotStartedEventHandler, new string[] { });
            });
            ConsoleHelper.HideConsoleWindow();
            MainWindow.Show();
        }