当前位置: 首页>>代码示例>>C#>>正文


C# Application.Run方法代码示例

本文整理汇总了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();
            }
开发者ID:Pokat,项目名称:Life,代码行数:35,代码来源:Class1.cs

示例2: Main

        public static void Main()
        {
            var application = new Application();

            application.NewFile += Aplication_NewFile;
            application.Run();
        }
开发者ID:nagyist,项目名称:monoxide,代码行数:7,代码来源:Program.cs

示例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();
    }
开发者ID:nikhilk,项目名称:simplecloud,代码行数:25,代码来源:Startup.cs

示例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);
    }
开发者ID:KyMaP13,项目名称:Lecture,代码行数:27,代码来源:L2S01.cs

示例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();
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:XClockEmbed.cs

示例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);
 }
开发者ID:BUUAVTeam,项目名称:SimplySim,代码行数:8,代码来源:Program.cs

示例7: ApplicationThread

        /// <summary>
        /// Creates a New Window Application
        /// </summary>
        void ApplicationThread()
        {
            Application app = new Application();

            Window mainWindow = CreateWindow();

            // Start the application
            app.Run(mainWindow);
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:12,代码来源:Master.cs

示例8: Main

        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            using (Application app = new Application())
            {
                app.Run();
            }
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:9,代码来源:Program.cs

示例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();
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:XHello.cs

示例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());
        }
开发者ID:uldissturms,项目名称:BingSearch,代码行数:11,代码来源:ApplicationTest.cs

示例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));
        }
开发者ID:uldissturms,项目名称:BingSearch,代码行数:11,代码来源:ApplicationTest.cs

示例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();
        }
开发者ID:FloodProject,项目名称:flood,代码行数:12,代码来源:Runtime.cs

示例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();
 }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:12,代码来源:Application.cs

示例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();
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:12,代码来源:ViewController.cs

示例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();
        }
开发者ID:uldissturms,项目名称:BingSearch,代码行数:13,代码来源:ApplicationTest.cs


注:本文中的Application.Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。