Example #1
0
            static public ModuleImplementation GetModuleType(string moduleType)
            {
                ModuleImplementation implementation = null;

                _instance._moduleTypes.TryGetValue(moduleType, out implementation);
                return(implementation);
            }
Example #2
0
        static private IEnumerable <IModuleDescriptor> _LoadModuleDescriptors(IEnumerable <string> filePaths)
        {
            List <IModuleDescriptor> descriptors = new List <IModuleDescriptor>();

            foreach (string filePath in filePaths)
            {
                try {
                    // Determine what kind of module it is so its descriptor can be added
                    // to that implementation's descriptor list.
                    ModuleImplementation moduleImplementation = _FindImplementation(filePath);
                    if (moduleImplementation == null)
                    {
                        VixenSystem.Logging.Error("File " + filePath + " was not loaded because its module type could not be determined.");
                        continue;
                    }
                    // Try to get descriptors.
                    IEnumerable <IModuleDescriptor> descriptorsFound = _LoadModuleDescriptors(filePath);
                    descriptors.AddRange(descriptorsFound);
                    _moduleImplementationDescriptors[moduleImplementation].AddRange(descriptorsFound);
                } catch (BadImageFormatException) {
                } catch (ReflectionTypeLoadException ex) {
                    foreach (Exception loaderException in ex.LoaderExceptions)
                    {
                        VixenSystem.Logging.Error("Loader exception:" + Environment.NewLine + loaderException.Message, loaderException);
                    }
                } catch (Exception ex) {
                    VixenSystem.Logging.Error("Error loading modules from " + filePath, ex);
                }
            }

            return(descriptors);
        }
Example #3
0
        private static void Main(string[] args)
        {
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en");

            culture.NumberFormat.NumberDecimalSeparator = ".";
            Thread.CurrentThread.CurrentCulture         = culture;

            //Application.SetCompatibleTextRenderingDefault(false);
            Application.EnableVisualStyles();
            Application.DoEvents();


            MainForm newForm1 = MainForm.Instance;
            object   oBox     = newForm1;

            var oImpl = new ModuleImplementation(
                "AutoCSharp", "Auto CSharp", LowLevel.ModuleManagementType.UniqueModule,
                "Direct Interface to AUTO2000 with C# frontend");

            oImpl.addService("auto", "Auto2000 (C#)", "/Analysis", "Direct Interface to AUTO2000 with C# frontend",
                             ref oBox);
            oImpl.EnableServices(args);
            MainForm.IsSBWAvailable = true;
            Application.Run(newForm1);
        }
        public static void Main(string[] args)
        {
            try
            {
                BifurcationForm.m_sModuleName = "Bifurcation";
                m_oForm       = new BifurcationForm();
                updateService = new FrontendService();
                object oFrontendObject = updateService;

                var oFrontendModule = new ModuleImplementation(BifurcationForm.m_sModuleName, "Bifurcation Frontend",
                                                               LowLevel.ModuleManagementType.UniqueModule,
                                                               "this module implements a frontend for the bifurcation discovery module");
                oFrontendModule.addService("update", "Bifurcation Discovery Tool", "Analysis",
                                           "implementation of the update function that will be called by the bifurcation module",
                                           ref oFrontendObject);
                oFrontendModule.EnableServices(args);

                oFrontendModule.ModuleShutdown += oFrontendModule_ModuleShutdown;
                Application.EnableVisualStyles();
                Application.DoEvents();
                Application.Run(m_oForm);
            }
            catch (SBWException)
            {
                MessageBox.Show(
                    "An exception occured while trying to register the module. The only possible explenation would be an outdated SBW DLL.",
                    "Error druning module initialization");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error druning module initialization");
            }
        }
Example #5
0
        static private string _GetModuleTypeDirectory(ModuleImplementation moduleImplementation)
        {
            string moduleTypeName      = (moduleImplementation.GetType().GetCustomAttributes(typeof(TypeOfModuleAttribute), false).First() as TypeOfModuleAttribute).Name;
            string moduleTypeDirectory = Path.Combine(Directory, moduleTypeName);

            moduleImplementation.Path = moduleTypeDirectory;
            return(moduleTypeDirectory);
        }
Example #6
0
        static public IModuleDescriptor[] GetDescriptors(string typeOfModule)
        {
            ModuleImplementation moduleImplementation = _moduleImplementationDescriptors.Keys.FirstOrDefault(x => x.TypeOfModule == typeOfModule);

            if (moduleImplementation != null)
            {
                return(_moduleImplementationDescriptors[moduleImplementation].ToArray());
            }
            return(null);
        }
Example #7
0
        static public IModuleRepository GetRepository <T>()
            where T : class, IModuleInstance
        {
            ModuleImplementation moduleImplementation = GetImplementation <T>();

            if (moduleImplementation != null)
            {
                return(moduleImplementation.Repository);
            }
            return(null);
        }
Example #8
0
        static public IModuleManagement GetManager <T>()
            where T : class, IModuleInstance
        {
            ModuleImplementation moduleImplementation = GetImplementation <T>();

            if (moduleImplementation != null)
            {
                return(moduleImplementation.Management);
            }
            return(null);
        }
Example #9
0
        static public U GetManager <T, U>()
            where T : class, IModuleInstance
            where U : class, IModuleManagement <T>
        {
            ModuleImplementation moduleImplementation = GetImplementation <T>();

            if (moduleImplementation != null)
            {
                return(moduleImplementation.Management as U);
            }
            return(null);
        }
Example #10
0
        public static U GetRepository <T, U>()
            where T : class, IModuleInstance
            where U : class, IModuleRepository <T>
        {
            ModuleImplementation moduleImplementation = GetImplementation <T>();

            if (moduleImplementation != null)
            {
                return(moduleImplementation.Repository as U);
            }
            return(null);
        }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T">Module instance type as specified by its ModuleImplementation.</typeparam>
        /// <returns></returns>
        static public IModuleDescriptor[] GetDescriptors <T>()
            where T : class, IModuleInstance
        {
            ModuleImplementation moduleImplementation = GetImplementation <T>();

            if (moduleImplementation != null)
            {
                HashSet <IModuleDescriptor> descriptors;
                if (_moduleImplementationDescriptors.TryGetValue(moduleImplementation, out descriptors))
                {
                    return(descriptors.ToArray());
                }
            }
            return(null);
        }
Example #12
0
        static void Main(string[] args)
        {
            string fileName = null;
              foreach (string arg in args)
              {
            if (arg == "-r" || arg == "--run-test")
            {
              RunTest(args);
              return;
            }
            if (File.Exists(arg))
              fileName = arg;

              }

              var culture = System.Globalization.CultureInfo.CreateSpecificCulture("en");
              culture.NumberFormat.NumberDecimalSeparator = ".";
              Thread.CurrentThread.CurrentCulture = culture;
              try
              {
            Application.CurrentCulture = culture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            formInstance = new MainForm();
            object instance = formInstance;

            var module = new ModuleImplementation(
            "FluxBalance", "Flux Balance Analsysis", LowLevel.ModuleManagementType.UniqueModule,
            "Module performing Flux Balance Analysis on SBML Models");
            module.addService("analysis", "Flux Balance Analysis", "/Analysis", "Module performing Flux Balance Analysis on SBML Models", ref instance);

            module.ModuleShutdown += module_ModuleShutdown;

            module.EnableServices(args);

            if (fileName != null)
              formInstance.LoadSBMLFile(fileName);

            Application.Run(formInstance);
              }
              catch (Exception e)
              {
            Console.WriteLine(e);
              }
        }
Example #13
0
        private static void Main(string[] args)
        {
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en");
            culture.NumberFormat.NumberDecimalSeparator = ".";
            Thread.CurrentThread.CurrentCulture = culture;

            //Application.SetCompatibleTextRenderingDefault(false);
            Application.EnableVisualStyles();
            Application.DoEvents();

            MainForm newForm1 = MainForm.Instance;
            object oBox = newForm1;

            var oImpl = new ModuleImplementation(
                "AutoCSharp", "Auto CSharp", LowLevel.ModuleManagementType.UniqueModule,
                "Direct Interface to AUTO2000 with C# frontend");
            oImpl.addService("auto", "Auto2000 (C#)", "/Analysis", "Direct Interface to AUTO2000 with C# frontend",
                             ref oBox);
            oImpl.EnableServices(args);
            MainForm.IsSBWAvailable = true;
            Application.Run(newForm1);
        }