コード例 #1
0
        private static void Main(string[] args)
        {
#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            Application.ThreadException += ApplicationThreadException;
#endif

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

            IApplicationServices services = ApplicationServices.Instance;

            ConfigureContainer(services);

            services.LoadPlugIn(new CoreApplicationPlugIn());
            services.LoadPlugIn(new ConnectionStringsManagerLoader());
            services.LoadPlugIn(new DatabaseInspectorLoader());
            services.LoadPlugIn(new ViewTableLoader());
            services.LoadPlugIn(new TemplateViewerLoader());
            services.LoadPlugIn(new SearchToolsLoader());
            services.LoadPlugIn(new TextGeneratorLoader());

            if (services.Settings.LoadExternalPlugins)
            {
                var plugins = PlugInUtility.GetInstances <IPlugIn>(Environment.CurrentDirectory, Settings.Default.PlugInFileFilter);
                Array.Sort(plugins, new PlugInComparer());
                foreach (var plugin in plugins)
                {
                    services.LoadPlugIn(plugin);
                }
            }

            services.HostWindow.SetArguments(args);
            Application.Run(services.HostWindow.Instance);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: shuicheng9/sap_interface
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
            //log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //log.Info("程序开始,加载SAP配置!!");

            //SAPINT.SapConfig.SAPConfigFromFile.LoadSAPAllConfig();
            //SAPINT.SapConfig.SAPConfigFromFile.LoadSAPClientConfig();


            //IOC入口,获取主程序的实例
            IApplicationServices services = ApplicationServices.Instance;

            //加载程序内部服务
            ConfigureContainer(services);

            //跟上面不同,以下加载内部插件
            services.LoadPlugIn(new CoreApplicationPlugIn());
            services.LoadPlugIn(new ConnectionStringsManagerLoader());
            services.LoadPlugIn(new DatabaseInspectorLoader());
            services.LoadPlugIn(new ViewTableLoader());
            services.LoadPlugIn(new TemplateViewerLoader());
            services.LoadPlugIn(new SearchToolsLoader());
            services.LoadPlugIn(new TextGeneratorLoader());

            //加载外部插件
            if (services.Settings.LoadExternalPlugins)
            {
                var plugins = PlugInUtility.GetInstances <IPlugIn>(Environment.CurrentDirectory, Settings.Default.PlugInFileFilter);
                Array.Sort(plugins, new PlugInComparer());
                foreach (var plugin in plugins)
                {
                    services.LoadPlugIn(plugin);
                }
            }

            //插件加载完!!!

            //services.HostWindow = services.Container.Resolve<IHostWindow>();
            //services.HostWindow.SetArguments(args);
            MainForm mainform = (MainForm)services.HostWindow;

            // mainform.Serivices = services;
            //  mainform.Settings = services.Settings;
            mainform.SetArguments(args);

            Application.Run(mainform);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: shuicheng9/sap_interface
        public static void LoadForm(string[] args)
        {
            //IOC入口,获取主程序的实例
            IApplicationServices services = ApplicationServices.Instance;

            //加载程序内部服务
            ConfigureContainer(services);

            //跟上面不同,以下加载内部插件
            services.LoadPlugIn(new CoreApplicationPlugIn());
            services.LoadPlugIn(new ConnectionStringsManagerLoader());
            services.LoadPlugIn(new DatabaseInspectorLoader());
            services.LoadPlugIn(new ViewTableLoader());
            services.LoadPlugIn(new TemplateViewerLoader());
            services.LoadPlugIn(new SearchToolsLoader());
            services.LoadPlugIn(new TextGeneratorLoader());

            //加载外部插件
            if (services.Settings.LoadExternalPlugins)
            {
                var plugins = PlugInUtility.GetInstances <IPlugIn>(Environment.CurrentDirectory, Settings.Default.PlugInFileFilter);
                Array.Sort(plugins, new PlugInComparer());
                foreach (var plugin in plugins)
                {
                    services.LoadPlugIn(plugin);
                }
            }

            //插件加载完!!!

            //services.HostWindow = services.Container.Resolve<IHostWindow>();
            //services.HostWindow.SetArguments(args);
            MainForm mainform = (MainForm)services.HostWindow;

            // mainform.Serivices = services;
            //  mainform.Settings = services.Settings;
            mainform.SetArguments(args);
            mainform.Show();
        }