本文整理汇总了C#中System.Diagnostics.Process.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Process.Count方法的具体用法?C# Process.Count怎么用?C# Process.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.Process
的用法示例。
在下文中一共展示了Process.Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMapInfoProcess
/// <summary>
/// Returns the MapInfo process that wasn't running already when the tool started
/// </summary>
/// <param name="miProcs"></param>
/// <returns></returns>
private Process GetMapInfoProcess(Process[] miProcs)
{
if (miProcs == null) return null;
var q = Process.GetProcesses().Where(p => (Regex.IsMatch(p.ProcessName, "MapInfow", RegexOptions.IgnoreCase)) &&
(p.MainWindowHandle != IntPtr.Zero)).Where(p => (miProcs.Count(mip => mip.Id == p.Id) == 0));
if (q.Count() == 1)
{
Process miProcess = q.ElementAt(0);
if (miProcess.MainModule.FileName == _mapInfoApp.FullName)
return miProcess;
}
return null;
}
示例2: refreshEmacsProcess
private void refreshEmacsProcess(out Process[] emacs_processes, out List<Process> processes_opened)
{
emacs_processes = Process.GetProcessesByName("emacs");
processes_opened = new List<Process>();
if (emacs_processes.Count() > 0)
{
foreach (Process process_cur in emacs_processes)
{
if (process_cur.MainModule.FileName == Program.Root_path + "\\" + FileManager.EMACS_PATH)
{
processes_opened.Add(process_cur);
}
}
}
}