public ResultConsole() { Application.Current.Exit += OnApplicationExit; _instance = this; _consoleString = ""; IsInitialized = true; var loggingThread = new Thread(new ThreadStart(ProcessQueue)); loggingThread.IsBackground = true; loggingThread.Start(); }
protected override void OnStartup(StartupEventArgs e) { VersionNumber += Assembly.GetExecutingAssembly().GetName().Version.ToString(3); if (!Directory.Exists(UserFolder)) { Directory.CreateDirectory(UserFolder); } InitializeIoCContainer(); _logger = IoC.Resolve<ILoggerService>(); _credman = new CredentialManager(); _resultConsole = new ResultConsole(); ConfigManager = new ConfigManager(UserFolder, IoC.Resolve<IXmlServices>(), IoC.Resolve<ILoggerService>()); ActionManager = new ActionManager(_logger); PluginManager = new PluginManager(_logger); _actionFactory = new ActionFactory(IoC); // Load Core actions LoadCoreActions(); // Load and initialize all plugins from Plugins folder PluginManager.LoadAllPlugins(); PluginManager.InitializeAllPlugins(); // set up login window var loginWindow = new LoginWindow(); var loginWindowViewModel = new LoginWindowViewModel { SuccessAction = () => loginWindow.DialogResult = true, CancelAction = () => loginWindow.DialogResult = false }; loginWindow.DataContext = loginWindowViewModel; // Initialize Main Window var mainWindowViewModel = new MainWindowViewModel(IoC.Resolve<ILoggerService>(), ActionManager); mainWindowViewModel.LoadActionsCollection(); var window = new MainWindow { Title = "Andromeda", Height = 750, Width = 800, ResizeMode = ResizeMode.CanMinimize, DataContext = mainWindowViewModel }; // Show login prompt loginWindow.ShowDialog(); if (loginWindowViewModel.WasCanceled) { // program is closing if the window was canceled. Application.Current.Shutdown(); return; } mainWindowViewModel?.UpdateLoginProperties(); // show main window window.Show(); }