當前位置: 首頁>>代碼示例>>C#>>正文


C# Bootstrapper.Bootstrap方法代碼示例

本文整理匯總了C#中Bootstrapper.Bootstrap方法的典型用法代碼示例。如果您正苦於以下問題:C# Bootstrapper.Bootstrap方法的具體用法?C# Bootstrapper.Bootstrap怎麽用?C# Bootstrapper.Bootstrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bootstrapper的用法示例。


在下文中一共展示了Bootstrapper.Bootstrap方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var bootstrapper = new Bootstrapper();
            var shellView = bootstrapper.Bootstrap();

            var bus = bootstrapper.Resolve<IMessageBus>();

            bus.RegisterMessageSource(this.GetActivated().Select(_ => new ApplicationActivatedMessage()));
            bus.RegisterMessageSource(this.GetDeactivated().Select(_ => new ApplicationDeactivatedMessage()));

            shellView.Window.Show();

            MainWindow = shellView.Window;
            ShutdownMode = ShutdownMode.OnMainWindowClose;

            var toastWindow = bootstrapper.Resolve<IToastWindow>();
            toastWindow.Window.Show();

            //int i = 1;
            //bus.RegisterMessageSource(Observable.Interval(TimeSpan.FromSeconds(3)).Select(_ => i++)
            //    .Take(100).Select(num => new ShowToastMessage(
            //    new NotificationMessage(
            //        new Room { Name = "Ohai " + num },
            //        new User { Name = "Arild" },
            //        new Message { Body = "Ohai thar " + num, MessageTypeString = MessageType.TextMessage.ToString() }),
            //        new ShowToastNotificationAction())));
        }
開發者ID:Doomblaster,項目名稱:MetroFire,代碼行數:29,代碼來源:App.xaml.cs

示例2: Main

        static void Main(string[] args)
        {
            var host = System.Configuration.ConfigurationManager.AppSettings["jibbr:host"];
            var userName = System.Configuration.ConfigurationManager.AppSettings["jibbr:username"];
            var password = System.Configuration.ConfigurationManager.AppSettings["jibbr:password"];

            ServicePointManager.DefaultConnectionLimit = 100;

            var bootstrapper = new Bootstrapper();
            var container = bootstrapper.Bootstrap();
            var robot = container.GetInstance<IRobot>();

            try
            {
                robot.SetupClient(new Uri(host));

                robot.Connect(userName, password);

                var url = new UriBuilder
                {
                    Scheme = "http",
                    Host = "localhost",
                    Port = 1326
                };

                using (WebApplication.Start<Startup>(url.ToString()))
                {
                    Console.WriteLine("Server running on {0}", url);
                    Task.Factory.StartNew(() => SpinWait.SpinUntil(() => Console.KeyAvailable && Console.ReadKey().Key == ConsoleKey.Escape)).Wait();
                }

                robot.Disconnect();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("error while running");

                while (ex != null)
                {
                    Console.Error.WriteLine(ex.ToString());
                    ex = ex.InnerException;
                }

                Console.ReadLine();
            }

            Console.WriteLine("Robot disconnected");
        }
開發者ID:xt0rted,項目名稱:JibbR,代碼行數:48,代碼來源:Program.cs

示例3: Application_Start

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            //RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);

            var bootstrapper = new Bootstrapper();
            bootstrapper.Bootstrap(
                reg => reg.For<IModelRegistru>().Singleton().Use<Models.RegistrPresSluzbu>()
                );
            var controllerFactory = bootstrapper.Get<StructureMapControllerFactory>();
            ControllerBuilder.Current.SetControllerFactory(controllerFactory);
        }
開發者ID:rosic,項目名稱:Soupiska,代碼行數:16,代碼來源:Global.asax.cs

示例4: Main

        static void Main(string[] args)
        {
            var bootstrapper = new Bootstrapper();
            bootstrapper.Bootstrap();

            var sluzba = bootstrapper.Get<IRegistr>();

            bool spustKonzoli = false;
            var argsParser = new Dictionary<string, Argument>(StringComparer.OrdinalIgnoreCase)
            {
                {"console", new Argument("console", val => spustKonzoli = true)}
            };

            foreach (string param in args)
            {
                var parts = Argument.Parse(param);
                if (argsParser.ContainsKey(parts[0]))
                    argsParser[parts[0]].SetValue(parts[1]);
            }

            var spoustec = new SpoustecSluzby(sluzba);
            if (spustKonzoli)
            {
                spoustec.Start();
                Log.ZapisRadek("Press <Enter> to stop the service.");
                Console.ReadLine();
                spoustec.Stop();
            }
            else
            {
                string logPath = string.Format("{0}\\{1}-log.txt",
                                               AppDomain.CurrentDomain.BaseDirectory,
                                               DateTime.Today.ToString("yyyy-MM-dd"));
                using (var logFile = File.Open(logPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
                {
                    Log.NastavVystup(new StreamWriter(logFile));
                    var windows = new WindowsSluzba(spoustec);
                    ServiceBase.Run(windows);
                    logFile.Flush();
                }
            }
        }
開發者ID:rosic,項目名稱:Soupiska,代碼行數:42,代碼來源:Program.cs

示例5: ThenIWantToKnowWhatSInTheContainer

 public void ThenIWantToKnowWhatSInTheContainer()
 {
     var bootstrapper = new Bootstrapper();
     bootstrapper.Bootstrap(new string[]{});
     Console.WriteLine(bootstrapper.Container.WhatDoIHave());
 }
開發者ID:ArildF,項目名稱:PTB,代碼行數:6,代碼來源:ContainerSteps.cs


注:本文中的Bootstrapper.Bootstrap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。