コード例 #1
0
ファイル: FormFactory.cs プロジェクト: trancongvy/SGDDev17CDT
        private void AddICDTData(CDTData Data)
        {
            if (Config.GetValue("DuongDanPlugins") != null)
            {
                _pluginPath = Config.GetValue("DuongDanPlugins").ToString() + "\\" + Config.GetValue("Package").ToString() + "\\";
            }
            else
            {
                _pluginPath = System.Windows.Forms.Application.StartupPath + "\\Plugins\\" + Config.GetValue("Package").ToString() + "\\";
            }

            if (!Directory.Exists(_pluginPath))
            {
                return;
            }
            string[] dllFiles = Directory.GetFiles(_pluginPath, "*.dll");
            foreach (string str in dllFiles)
            {
                FileInfo     f           = new FileInfo(str);
                string       t           = f.Name.Split(".".ToCharArray())[0];
                string       pluginName  = t + "." + t;
                ObjectHandle oh          = Activator.CreateComInstanceFrom(str, pluginName);
                ICDTData     pluginClass = oh.Unwrap() as ICDTData;
                if (pluginClass != null)
                {
                    if (!_lstICDTData.Contains(pluginClass))
                    {
                        _lstICDTData.Add(pluginClass);
                        pluginClass.data = Data;
                        pluginClass.AddEvent();
                    }
                }
            }
        }
コード例 #2
0
ファイル: FrmSingleDt.cs プロジェクト: trancongvy/SGDOnline
        private void AddICDTData(CDTData Data)
        {
            if (Config.GetValue("DuongDanPlugins") != null)
            {
                _pluginPath = Config.GetValue("DuongDanPlugins").ToString() + "\\" + Config.GetValue("Package").ToString() + "\\";
            }
            else
            {
                _pluginPath = System.Windows.Forms.Application.StartupPath + "\\Plugins\\" + Config.GetValue("Package").ToString() + "\\";
            }

            if (!Directory.Exists(_pluginPath))
            {
                return;
            }
            string[] dllFiles = Directory.GetFiles(_pluginPath, "*.dll");
            foreach (string str in dllFiles)
            {
                FileInfo     f           = new FileInfo(str);
                string       t           = f.Name.Split(".".ToCharArray())[0];
                string       pluginName  = t + "." + t;
                ObjectHandle oh          = Activator.CreateComInstanceFrom(str, pluginName);
                ICDTData     pluginClass = oh.Unwrap() as ICDTData;
                if (pluginClass != null)
                {
                    if (!_lstICDTData.Contains(pluginClass))
                    {
                        _lstICDTData.Add(pluginClass);
                        pluginClass.gc       = this.gcMain;
                        pluginClass.gv       = this.gvMain;
                        pluginClass.be       = this._frmDesigner._BaseList;
                        pluginClass.lo       = this._frmDesigner._LayoutList;
                        pluginClass.glist    = this._frmDesigner._glist;
                        pluginClass.rlist    = this._frmDesigner.rlist;
                        pluginClass.gridList = this._frmDesigner._gcDetail;
                        pluginClass.Refresh += new EventHandler(pluginClass_Refresh);
                        pluginClass.data     = Data;
                    }
                }
            }
        }