示例#1
0
文件: MDI.cs 项目: radtek/toaddotnet
        private void MDI_Load(object sender, EventArgs e)
        {
            plugEvent.evtHandler += new PlugEvent._evtHandler(EventProcess);
            //CMnuConnection mnuConnection = new CMnuConnection();
            //mnuConnection.ParentForm = this;
            //mnuConnection.Install(this.menuStrip);
            //PlugEvent plugEvent = new PlugEvent();
            //mnuConnection.EventPlug(plugEvent);

            if (string.IsNullOrEmpty(Config.Nom()))
            {
                FormRegister formRegister = new FormRegister();
                if (formRegister.ShowDialog() == DialogResult.Cancel)
                {
                    Application.Exit();
                }
            }
            AssemblyLoader asmLoader = new AssemblyLoader(this, this.menuStrip, null, null, plugEvent);
            string PluginsPath = Config.GetElement(Config.Load(), "/alf-solution/AppConfig/lib").GetAttribute("path"); //@".\plugins";//
            if (Directory.Exists(PluginsPath))
            {
                DirectoryInfo di = new DirectoryInfo(PluginsPath);
                string[] files = Directory.GetFiles(di.FullName, "*.dll");
                foreach (string file in files)
                {
                    if (asmLoader.Load(file))
                    {

                    }
                    else if (asmLoader.GetErrorMessage() != null)
                    {
                        //MessageBox.Show(asmLoader.GetErrorMessage(), "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#2
0
        private void MembsForm_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Config.Nom()))
            {
                FormRegister formRegister = new FormRegister();
                if (formRegister.ShowDialog() == DialogResult.Cancel)
                {
                    Application.Exit();
                }
            }
            AssemblyLoader asmLoader = new AssemblyLoader(this, this.ParentForm.Controls["menuStrip"] as MenuStrip, this.rightTabControl, this.leftTabControl, plugEvent);
            string PluginsPath = Config.GetElement(Config.Load(), "/alf-solution/AppConfig/plugin").GetAttribute("path"); //@".\plugins";//
            if (Directory.Exists(PluginsPath))
            {
                DirectoryInfo di = new DirectoryInfo(PluginsPath);
                string[] files = Directory.GetFiles(di.FullName, "*.dll");
                foreach (string file in files)
                {
                    if (asmLoader.Load(file))
                    {

                    }
                    else if (asmLoader.GetErrorMessage() != null)
                    {
                        //MessageBox.Show(asmLoader.GetErrorMessage(), "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }