Exemple #1
0
 public void Stop([FromServices] IMyApplicationLifetime lifetime)
 {
     if (!lifetime.IsStopped && !lifetime.IsStopping)
     {
         lifetime.HostApplicationLifetime.StopApplication();
     }
 }
Exemple #2
0
        public string Get([FromServices] IMyApplicationLifetime lifetime)
        {
            if (lifetime.IsStarted)
            {
                return("started");
            }

            if (lifetime.IsStarting)
            {
                return("starting");
            }

            if (lifetime.IsStopped)
            {
                return("stopped");
            }

            if (lifetime.IsStopping)
            {
                return("stopping");
            }

            return(string.Empty);
        }