예제 #1
0
        private bool LoadModule(string moduleName)
        {
            try
            {
                string facadeClass = "PAT." + moduleName + ".ModuleFacade";
                string file = (new FileInfo("PAT.Module." + moduleName + ".dll")).FullName;

                Assembly assembly = Assembly.LoadFrom(file);
                CurrentModule = (ModuleFacadeBase)assembly.CreateInstance(
                                                           facadeClass,
                                                           true,
                                                           BindingFlags.CreateInstance,
                                                           null, null,
                                                           null, null);

                if (CurrentModule.GetType().Namespace != "PAT." + moduleName)
                {
                    CurrentModule = null;
                    return false;
                }
                CurrentModule.ReadConfiguration();

                return true;
            }
            catch { }

            return false;
        }
예제 #2
0
        private bool createModule()
        {
            bool ret = false;
            do
            {
                string moduleName = "KWSN Model";
                if (mModule != null && mModule.ModuleName == moduleName)
                    break;

                string facadeClass = "PAT." + moduleName + ".ModuleFacade";
                string file = Path.Combine(Path.Combine(Utilities.ModuleFolderPath, moduleName), "PAT.Module." + moduleName + ".dll");

                Assembly assembly = Assembly.LoadFrom(file);
                mModule = (ModuleFacadeBase)assembly.CreateInstance(
                                                       facadeClass,
                                                       true,
                                                       BindingFlags.CreateInstance,
                                                       null, null,
                                                       null, null);

                if (mModule.GetType().Namespace != "PAT." + moduleName)
                {
                    mModule = null;
                    break;
                }

                // mModule.ShowModel += new ShowModelHandler(ShowModel);
                // mModule.ExampleMenualToolbarInitialize(this.MenuButton_Examples);
                mModule.ReadConfiguration();
                ret = true;
            } while (false);

            return ret;
        }
예제 #3
0
        private bool loadModule(string moduleName)
        {
            bool ret = true;

            do
            {
                try
                {
                    if (Common.Utility.Utilities.ModuleDictionary.ContainsKey(moduleName))
                    {
                        if (mCModule == null || moduleName != mCModule.ModuleName)
                            mCModule = Common.Utility.Utilities.ModuleDictionary[moduleName];
                        break;
                    }

                    string facadeClass = "PAT." + moduleName + ".ModuleFacade";
                    string file = Path.Combine(Path.Combine(Common.Utility.Utilities.ModuleFolderPath, moduleName), "PAT.Module." + moduleName + ".dll");

                    Assembly assembly = Assembly.LoadFrom(file);
                    mCModule = (ModuleFacadeBase)assembly.CreateInstance(facadeClass, true, BindingFlags.CreateInstance,
                                                           null, null, null, null);

                    if (mCModule.GetType().Namespace != "PAT." + moduleName)
                    {
                        mCModule = null;
                        ret = false;
                        break;
                    }

                    //mCModule.ShowModel += new ShowModelHandler(ShowModel);
                    //mCModule.ExampleMenualToolbarInitialize(this.MenuButton_Examples);
                    mCModule.ReadConfiguration();
                }
                catch { }
            } while (false);

            return ret;
        }