Пример #1
0
 private void HandleListChanged(object sender, EventArgs e)
 {
     // call the ui thread to update ui component
     this.Dispatcher.Invoke(() =>
     {
         processListView.ItemsSource = null;
         processListView.ItemsSource = processManager.GetProcesses();
         processListView.Items.Refresh();
     });
 }
Пример #2
0
        internal static ICollection <IProcess> GetSpotifyProcesses(IProcessManager processManager)
        {
            var spotifyProcesses = new List <IProcess>();

            foreach (var process in processManager.GetProcesses())
            {
                if (process.ProcessName.IsSpotifyIdleState())
                {
                    spotifyProcesses.Add(process);
                }
            }

            return(spotifyProcesses);
        }
Пример #3
0
        internal static ICollection <IProcess> GetSpotifyProcesses(IProcessManager processManager)
        {
            var spotifyProcesses = new List <IProcess>();

            foreach (var process in processManager.GetProcesses())
            {
                if (SpotifyStatus.WindowTitleIsSpotify(process.ProcessName))
                {
                    spotifyProcesses.Add(process);
                }
            }

            return(spotifyProcesses);
        }
        private string GenerateProcessList(HttpContext context)
        {
            var processes = _processManager.GetProcesses();

            var initCount             = processes.Count(p => p.State == ChildProcessState.Initializing);
            var listeningCount        = processes.Count(p => p.State == ChildProcessState.Listening);
            var bustingCacheCount     = processes.Count(p => p.State == ChildProcessState.BustingCache);
            var stoppedCount          = processes.Count(p => p.State == ChildProcessState.Stopped);
            var healthCheckingCount   = processes.Count(p => p.State == ChildProcessState.HealthChecking);
            var healthCheckErrorCount = processes.Count(p => p.State == ChildProcessState.HealthCheckError);

            var processList =
                $"<div>{processes.Count} Processes</div>" +
                "<br/>" +
                $"{initCount} Initializing <br/>" +
                $"{listeningCount} Listening <br/>" +
                $"{bustingCacheCount} Busting Cache <br/>" +
                $"{stoppedCount} Stopped <br/>" +
                $"{healthCheckingCount} Health Checking <br/> " +
                $"{healthCheckErrorCount} Health Check Failed <br/><br/>" +
                "<table>";


            for (var x = 0; x < processes.Count; x++)
            {
                ChildProcess process;

                try
                {
                    process = processes[x];
                }
                catch
                {
                    return("Error building process list.  Please refresh.");
                }

                var domain = $"{process.Host?.Domain}:{process.Host?.Port}";
                processList += $"   <tr>" +
                               $"       <td>{domain} - {process.State} - Last Start Time: {process.LastStartTime}</td>" +
                               $"       <td></td>" +
                               $"   </tr>";
                processList += $"   <tr>" +
                               $"       <td></td>" +
                               $"       <td>" +
                               $"           <div style='overflow-y: scroll; height: 300px; '>" +
                               $"               <table>";

                var orderedLogs = process.LogHistory.GetAll().OrderByDescending(l => l.TimeStamp).ToList();

                for (var i = 0; i < orderedLogs.Count; i++)
                {
                    var log = orderedLogs[i];

                    processList += $"               <tr>" +
                                   $"                   <td></td>" +
                                   $"                   <td>{log.TimeStamp} - {log.LogText}</td>" +
                                   $"               </tr>";
                }
                processList += "                </table>" +
                               "            </div>" +
                               "        </td>" +
                               "    </tr>";
            }
            processList += "</table>";

            var html = $@"
                        <html>
	                        <head>
		                        <title>Process Status</title>
	                        </head>
	                        <body>
		                        <h1>Process Status</h1>
                                {processList}
	                        </body>
                        </html>";

            return(html);
        }