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


C# App.InitializeComponent方法代码示例

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


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

示例1: Main

 public static void Main(string[] args)
 {
     if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
     {
         try
         {
             var startMinimized = false;
             if (args != null)
             {
                 var minimized = args.FirstOrDefault();
                 if (minimized != null && minimized.Equals(Constants.Minimized))
                 {
                     startMinimized = true;
                 }
             }
             var application = new App(startMinimized);
             application.InitializeComponent();
             application.Run();
         }
         finally
         {
             // Allow single instance code to perform cleanup operations
             SingleInstance<App>.Cleanup();
         }
     }
 }
开发者ID:bhattvishal,项目名称:CalendarSyncplus,代码行数:26,代码来源:Program.cs

示例2: Initialize

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

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

示例3: Main

		public static void Main()
		{
			if (SingleInstance<App>.InitializeAsFirstInstance(AppName))
			{
				XmlConfigurator.Configure();
				s_log = LogManager.GetLogger(typeof(App));
				AppDomain.CurrentDomain.UnhandledException += Application_DispatcherUnhandledException;
				if (ApplicationDeployment.IsNetworkDeployed)
				{
					AppVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4);
					s_log.Info("Configure crash reports");
				}

				s_log.Info("Displaying splash screen");
				SplashScreen splashScreen = new SplashScreen("Images/logo.png");
				splashScreen.Show(true);

				s_log.Info("Starting Jenkins Build Monitor...");
				App application = new App();
				application.InitializeComponent();
				application.Run();

				// Allow single instance code to perform cleanup operations
				s_log.Info("Cleaning up single instance app...");
				SingleInstance<App>.Cleanup();
			}
		}
开发者ID:kveretennicov,项目名称:kato,代码行数:27,代码来源:App.xaml.cs

示例4: Main

        public static void Main(string[] args)
        {
            if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
            {
                string filename;

                if (args != null && args.Length == 1)
                {
                    if (System.IO.File.Exists(System.IO.Path.GetFullPath(args[0])))
                    {
                        filename = System.IO.Path.GetFileName(System.IO.Path.GetFullPath(args[0]));

                        if (filename.EndsWith("osapp", StringComparison.Ordinal))
                        {
                            // its a plugin package
                            PluginInstallerHelper pInst = new PluginInstallerHelper();
                            pInst.InstallPlugin(System.IO.Path.GetFullPath(args[0]));
                        }
                    }
                }
                else
                {
                    var application = new App();

                    application.InitializeComponent();
                    application.Run();
                }

                // Allow single instance code to perform cleanup operations
                SingleInstance<App>.Cleanup();
            }
        }
开发者ID:Kiwiroo,项目名称:Open-Source-Automation,代码行数:32,代码来源:MainWindow.xaml.cs

示例5: Main

 public static void Main( string[] args )
 {
     try
     {
         // Crash logs upload and updater availability is managed during this initialization.
         using( var init = CKApp.Initialize( new CKAppParameters( "CK-Windows", "Demo" ) ) )
         {
             if( init != null )
             {
                 // Common logger is actually bound to log4net.
                 // CK-Windows must not depend on log4Net: its initialization must be done here.
                 CommonLogger.Initialize( CKApp.CurrentParameters.ApplicationDataPath + @"AppLogs\", false );
                 CKApp.Run( () =>
                 {
                     App app = new App();
                     app.InitializeComponent();
                     return app;
                 } );
             }
         }
     }
     catch( Exception ex )
     {
         Console.WriteLine( ex.Message );
     }
 }
开发者ID:Nementon,项目名称:ck-desktop,代码行数:26,代码来源:App.xaml.cs

示例6: 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

示例7: Main

 public static void Main()
 {
     App app = new App();
     app.InitializeComponent();
     app.Run();
     AValue.ConfigData.Save();
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:7,代码来源:App.xaml.cs

示例8: LoadServices

        public static void LoadServices(this IEnumerable<ServiceBase> services)
        {
            // if run from visual studio:
            //if (!Debugger.IsAttached) return;

            var t = Task.Factory.StartNew
                (
                    () =>
                    {
                        var app = new App();
                        app.InitializeComponent();
                        app.Startup += (o, e) =>
                        {
                            var window = new Window
                            {
                                Width = 350,
                                Height = 200,
                                Title = "Windows Service Runner",
                                Content =
                                    new ServicesControllerViewModel(
                                        services.Select(s => new ServiceViewModel(s)).ToList())
                            };

                            window.Show();
                        };
                        app.Run();
                    },
                    CancellationToken.None,
                    TaskCreationOptions.PreferFairness,
                    new StaTaskScheduler(25)
                );
            t.Wait();
        }
开发者ID:Behzadkhosravifar,项目名称:SignalR,代码行数:33,代码来源:ServiceRunner.cs

示例9: Main

        public static void Main(string[] args)
        {
            Thread.CurrentThread.Name = "CMain";
            MyTraceContext.ThreadTraceContext = new MyTraceContext("Client");

            Trace.TraceInformation("Start");

            if (args.Contains("adventure"))
                ClientConfig.NewGameMode = GameMode.Adventure;
            else if (args.Contains("fortress"))
                ClientConfig.NewGameMode = GameMode.Fortress;

            StartupStopwatch = Stopwatch.StartNew();

            if (Debugger.IsAttached == false)
            {
                var splashScreen = new System.Windows.SplashScreen("Images/splash.png");
                splashScreen.Show(true, true);
            }

            var app = new App();
            app.InitializeComponent();
            app.Run();

            Trace.TraceInformation("Stop");
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:26,代码来源:Program.cs

示例10: 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

示例11: Main

        public static void Main()
        {
            mutex = new Mutex(true, Process.GetCurrentProcess().ProcessName, out created);

            if (!created)
            {
                return;
            }

            // As all first run initialization is done in the main project,
            // we need to make sure the user does not start a different knot first.
            if (CfgFile.Get("FirstRun") != "0")
            {
                try
                {
                    ProcessStartInfo process = new ProcessStartInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\FreemiumUtilities.exe");
                    Process.Start(process);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                App app = new App();
                Permissions.SetPrivileges(true);
                app.InitializeComponent();
                app.Run();
                Permissions.SetPrivileges(false);
            }
        }
开发者ID:nullkuhl,项目名称:fsu-dev,代码行数:31,代码来源:App.xaml.cs

示例12: Main

        public static void Main()
        {
            splashScreen = new SplashScreen("mediascribe-splashscreen2.png");
            splashScreen.Show(true, false);
            #if (DEBUG==false)
            try
            {
            #endif
                if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
                {
                    var application = new App();

                    application.InitializeComponent();

                    application.Run();

                    // Allow single instance code to perform cleanup operations
                    SingleInstance<App>.Cleanup();
                }
            #if (DEBUG==false)
            }
            catch (Exception e)
            {
                Logging.Log(LoggingSource.Errors, e.ToString() + "\r\n\r\n");
                MessageBox.Show("An error has occured -- please go to http://mediascribe.jarrod.co.nz/contact/ and get in touch.");
            }
            #endif
        }
开发者ID:jarrodwood,项目名称:MediaScribe,代码行数:28,代码来源:App.xaml.cs

示例13: 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

示例14: 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

示例15: 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


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