/// <summary>
        /// Constructs and scans a directory for compatible plugins
        /// </summary>
        /// <param name="dir">Directory to scan for DLLs</param>
        public PluginManager(string dir)
        {
            inst_ = this;

            string path = Path.Combine(Directory.GetCurrentDirectory(), dir);

            if (!Directory.Exists(path))
                return;

            foreach (string file in Directory.GetFiles(path))
            {
                if (Path.GetExtension(file).Equals(".dll") && File.Exists(file))
                {
                    try
                    {
                        Assembly asm = Assembly.LoadFile(file);
                        Type[] types = asm.GetExportedTypes();
                        FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(asm.Location);
                        PluginInfo plugin = new PluginInfo(asm.ManifestModule.Name, new string[] { myFileVersionInfo.ProductName, myFileVersionInfo.ProductVersion, myFileVersionInfo.CompanyName, myFileVersionInfo.Comments });

                        foreach (Type t in types)
                        {
                            if (t.GetInterface("PluginLib.IFileEditor") != null)
                            {
                                fileServices_.Add((PluginLib.IFileEditor)Activator.CreateInstance(t));
                                plugin.Components.Add(t.Name);
                            }
                            else if (t.GetInterface("PluginLib.ISearchService") != null)
                            {
                                searchServices_.Add((PluginLib.ISearchService)Activator.CreateInstance(t));
                                plugin.Components.Add(t.Name);
                            }
                            else if (t.GetInterface("PluginLib.ICompilerService") != null)
                            {
                                compilers_.Add((PluginLib.ICompilerService)Activator.CreateInstance(t));
                                plugin.Components.Add(t.Name);
                            }
                            else if (t.GetInterface("PluginLib.IInfoTab") != null)
                            {
                                infoTabs_.Add((PluginLib.IInfoTab)Activator.CreateInstance(t));
                                plugin.Components.Add(t.Name);
                            }
                            else if (t.GetInterface("PluginLib.IBackgroundService") != null)
                            {
                                backgroundServices_.Add((PluginLib.IBackgroundService)Activator.CreateInstance(t));
                                plugin.Components.Add(t.Name);
                            }
                        }

                        if (plugin.Components.Count > 0)
                            assemblies.Add(plugin);
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.inst().Error(ex);
                    }
                }
            }
        }
        public MainWindow()
        {
            inst_ = this;
            errHandler = new ErrorHandler();
            this.ContentLoader = new ContentLoader();

            // Release builds will attempt to swallow errors as much as possible with the opportunity to report the error
            // Debug builds will not
            #if !debug
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            #endif

            TextBlock tb = new TextBlock();
            tb.Opacity = 0.025;
            tb.Text = "asDevelop v" + Assembly.GetAssembly(typeof(MainWindow)).GetName().Version.Major + "." + Assembly.GetAssembly(typeof(MainWindow)).GetName().Version.Minor;
            tb.FontSize = 48;
            tb.FontWeight = FontWeights.Bold;
            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            tb.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            BackgroundContent = tb;

            Net.DebugClient client = new Net.DebugClient(new Debugger.Debug.SessionData(""));
            pluginManager = new PluginManager("plugins");
            InitializeComponent();
            AppearanceManager.Current.ThemeSource = AppearanceManager.DarkThemeSource;
            AppearanceManager.Current.AccentColor = Colors.DarkOliveGreen;
            ContentSource = new Uri("Screens/LaunchScreen.xaml", UriKind.Relative);

            LinkNavigator.Commands.Add(new Uri("cmd://showPlugins", UriKind.Absolute), new RelayCommand(o => showPlugins()));
            errTimer = new Timer();
            errTimer.Enabled = true;
            errTimer.AutoReset = true;
            errTimer.Interval = 200;
            errTimer.Elapsed += errTimer_Elapsed;
            errTimer.Start();
        }