SORU
12 EYLÜL 2011, PAZARTESİ


Oluşturma Zamanlanmış Görevler

Şu anda# WPF C bir proje üzerinde çalışıyorum. Kullanıcı ve Windows Görev Zamanlayıcı zamanlanmış bir görev eklemek için izin istiyorum.

Nasıl yapıyor hakkında gitmek ve bu İnternet arama yaparken çok zorlanıyorum olarak yönetmelik ve başvurular ihtiyacım kullanarak olabilir.

CEVAP
12 EYLÜL 2011, PAZARTESİ


Task Scheduler Managed Wrapper kullanabilirsiniz:

using System;
using Microsoft.Win32.TaskScheduler;

class Program
{
   static void Main(string[] args)
   {
      // Get the service on the local machine
      using (TaskService ts = new TaskService())
      {
         // Create a new task definition and assign properties
         TaskDefinition td = ts.NewTask();
         td.RegistrationInfo.Description = "Does something";

         // Create a trigger that will fire the task at this time every other day
         td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });

         // Create an action that will launch Notepad whenever the trigger fires
         td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));

         // Register the task in the root folder
         ts.RootFolder.RegisterTaskDefinition(@"Test", td);

         // Remove the task we just created
         ts.RootFolder.DeleteTask("Test");
      }
   }
}

Alternatif olarak native API kullanmak veya Quartz.NET için gidebilirsiniz. Ayrıntılar için this bkz.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Jeb Corliss

    Jeb Corliss

    17 Kasım 2006
  • SRI International

    SRI Internat

    30 NİSAN 2008
  • thepoke64738

    thepoke64738

    17 HAZİRAN 2011