本文整理汇总了C#中Task.WakeUp方法的典型用法代码示例。如果您正苦于以下问题:C# Task.WakeUp方法的具体用法?C# Task.WakeUp怎么用?C# Task.WakeUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task.WakeUp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUnicast
public void CreateUnicast(string direction, int hostID)
{
Task task = new Task();
Unicast unicast = new Unicast();
unicast = unicast.Read(hostID, unicast);
if (unicast.HostName != null)
{
if (unicast.ImageName != null)
{
string taskID = unicast.Create(unicast);
if (taskID != "0")
{
if (CreatePxeBoot(unicast, direction, "false", taskID, hostID))
{
History history = new History();
history.Type = "Host";
history.Notes = unicast.HostMac;
history.TypeID = hostID.ToString();
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
Image image = new Image();
history.Type = "Image";
history.Notes = unicast.HostName;
history.TypeID = image.GetImageID(unicast.ImageName);
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
task.WakeUp(unicast.HostMac);
}
else
unicast.Rollback(unicast);
}
}
}
}
示例2: StartMulticastSender
//.........这里部分代码省略.........
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + "part" + part.number + ".hfsp" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + "part" + part.number + ".hfsp" + compExt;
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + "part" + part.number + ".imager" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + "part" + part.number + ".imager" + compExt;
else
{
//Look for lvm
if (part.vg != null)
{
if (part.vg.lv != null)
{
foreach (var lv in part.vg.lv)
{
if (lv.active == "1")
{
if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".ntfs" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".ntfs" + compExt;
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".fat" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".fat" + compExt;
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".extfs" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".extfs" + compExt;
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".hfsp" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".hfsp" + compExt;
else if (File.Exists(multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".imager" + compExt))
udpFile = multicast.GroupImage + Path.DirectorySeparatorChar + lv.vg + "-" + lv.name + ".imager" + compExt;
}
}
}
}
}
if (udpFile == null)
continue;
else
x++;
if (Environment.OSVersion.ToString().Contains("Unix"))
{
if (x == 1)
senderInfo.Arguments = (" -c \"" + compAlg + udpFile + stdout + " | udp-sender" +
" --portbase " + portBase + " --min-receivers " + receivers + " " + multicast.GroupSenderArgs + " --ttl 32");
else
senderInfo.Arguments += (" ; " + compAlg + udpFile + stdout + " | udp-sender" +
" --portbase " + portBase + " --min-receivers " + receivers + " " + multicast.GroupSenderArgs + " --ttl 32");
}
else
{
if (x == 1)
senderInfo.Arguments = (" /c " + appPath + compAlg + udpFile + stdout + " | " + appPath + "udp-sender.exe" +
" --portbase " + portBase + " --min-receivers " + receivers + " " + multicast.GroupSenderArgs + " --ttl 32");
else
senderInfo.Arguments += (" & " + appPath + compAlg + udpFile + stdout + " | " + appPath + "udp-sender.exe" +
" --portbase " + portBase + " --min-receivers " + receivers + " " + multicast.GroupSenderArgs + " --ttl 32");
}
}
}
if (Environment.OSVersion.ToString().Contains("Unix"))
{
senderInfo.Arguments += "\"";
}
string log = ("\r\n" + DateTime.Now.ToString("MM.dd.yy hh:mm") + " Starting Multicast Session " + multicast.GroupName +
" With The Following Command:\r\n\r\n" + senderInfo.FileName + senderInfo.Arguments + "\r\n\r\n");
System.IO.File.AppendAllText(logPath + "multicast.log", log);
try
{
sender = Process.Start(senderInfo);
}
catch (Exception ex)
{
Logger.Log(ex.ToString());
Utility.Message = "Could Not Start Multicast Sender. Check The Exception Log For More Info";
System.IO.File.AppendAllText(logPath + "multicast.log", "Could Not Start Session " + multicast.GroupName + " Try Pasting The Command Into A Command Prompt");
return false;
}
Thread.Sleep(2000);
if (sender.HasExited)
{
Utility.Message = "Could Not Start Multicast Sender";
System.IO.File.AppendAllText(logPath + "multicast.log", "Session " + multicast.GroupName + @" Started And Was Forced To Quit, Try Pasting The Command Into A Command Prompt");
return false;
}
multicast.UpdatePID(sender.Id, multicast, portBase, mcImage);
for (int i = 0; i < multicast.HostMacs.Count; i++)
{
task.WakeUp(multicast.HostMacs[i]);
}
Utility.Message = "Successfully Started Multicast " + multicast.GroupName;
return true;
}