/// <summary> /// Performs startup operations for the service. /// </summary> /// <param name="dependencyScope"> /// A scope that is used to resolve service dependencies. /// </param> /// <param name="applicationConfiguration"> /// Configuration information for the service application. /// </param> /// <param name="executionLifetime"> /// An object that provides control over execution lifetime. /// </param> protected override void OnExecutionStarting(IDependencyScope dependencyScope, IConfiguration applicationConfiguration, ServiceExecutionLifetime executionLifetime) { Console.WriteLine($"Solid Instruments | {ServiceName}"); Console.WriteLine($"Copyright (c) RapidField LLC. All rights reserved.{Environment.NewLine}"); try { Console.CancelKeyPress += (sender, eventArguments) => { executionLifetime.End(); eventArguments.Cancel = true; }; var mediator = dependencyScope.Resolve <ICommandMediator>(); var applicationStartedMessage = new ApplicationStartingMessage(ServiceName); mediator.Process(applicationStartedMessage); Thread.Sleep(1600); } finally { base.OnExecutionStarting(dependencyScope, applicationConfiguration, executionLifetime); } }
void IHandler <ApplicationStartingMessage> .Handle(object sender, ApplicationStartingMessage message) { _hasRootPage = false; OnApplicationStart(); }