本文整理汇总了C#中Application.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Application.Run方法的具体用法?C# Application.Run怎么用?C# Application.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
i = new Image();
RenderOptions.SetBitmapScalingMode(i, BitmapScalingMode.NearestNeighbor);
RenderOptions.SetEdgeMode(i, EdgeMode.Aliased);
w = new Window();
w.Content = i;
w.Show();
writeableBitmap = new WriteableBitmap(
(int)w.ActualWidth,
(int)w.ActualHeight,
96,
96,
PixelFormats.Bgr32,
null);
i.Source = writeableBitmap;
i.Stretch = Stretch.None;
i.HorizontalAlignment = HorizontalAlignment.Left;
i.VerticalAlignment = VerticalAlignment.Top;
i.MouseMove += new MouseEventHandler(i_MouseMove);
i.MouseLeftButtonDown +=
new MouseButtonEventHandler(i_MouseLeftButtonDown);
i.MouseRightButtonDown +=
new MouseButtonEventHandler(i_MouseRightButtonDown);
w.MouseWheel += new MouseWheelEventHandler(w_MouseWheel);
Application app = new Application();
app.Run();
}
示例2: Main
public static void Main()
{
var application = new Application();
application.NewFile += Aplication_NewFile;
application.Run();
}
示例3: Startup
static Startup()
{
CommandModel commandModel =
new CommandModel("sc").AddArgument("port", new CommandArgument("type", "number"))
.AddArgument("path", new CommandArgument("type", "string"))
.AddArgument("logs", new CommandArgument("type", "boolean"));
ApplicationOptions options;
try {
options = (ApplicationOptions)CommandLine.Parse(commandModel);
options.Port = Script.Or(options.Port, Number.ParseInt(Node.Process.Environment["PORT"]), 1337);
options.Path = Script.Or(options.Path, Node.Process.GetCurrentDirectory());
Runtime.EnableTrace = options.Logs;
}
catch (Exception e) {
Console.Log(e.Message);
Console.Log(commandModel.ToString());
return;
}
Application app = new Application(options);
app.Run();
}
示例4: MainX
public static void MainX()
{
var label = new Label();
label.Content = "Hello, WPF!";
label.Width=100;
label.Height=30;
var button = new Button();
button.Click += button_Click;
button.Content = "OK";
button.Width=50;
button.Height=30;
var canvas = new Canvas();
canvas.Children.Add(label);
canvas.Children.Add(button);
Canvas.SetTop(button, 40);
Canvas.SetLeft(button, 35);
var wnd = new Window();
wnd.Content = canvas;
wnd.Width= 140;
wnd.Height = 140;
var app = new Application();
app.Run(wnd);
}
示例5: Main
// Main entry point.
public static void Main(String[] args)
{
Application app = new Application("XClockEmbed", args);
XClockEmbed topLevel = new XClockEmbed("Embedded Clock", 200, 200);
topLevel.Map();
app.Run();
app.Close();
}
示例6: Main
static void Main(string[] args)
{
Application app = new Application (new Window(1024, 768, "Drone Simulation"));
// Create a new simulation instance
Simulation simulation = new Simulation(app.MainWindow);
// Run the simulation
app.Run(simulation);
}
示例7: ApplicationThread
/// <summary>
/// Creates a New Window Application
/// </summary>
void ApplicationThread()
{
Application app = new Application();
Window mainWindow = CreateWindow();
// Start the application
app.Run(mainWindow);
}
示例8: Main
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
using (Application app = new Application())
{
app.Run();
}
}
示例9: Main
// Main entry point.
public static void Main(String[] args)
{
Application app = new Application("XHello", args);
Image image = new Image("dotgnu-logo.bmp");
XHello topLevel = new XHello
("Hello DotGNU!", image.Width, image.Height, image);
topLevel.Map();
app.Run();
app.Close();
}
示例10: Run_BingConsumerPresent_BingConsumerGetsConsumed
public void Run_BingConsumerPresent_BingConsumerGetsConsumed()
{
var consumerMock = new Mock<IBingConsumer>();
var settings = new BingSearchSettings { Times = 1 };
var app = new Application(settings, consumerMock.Object);
app.Run();
consumerMock.Verify(x => x.Consume(It.IsAny<string>()), Times.Once());
}
示例11: Run_BingConsumer2Times_BingConsumerGetsConsumed2Times
public void Run_BingConsumer2Times_BingConsumerGetsConsumed2Times()
{
var consumerMock = new Mock<IBingConsumer>();
var settings = new BingSearchSettings { Times = 2 };
var app = new Application(settings, consumerMock.Object);
app.Run();
consumerMock.Verify(x => x.Consume(It.IsAny<string>()), Times.Exactly(2));
}
示例12: Main
public static void Main(string[] args)
{
var app = new Application();
var moduleDir = Path.Combine(Directory.GetCurrentDirectory(), "Modules");
app.ModuleManager.ModuleLibrary.AddDirectory(moduleDir);
app.ModuleManager.LoadModule(new ModuleId("Editor.Client", 0));
app.ModuleManager.LoadModule(new ModuleId("TextAddin", 0));
app.Run();
}
示例13: Main
public static void Main(string[] Arguments)
{
Application app = new Application();
app.Init(Arguments);
try {
app.Run();
} catch(Exception e) {
Console.WriteLine("Exception: " + e.Message);
Console.WriteLine(e.StackTrace);
}
app.Deinit();
}
示例14: RunSample
async void RunSample(Type type)
{
if (currentApp != null)
{
await currentApp.Exit();
GC.Collect();
await Task.Delay(10); //small workaround, will be fixed
}
currentApp = (Application)Activator.CreateInstance(type, options);
await Task.Yield();
currentApp.Run();
}
示例15: Run_BingConsumerDowntime_ShouldNotThrow
public void Run_BingConsumerDowntime_ShouldNotThrow()
{
var consumerMock = new Mock<IBingConsumer>();
var settings = new BingSearchSettings { Times = 1 };
consumerMock.Setup(x => x.Consume(It.IsAny<string>())).Throws<HttpRequestException>();
var app = new Application(settings, consumerMock.Object);
Action action = () => app.Run();
action.ShouldNotThrow();
}