예제 #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();
        }
예제 #2
0
 private void ViewMenuItem_Click(object sender, RoutedEventArgs e)
 {
     var mi = e.OriginalSource as MenuItem;
     var data = mi?.DataContext as View;
     //TODO probably inefficient needs to be rewritten eventually
     if (data != null)
     {
         List<LayoutDocumentPane> panes = GetPanes();
         bool alreadyActive=false;
         LayoutDocumentPane biggest = null;
         if (panes.Count > 0)
         {
             biggest = panes[0];
             double biggestSize = biggest.DockWidth.Value*biggest.DockHeight.Value;
             foreach (var x in panes)
             {
                 foreach (var y in x.Children)
                 {
                     if (y is DocumentViewControl)
                     {
                         if ((y as DocumentViewControl).View.InternalName == data.InternalName)
                         {
                             DockingManager.ActiveContent = y;
                             alreadyActive = true;
                         }
                     }
                     else
                         throw new NotSupportedException();
                 }
                 var size = x.DockWidth.Value*x.DockHeight.Value;
                 if (size > biggestSize)
                 {
                     biggestSize = size;
                     biggest = x;
                 }
             }
         }
         else
         {
             biggest=new LayoutDocumentPane();
             DockingManager.Layout.RootPanel.Children.Add(biggest);
         }
         if (!alreadyActive)
         {
             var ctrl = new DocumentViewControl(data);
             biggest.Children.Add(ctrl);
             DockingManager.ActiveContent = ctrl;
         }
     }
 }