예제 #1
0
        private void InitAndLaunchPlugins()
        {
            var          libs   = new PluginLauncher <PluginConfig>();
            const string folder = "../../../plugins/SamplePlugin/bin";
            var          dirs   = new List <string>(System.IO.Directory.GetDirectories(folder));
            var          config = new PluginConfig(this.model, null, null, this.Console, null, null);

            foreach (var dir in dirs)
            {
                libs.LaunchPlugins(dir, config);
            }
        }
예제 #2
0
        public void TestLaunchingSamplePlugin()
        {
            var          libs    = new PluginLauncher <PluginConfig>();
            const string folder  = "src/plugins/SamplePlugin/bin";
            var          dirs    = new List <string>(Directory.GetDirectories(folder));
            var          console = Substitute.For <IConsole>();
            var          config  = new PluginConfig(null, null, console, null);

            foreach (var dir in dirs)
            {
                libs.LaunchPlugins(dir, config);
            }
            Assert.IsTrue(libs.Plugins.Count >= 1);
            console.Received().SendMessage(Arg.Any <string>());
        }
예제 #3
0
        private void InitAndLaunchPlugins()
        {
            var          libs       = new PluginLauncher <PluginConfig>();
            const string folder     = "../../../plugins";
            var          pluginDirs = new List <string>(System.IO.Directory.GetDirectories(folder));

            foreach (var plugindir in pluginDirs)
            {
                var dirs   = new List <string>(System.IO.Directory.GetDirectories(plugindir + "/bin"));
                var config = new PluginConfig(this.model, this.scene, null, this.Console, this.temporaryElementProvider, this.constraintsGrid, this.rightPanel, this.sceneGrid);
                foreach (var dir in dirs)
                {
                    libs.LaunchPlugins(dir, config);
                }
            }
        }
예제 #4
0
        public void TestLaunchingSamplePlugin()
        {
            var libs   = new PluginLauncher <PluginConfig>();
            var folder = Path.Combine(
                TestContext.CurrentContext.TestDirectory,
                "../../../../src/plugins/SamplePlugin/bin"
                );
            var dirs    = new List <string>(Directory.GetDirectories(folder));
            var console = Substitute.For <IConsole>();
            var model   = Substitute.For <IModel>();
            var config  = new PluginConfig(model, null, null, console, null, null);

            foreach (var dir in dirs)
            {
                libs.LaunchPlugins(dir, config);
            }
            Assert.IsTrue(libs.Plugins.Count >= 1);
            console.Received().SendMessage(Arg.Any <string>());
        }
예제 #5
0
        public MainWindow()
        {
            // TODO: Fix sequential coupling here.
            this.DataContext = this;
            this.InitializeComponent();

            this.model = new WpfControlsLib.Model.Model();

            this.model.Reinit += this.Reinit;

            this.model.FileSaved      += (_, __) => NotifyTitleChanged();
            this.model.UnsavedChanges += (_, __) => NotifyTitleChanged();

            this.appConsole.Pushed += this.AppConsole_Pushed;

            // Notifying window first time, to initialize title.
            NotifyTitleChanged();

            this.palette.SetModel(this.model);

            this.controller = new WpfControlsLib.Controller.Controller();

            this.Closed += this.CloseChildrenWindows;

            this.scene.ElementManipulationDone += (sender, args) => this.palette.ClearSelection();
            this.scene.ElementAdded            += (sender, args) => this.modelExplorer.NewElement(args.Element);
            this.scene.ElementRemoved          += (sender, args) => this.modelExplorer.RemoveElement(args.Element);
            this.scene.NodeSelected            += (sender, args) => this.attributesView.DataContext = args.Node;
            this.scene.EdgeSelected            += (sender, args) => this.attributesView.DataContext = args.Edge;

            this.scene.Init(this.model, this.controller, new PaletteAdapter(this.palette));

            this.modelSelector.Init(this.model);
            this.modelSelector.ChangeModel(2);

            this.libs = new PluginLauncher <PluginConfig>();

            this.InitAndLaunchPlugins();
            this.InitToolbar();
        }
예제 #6
0
        private void InitAndLaunchPlugins()
        {
            var          libs       = new PluginLauncher <PluginConfig>();
            const string folder     = "../../../plugins";
            var          pluginDirs = new List <string>(System.IO.Directory.GetDirectories(folder));

            foreach (var plugindir in pluginDirs)
            {
                var dirs   = new List <string>(System.IO.Directory.GetDirectories(plugindir + "/bin"));
                var config = new PluginConfig(this.model, null, null, this.Console, null, this.leftPanelGrid);
                config.ChangeModelSelectorVisibility = (x) => { this.modelSelector.SelectorVisibility = x; };
                config.ChangeModel = this.SelectModel;
                foreach (var dir in dirs)
                {
                    libs.LaunchPlugins(dir, config);
                }

                if (config.OnMainModelChanged != null)
                {
                    this.OnModelChanged += new Action <string>(config.OnMainModelChanged);
                }
            }
        }