本文整理匯總了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())));
}
示例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");
}
示例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);
}
示例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();
}
}
}
示例5: ThenIWantToKnowWhatSInTheContainer
public void ThenIWantToKnowWhatSInTheContainer()
{
var bootstrapper = new Bootstrapper();
bootstrapper.Bootstrap(new string[]{});
Console.WriteLine(bootstrapper.Container.WhatDoIHave());
}