本文整理汇总了C#中Microsoft.Win32.TaskScheduler.TaskService.FindAllTasks方法的典型用法代码示例。如果您正苦于以下问题:C# TaskService.FindAllTasks方法的具体用法?C# TaskService.FindAllTasks怎么用?C# TaskService.FindAllTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Win32.TaskScheduler.TaskService
的用法示例。
在下文中一共展示了TaskService.FindAllTasks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
TaskService ts = new TaskService();
var tasks = ts.FindAllTasks(new Regex(string.Empty));
var task = ts.GetTask("Elevate");
TaskDefinition td = ts.NewTask();
td.Principal.RunLevel = TaskRunLevel.Highest;
//td.Triggers.AddNew(TaskTriggerType.YourDesiredSchedule);
td.Triggers.AddNew(TaskTriggerType.Registration);
//td.Actions.Add(new ExecAction("Path Of your Application File", null));
td.Actions.Add(new ExecAction(@"E:\StructuresSrc\Kit\bin\gacutil.exe", "/nologo /u \"Tekla.Logging, Version=99.1\""));
ts.RootFolder.RegisterTaskDefinition("GatUtil", td);
td.Actions.Add(new ExecAction(@"E:\StructuresSrc\MSBuild\MSBuild\MSBuildTasks\Elevate.exe", "E:\\StructuresSrc\\Kit\\bin\\gacutil.exe /nologo /u \"Tekla.Logging, Version=99.1\""));
ts.RootFolder.RegisterTaskDefinition("Elevate", td);
ts.RootFolder.DeleteTask("Elevate", false);
}
示例2: activeBackgroundWorker_DoWork
private void activeBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
using (TaskService lts = new TaskService(ts.TargetServer, ts.UserName, ts.UserAccountDomain, ts.UserPassword, ts.HighestSupportedVersion.Minor == 1))
{
List<ListViewItem> list = new List<ListViewItem>();
foreach (var t in lts.FindAllTasks(null))
try
{
if (t.IsActive)
list.Add(new ListViewItem(new string[] { t.Name, t.NextRunTime.ToString("G"), t.Definition.Triggers.ToString(), t.Path }) { Tag = t });
}
catch { }
e.Result = list.ToArray();
}
}
示例3: CancelSlideshow
/// <summary>
/// Cancels the current background slideshow.
/// </summary>
/// <returns>True when an active slideshow was cancelled.</returns>
public static bool CancelSlideshow()
{
using (TaskService service = new TaskService())
{
// First look for any other slideshow entries
Task[] tasks = service.FindAllTasks(new Regex("wwu_slideshow"));
// Remove any previous
foreach (Task t in tasks)
{
t.Stop();
service.RootFolder.DeleteTask(t.Name, false);
}
return tasks.Length != 0;
}
}
示例4: getSchedule
private void getSchedule()
{
using (this.ts = new TaskService(system, user, account, password))
{
this.tasks = ts.FindAllTasks(new System.Text.RegularExpressions.Regex(taskFilter), true);
foreach(Task task in this.tasks)
taskList.Add(filter(task));
this.display();
}
}