Task Scheduler 2.0 将当前计划任务填充到 WPF GridView
我需要将任务计划程序 2.0 中当前计划的任务填充到 WPF 中的 GridView 中。我的应用程序当前添加和删除用户计划的任务,但我需要一种方法让他们无需转到任务计划程序即可查看当前计划的任务。
更新
谢谢pax,我最终使用了这种方法并使用 .xaml 绑定列信息
private void PopulateGridView()
{
//initialize task scheduler 2.0
var scheduler = new TaskScheduler.TaskScheduler();
//connect using server, username, password, and domain
scheduler.Connect(null, null, null, null);
//set folder to register tasks; "\\" = local directory
ITaskFolder rootGet = scheduler.GetFolder("\\");
//for each task in the folder delete the task
foreach (IRegisteredTask irTasks in rootGet.GetTasks(0))
{
dgInstanceView.ItemsSource = rootGet.GetTasks(0);
}
}
I need to populate the currently scheduled tasks in task scheduler 2.0 to a GridView in WPF. My application currently adds and deletes tasks scheduled by the user but I need a way for them to view the current scheduled tasks without having to go to the task scheduler.
UPDATE
Thanks pax I ended up using this method and tying the column info using the .xaml
private void PopulateGridView()
{
//initialize task scheduler 2.0
var scheduler = new TaskScheduler.TaskScheduler();
//connect using server, username, password, and domain
scheduler.Connect(null, null, null, null);
//set folder to register tasks; "\\" = local directory
ITaskFolder rootGet = scheduler.GetFolder("\\");
//for each task in the folder delete the task
foreach (IRegisteredTask irTasks in rootGet.GetTasks(0))
{
dgInstanceView.ItemsSource = rootGet.GetTasks(0);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 ITaskFolder 接口<的 GetTasks 方法< /a>.
I'd suggest using the GetTasks method of the ITaskFolder interface.