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


C# App.Run方法代码示例

本文整理汇总了C#中App.Run方法的典型用法代码示例。如果您正苦于以下问题:C# App.Run方法的具体用法?C# App.Run怎么用?C# App.Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            App app = new App();
#if !DEBUG
            Console.WriteLine("NOT in DEBUG mode");
            try
            {
                app.Run(new MainWindow());
            }

            catch (Exception e)
            {
                ErrorWindow ew = new ErrorWindow();
                if (e.StackTrace != null)
                    ew.Message = "In " + e.TargetSite + ": " + e.Message +
                        ";\r\n" + e.StackTrace;
                else
                    ew.Message = "In EEGArtifactEditor: " + e.Message;
                ew.ShowDialog();
            }
#else
            Console.WriteLine("In DEBUG mode");
            app.Run(new MainWindow());
#endif
        }
开发者ID:DOPS-CCI,项目名称:CCI_project,代码行数:25,代码来源:App.cs

示例2: Main

		public static void Main(string[] args)
        {
            App app = new App();
            if(args.Count()>=1)
			{
				app.Run(new Window1(args[0]));
			}
			else
			{
				app.Run(new Window1(""));
			}
        }
开发者ID:Team624,项目名称:2015Beta,代码行数:12,代码来源:Startup.cs

示例3: OnStartup

 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     app = new App();
        //app.InitializeComponent();
        app.Run();
        return false;
 }
开发者ID:IvanYang,项目名称:ApolloOa2011,代码行数:7,代码来源:Single.cs

示例4: Main

 static void Main()
 {
     using (App game = new App())
     {
         game.Run();
     }
 }
开发者ID:Kitsune001,项目名称:Samples,代码行数:7,代码来源:Program.cs

示例5: Main

        public static void Main()
        {
            // before actually starting up, check if there is already an instance running
            if (SingleInstance<App>.InitializeAsFirstInstance(UniqueAppName))
            {
                var application = new App();
                application.InitializeComponent();
                application.Run();

                // Allow single instance code to perform cleanup operations
                SingleInstance<App>.Cleanup();

                // then do the rest
                if (null == Current)
                {
                    new Application();
                }

                Current.DispatcherUnhandledException += App_DispatcherUnhandledException;
                Current.SessionEnding += App_SessionEnding;
            }
            //else
            //{
            //    var msg = "An instance of PersonalAnalytics was already running. Access it from the task bar on the bottom right of your screen.";
            //    MessageBox.Show("Info", msg);
            //}
        }
开发者ID:sealuzh,项目名称:PersonalAnalytics,代码行数:27,代码来源:App.xaml.cs

示例6: Main

		static void Main()
		{
			App app = new App();
			Current.Resources.MergedDictionaries.Add(LoadComponent(
													 new Uri("Controls;component/Themes/Styles.xaml", UriKind.Relative)) as ResourceDictionary);
			app.Run();
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:App.cs

示例7: Main

        public static void Main()
        {
            // Set the image file's build action to "Resource" and "Never copy" for this to work.
            if (!Debugger.IsAttached)
            {
                App.SplashScreen = new SplashScreen("Images/TxFlag_256.png");
                App.SplashScreen.Show(false, true);
            }

            // Set up FieldLog
            FL.AcceptLogFileBasePath();
            FL.RegisterPresentationTracing();
            TaskHelper.UnhandledTaskException = ex => FL.Critical(ex, "TaskHelper.UnhandledTaskException", true);

            // Keep the setup away
            GlobalMutex.Create("Unclassified.TxEditor");

            App.InitializeSettings();

            // Make sure the settings are properly saved in the end
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

            // Setup logging
            //Tx.LogFileName = "tx.log";
            //Tx.LogFileName = "";
            //Environment.SetEnvironmentVariable("TX_LOG_UNUSED", "1", EnvironmentVariableTarget.User);
            //Environment.SetEnvironmentVariable("TX_LOG_UNUSED", null, EnvironmentVariableTarget.User);

            InitializeLocalisation();

            App app = new App();
            app.InitializeComponent();
            app.Run();
        }
开发者ID:uxoricide,项目名称:TxTranslation,代码行数:34,代码来源:Program.cs

示例8: Main

		static void Main()
		{
			ServiceFactory.StartupService.Run();
			var app = new App();
			ServiceFactory.ResourceService.AddResource(typeof(UIBehavior).Assembly, "Themes/Styles.xaml");
			app.Run();
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:App.cs

示例9: Main

        public static void Main()
        {
            if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
            {
#if !DEBUG
                Update().Wait();
#endif
                Logger.Info("Starting up.");
                // Initialize process helper
                ProcessHelper.Instance.Initialize();

                var application = new App();
                application.InitializeComponent();
                application.ShutdownMode = ShutdownMode.OnMainWindowClose;

                // register unhandled exceptions
                AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
                Current.DispatcherUnhandledException += CurrentOnDispatcherUnhandledException;
                TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

                application.Run();

                Logger.Info("Closing.");
                // Allow single instance code to perform cleanup operations
                SingleInstance<App>.Cleanup();
                Environment.Exit(0);//application doesn't fully exit without this for some reason
            }
        }
开发者ID:DzenDyn,项目名称:CasualMeter,代码行数:28,代码来源:App.xaml.cs

示例10: Main

        public static int Main()
        {
            int functionReturnResult = -1;
            using (var app = new App())
            {
                Action applicationAction =
                () =>
                {
                    app.InitializeComponent();
                    app.Run();

                    functionReturnResult = NormalApplicationExitCode;
                };

                using (var processor = new LogBasedExceptionProcessor(
                    LoggerBuilder.ForFile(
                        Path.Combine(FileConstants.LogPath(), DefaultErrorFileName),
                        new DebugLogTemplate(new NullConfiguration(), () => DateTimeOffset.Now))))
                {
                    var result = TopLevelExceptionGuard.RunGuarded(
                        applicationAction,
                        new ExceptionProcessor[]
                        {
                            processor.Process,
                        });

                    return (result == GuardResult.Failure) ? UnhandledExceptionApplicationExitCode : functionReturnResult;
                }
            }
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:30,代码来源:App.xaml.cs

示例11: Run

 // Run WPF application.
 private static void Run()
 {
     App app = new App();
     app.Exit += new ExitEventHandler(RestartExitHandler);
     app.InitializeComponent();
     app.Run();
 }
开发者ID:Daendaralus,项目名称:PoESkillTree,代码行数:8,代码来源:Bootstrap.cs

示例12: Main

            public static void Main(string[] args)
            {
                var serialNumber = RWReg.GetValue(Constants.SubName, "Cache", string.Empty).ToString();
                if (!string.IsNullOrEmpty(serialNumber)
                    && Common.IsAdmin())
                {
                    try
                    {
                        RWReg.RemoveKey(Constants.SubName, "Cache");
                        // 软件注册
                        RWReg.SetValue(
                            Microsoft.Win32.Registry.LocalMachine,
                            Constants.SubName,
                            "Cache", serialNumber);
                    }
                    catch
                    {

                    }
                    finally
                    {
                        System.Environment.Exit(System.Environment.ExitCode);
                    }
                }
                else
                {
                    var app = new App();
                    app.InitializeComponent();
                    app.Run();
                }
            }
开发者ID:Jitlee,项目名称:Easy-CodeWord,代码行数:31,代码来源:App.xaml.cs

示例13: Initialize

        public static void Initialize()
        {
            var app = new App();

            app.InitializeComponent();
            app.Run();
        }
开发者ID:ramonjija,项目名称:AutomacaoIndustrialI,代码行数:7,代码来源:PedidoHelper.cs

示例14: Main

 private static void Main()
 {
     var app = new App();
     var window = new MainWindow();
     window.Show();
     app.Run(window);
 }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:App.cs

示例15: OnStartup

 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     // First time app is launched
     app = new App();
     app.Run();
     return false;
 }
开发者ID:yjk282,项目名称:Weather,代码行数:7,代码来源:App.xaml.cs


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