コード例 #1
0
ファイル: ParentProject.cs プロジェクト: asek-ll/tst
        private void InitModules()
        {
            foreach (var module in PomWrapper.GetModules())
            {
                var transasPlugin =
                    new PluginModule(Path.GetFullPath(Path.Combine(_pomFolder, module)))
                {
                    RelativePath = module
                };

                _pluginToModulePath.Add(transasPlugin, module);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: asek-ll/tst
        private void UpdatePlugin(PluginModule plugin, String propertyName)
        {
            var index = _pluginModuleManager.Plugins.IndexOf(plugin);

            if (propertyName == "enabled")
            {
                var status = plugin.Enabled ? "ON" : "OFF";
                PluginsList.Items[index].SubItems[1].Text = status;
            }

            if (propertyName == "branch")
            {
                PluginsList.Items[index].SubItems[2].Text = plugin.Branch;
            }
        }
コード例 #3
0
 public Properties(PluginModule owner)
 {
     this.owner = owner;
 }
コード例 #4
0
 public Properties(PluginModule owner)
 {
     Owner = owner;
 }
コード例 #5
0
        private void ListClasses(string file)
        {
            PluginModule        plugin;
            List <PluginModule> plugins = new List <PluginModule>();
            IPluginModule       instance;
            IPlugin             pInstance;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                ImageList imlIcons = new ImageList();
                imlIcons.ImageSize = new Size(16, 16);
                imlIcons.Images.Add("ICO_PLIGIN", global::RailwayStudio.Common.Properties.Resources.ICO_PLUGIN_16);

                Assembly lib = Assembly.LoadFile(file);
                foreach (Type type in lib.GetExportedTypes())
                {
                    if (typeof(IPlugin).IsAssignableFrom(type))
                    {
                        pInstance   = Activator.CreateInstance(type) as IPlugin;
                        this.Plugin = pInstance as IPlugin;

                        lblName.Text  = pInstance.Name;
                        picIcon.Image = pInstance.LargeIcon;
                    }
                    else if (typeof(IPluginModule).IsAssignableFrom(type))
                    {
                        instance = Activator.CreateInstance(type) as IPluginModule;
                        if (instance != null)
                        {
                            plugin          = new PluginModule();
                            plugin.ID       = instance.ModuleID;
                            plugin.Name     = instance.ModuleName;
                            plugin.Filename = file;
                            plugin.Class    = type.FullName;

                            plugins.Add(plugin);
                        }
                    }
                }

                grdModules.DataSource = plugins;

                grdModulesView.Columns["ID"].Visible       = false;
                grdModulesView.Columns["Filename"].Visible = false;
                grdModulesView.Columns["Class"].Visible    = false;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;

                MessageBox.Show("ERROR loading plugin modules:" +
                                Environment.NewLine + Environment.NewLine +
                                ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                instance = null;

                Cursor.Current = Cursors.Default;
            }
        }