本文整理汇总了C#中App.Start方法的典型用法代码示例。如果您正苦于以下问题:C# App.Start方法的具体用法?C# App.Start怎么用?C# App.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App.Start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
var app = new App();
app.RegisterSingleton<Grid>();
app.RegisterSingleton<Controller>();
app.RegisterSingleton<JewelBlocksContent>();
app.RegisterSingleton<Soundbank>();
app.Start<Game>();
}
示例2: Run
public void Run()
{
var services = new[] { new MultipartFormDataParser() };
var steps = new[] {
fu.Map.Urls(new ContMap {
{ "^/$", fu.Compose(fu.Static.File("index.html"), fu.Result.Render()) },
{ "^/sepia$", makeSepia() },
})
};
var app = new App(null, services, steps);
app.Start();
}
示例3: Main
// ***
// REPLACE THE METHODS WITHIN THESE MARKERS WITH THE METHODS DEFINED IN YOUR MANIFEST.
// ***
/// <summary>
/// MODIFY THIS MAIN METHOD WITH CARE.
/// The entry point of the program, where the program control starts and ends.
/// </summary>
/// <param name="args">The command-line arguments.</param>
public static void Main(string[] args)
{
// Create App instance.
App app = new App();
// Start app.
app.Start();
}
示例4: Main
public static void Main(string[] args)
{
var app = new App(null, null, forwardRequest());
app.Start();
}
示例5: Main
public static void Main(string[] args)
{
#if !__MonoCS__
handler = new ConsoleEventDelegate(ConsoleEventCallback);
SetConsoleCtrlHandler(handler, true);
#else
// http://stackoverflow.com/questions/6546509/detect-when-console-application-is-closing-killed
var signums = new Signum []
{
Signum.SIGABRT,
Signum.SIGINT,
Signum.SIGKILL,
Signum.SIGQUIT,
Signum.SIGTERM,
Signum.SIGSTOP,
Signum.SIGTSTP
};
List<UnixSignal> signals = new List<UnixSignal>();
foreach (var signum in signums)
{
try
{
signals.Add(new UnixSignal(signum));
}
catch(Exception) {}
}
new Thread (delegate ()
{
// Wait for a signal to be delivered
UnixSignal.WaitAny(signals.ToArray(), -1);
app.Shutdown("UnixSignal");
}).Start();
#endif
if (string.IsNullOrWhiteSpace(Settings.Default.TempPath))
{
Settings.Default.TempPath = Settings.Default.GetAppDataPath() + "tmp";
}
if (!Settings.Default.TempPath.EndsWith("" + Path.DirectorySeparatorChar))
{
Settings.Default.TempPath += Path.DirectorySeparatorChar;
}
new DirectoryInfo(Settings.Default.TempPath).Create();
if (string.IsNullOrWhiteSpace(Settings.Default.ReadyPath))
{
Settings.Default.ReadyPath = Settings.Default.GetAppDataPath() + "dl";
}
if (!Settings.Default.ReadyPath.EndsWith("" + Path.DirectorySeparatorChar))
{
Settings.Default.ReadyPath += Path.DirectorySeparatorChar;
}
new DirectoryInfo(Settings.Default.ReadyPath).Create();
Settings.Default.Save();
if (File.Exists(Settings.Default.GetAppDataPath() + "log4net.xml"))
{
// load settings from file
XmlConfigurator.Configure(new FileInfo(Settings.Default.GetAppDataPath() + "log4net.xml"));
}
else
{
// build our own, who logs only fatals to console
Logger root = ((Hierarchy)LogManager.GetRepository()).Root;
var lAppender = new ConsoleAppender
{
Name = "Console",
Layout = new PatternLayout("%date{dd-MM-yyyy HH:mm:ss,fff} %5level [%2thread] %line:%logger.%message%n"),
#if DEBUG
Threshold = Level.Info
#else
Threshold = Level.Fatal
#endif
};
lAppender.ActivateOptions();
root.AddAppender(lAppender);
root.Repository.Configured = true;
}
#if __MonoCS__
PlatformID id = Environment.OSVersion.Platform;
// Don't allow running as root on Linux or Mac
try
{
if ((id == PlatformID.Unix || id == PlatformID.MacOSX) && new UnixUserInfo(UnixEnvironment.UserName).UserId == 0)
{
LogManager.GetLogger(typeof(Programm)).Fatal("Sorry, you can't run XG with these permissions. Safety first!");
Environment.Exit(-1);
}
}
catch (ArgumentException)
{
// arch linux fix
// https://github.com/lformella/xdcc-grabscher/issues/36
}
//.........这里部分代码省略.........