예제 #1
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");
            if (!Directory.Exists("data") || !File.Exists("sqlite3.dll"))
            {
                MessageBox.Show(Debugger.IsAttached ? @"""data"" folder and/or sqlite3.dll not found. Make sure to copy the data folder and sqlite3.dll to the output directory." : "Some files are missing, please reinstall.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(-1);
            }

            if (!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _uiManager = new UiManager();

            List<Assembly> assemblies = LoadExtensions();
            _extensionManager = new ExtensionManager(_uiManager, Dispatcher, ConfigDir, new FinalesFunkelnExtension());
            _extensionManager.AddAssemblies(assemblies);
            _extensionManager.InitExtensions();

            foreach (var x in _extensionManager.Extensions)
            {
                var item = new ExtensionMenuItem(x.Value);
                item.Views.AddRange(_uiManager.GetViewsByExtension(x.Value));
                ViewsMenuItem.Items.Add(item);
            }

            DockingManager.Layout.RootPanel = new LayoutPanel(_mainPane = new LayoutDocumentPane());

            foreach (var view in _uiManager.GetViews())
            {
                LayoutContent c = new DocumentViewControl(view);
                _mainPane.Children.Add(c);
            }

            #if AIRDEBUG && DEBUG
            _processInjector = new ProcessInjector("adl");//AirDebugLauncher
            #else
            _processInjector = new ProcessInjector("lolclient");
            #endif

            _processInjector.Injected += pi_Injected;
            _processInjector.ProcessFound += ProcessInjector_ProcessFound;
            _processInjector.ProcessExited += _processInjector_ProcessExited;
            _processInjector.Start();
        }