コード例 #1
0
 /// <summary>
 /// 初始化本地程序集框架
 /// </summary>
 public static IAppBuilder UseLocalInitialize(this IAppBuilder app, LocalInitializeOptions options)
 {
     options.CheckNotNull("options");
     IFrameworkInitializer initializer = new LocalFrameworkInitializer(options);
     initializer.Initialize();
     return app;
 }
コード例 #2
0
        /// <summary>
        /// 初始化本地程序集框架
        /// </summary>
        public static IAppBuilder UseLocalInitialize(this IAppBuilder app, LocalInitializeOptions options)
        {
            options.CheckNotNull("options");
            IFrameworkInitializer initializer = new LocalFrameworkInitializer(options);

            initializer.Initialize();
            return(app);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: fuwei199006/osharp
        private static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("正在初始化,请稍候……");
                Stopwatch watch = Stopwatch.StartNew();

                Log4NetLoggingInitializer loggingInitializer = new Log4NetLoggingInitializer();
                ConsolesAutofacInitializer iocInitializer = new ConsolesAutofacInitializer();
                LocalInitializeOptions options = new LocalInitializeOptions(loggingInitializer, iocInitializer);
                IFrameworkInitializer initializer = new LocalFrameworkInitializer(options);
                initializer.Initialize();

                _program = iocInitializer.Resolver.Resolve<Program>();
                watch.Stop();
                Console.WriteLine("程序初始化完毕并启动成功,耗时:{0}", watch.Elapsed);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.FormatMessage());
                Console.ReadLine();
                return;
            }
            bool exit = false;
            while (true)
            {
                try
                {
                    Console.WriteLine(@"请输入命令:0; 退出程序,功能命令:1 - n");
                    string input = Console.ReadLine();
                    if (input == null)
                    {
                        continue;
                    }
                    switch (input.ToLower())
                    {
                        case "0":
                            exit = true;
                            break;
                        case "1":
                            Method01();
                            break;
                        case "2":
                            Method02();
                            break;
                        case "3":
                            Method03();
                            break;
                        case "4":
                            Method04();
                            break;
                        case "5":
                            Method05();
                            break;
                        case "6":
                            Method06();
                            break;
                        case "7":
                            Method07();
                            break;
                        case "8":
                            Method08();
                            break;
                        case "9":
                            Method09();
                            break;
                        case "10":
                            Method10();
                            break;
                        case "11":
                            Method11();
                            break;
                        case "12":
                            Method12();
                            break;
                        case "13":
                            Method13();
                            break;
                        case "14":
                            Method14();
                            break;
                        case "15":
                            Method15();
                            break;
                        case "16":
                            Method16();
                            break;
                        case "17":
                            Method17();
                            break;
                        case "18":
                            Method18();
                            break;
                    }
                    if (exit)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.FormatMessage());
                }
            }
        }