Home > Enterprise >  Visual studio when i try to add reference get this : Instance object set as constant
Visual studio when i try to add reference get this : Instance object set as constant

Time:09-28

I dont know what does it say or how to fix it anyone has idea ? I also have tried to add this plugin interface to another project but got same error. So I think the problem is about this plugin setup. Here is my interface below

using DEMIRBANKLIB;
namespace DPlugin
{
    public interface DPlugin
    {
        public enum EVENTTYPE {GETPACKAGE,SENDPACKAGE,LOADTABLE }
        public string Name { get; set; }   
        public string Description { get; set; }
        public EventManager manager { get; set; }
        public void Run();
    }
    public class EventManager
    {
        IPaket paket;
        Dictionary<DPlugin.EVENTTYPE,EventDelegate> events = new Dictionary<DPlugin.EVENTTYPE,EventDelegate>();
        public delegate void EventDelegate(IPaket paket);

        public bool RegisterEvent(DPlugin.EVENTTYPE TYPE,EventDelegate del)
        {
            if (events[TYPE] == null)
                events.Add(TYPE, del);
            else
                return false;
            return true;
        }
    }
}


Here is the plugin i want to use.

using DPlugin;
using DEMIRBANKLIB;
namespace PaketEventP
{
    public class PEP : DPlugin.DPlugin
    {
        public string Name { get; set; }    
        public string Description { get; set; }
        public EventManager manager { get; set; }
        public PEP()
        {
            Name = "Paket Eventi Plugin";
            Description = "Paket eventleri ile bir şeyler yapcak";
            manager = new EventManager();
            
        }

        public void Run()
        {
            manager.RegisterEvent(DPlugin.DPlugin.EVENTTYPE.GETPACKAGE, paketAlEvent); 
        }
        public void paketAlEvent(IPaket paket)
        {
            MessageBox.Show(paket.detay);
        }
    }
}

CodePudding user response:

I solved this by editing solution codes manually.

  • Related