本文整理汇总了C#中Monitor.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Monitor.Start方法的具体用法?C# Monitor.Start怎么用?C# Monitor.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor.Start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main(string[] args)
{
//string filename =
// @"..\..\..\Dev.ProcessMonitor.TestTargerExe\bin\Debug\Dev.ProcessMonitor.TestTargerExe.exe";
//string arg = "";
////string filename =
//// @"..\..\..\Dev.ProcessMonitor.FormTest\bin\Debug\Dev.ProcessMonitor.FormTest.exe";
////string arg = "";
//var starter = new ProcessStarterAsyn(filename, arg);
//starter.StandardErrorOut += starter_StandardErrorOut;
//starter.StandardOut += starter_StandardOut;
//starter.StartAsyn();
//Console.WriteLine("pressanykey");
var m = new Monitor(true);
m.StandardErrorOut += m_StandardErrorOut;
m.Start();
Console.ReadKey();
m.Stop();
}
示例2: OnStart
protected override void OnStart(string[] args)
{
m = new Monitor(true);
m.StandardErrorOut += m_StandardErrorOut;
m.StandardOut += m_StandardOut;
m.Start();
}
示例3: button4_Click
private void button4_Click(object sender, EventArgs e)
{
var m = new Monitor(true);
m.StandardErrorOut += starter_StandardErrorOut;
m.StandardOut += starter_StandardOut;
m.Start();
}
示例4: Main
private static void Main()
{
using (var monitor = new Monitor("c:\\foobar", "*.dll"))
{
monitor.Start();
// breakpoints in your actual service should not be hit :)
}
}
示例5: Main
static void Main(string[] args)
{
Console.WriteLine("Run:");
Console.WriteLine("1 - Local Monitor");
Console.WriteLine("2 - Service");
var input = Console.ReadLine();
if (input == "1")
{
Monitor monitor = new Monitor();
monitor.AddToWatch("explorer");
monitor.AddToWatch("calc");
monitor.AddToWatch("chrome");
monitor.Start();
Console.ReadLine();
}
else if (input == "2")
{
string address = string.Empty; ;
foreach (IPAddress item in Dns.GetHostAddresses(Dns.GetHostName()))
{
//if (!item.IsIPv6LinkLocal)
// if (!item.IsIPv6Multicast)
// if (!item.IsIPv6SiteLocal)
// if (!item.IsIPv6Teredo)
// address = item.ToString();
if (!item.IsIPv6LinkLocal && !item.IsIPv6Multicast && !item.IsIPv6SiteLocal && !item.IsIPv6Teredo)
address = item.ToString();
}
Monitor monitor = new Monitor();
using (ServiceHost host = new ServiceHost(monitor, new Uri(string.Format("http://{0}:4325/", address))))
{
host.Open();
monitor.Start();
Console.WriteLine("Opened...");
Console.ReadLine();
}
}
}