0
어떻게 만들지 알아보십시오. convertArrayToDayOfWeek. 나는이 DLL을 사용 https://taskscheduler.codeplex.com/documentation배열을 DayOfWeek로 변환하십시오.
Import System.Win32.TaskScheduler
...
Function convertArrayToDayOfWeek() as DayOfWeek
Dim a() as integer = {1,2,3,4,5,6}
Dim d as DayOfWeek
'todo : how to change a() to something like this
d = 1 or 2 or 3 or 4 or 5 or 6
return d
End Function
나는 월요일과 토요일마다
Imports Microsoft.Win32.TaskScheduler
Module Module1
Sub Main()
Using ts As New TaskService()
' Create a new task definition and assign properties
Dim td As TaskDefinition = ts.NewTask
td.RegistrationInfo.Description = "Does something"
' Add a trigger that will, starting tomorrow, fire every other week on Monday
' and Saturday and repeat every 10 minutes for the following 11 hours
Dim wt As New WeeklyTrigger()
wt.StartBoundary = DateTime.Today.AddDays(1)
'--------------------- need to change the value part at runtime
wt.DaysOfWeek = DaysOfTheWeek.Monday Or DaysOfTheWeek.Saturday '<--- hardcoded
'--------------------
wt.WeeksInterval = 2
wt.Repetition.Duration = TimeSpan.FromHours(11)
wt.Repetition.Interval = TimeSpan.FromMinutes(10)
td.Triggers.Add(wt)
' Add an action (shorthand) that runs Notepad
td.Actions.Add(New ExecAction("notepad.exe", "c:\test.log"))
' Register the task in the root folder
ts.RootFolder.RegisterTaskDefinition("Test", td)
End Using
End Sub
End Module
보기
wt.DaysOfWeek = DaysOfTheWeek.Monday Or DaysOfTheWeek.Saturday
에서 (또는 다른 날은 사용자의 희망에 따라) 트리거 작업을 만들려고
런타임에 값을 변경하는 방법. 나는 이런 식으로 뭔가를 사용하려면 :
wt.DaysOfWeek = convertArrayToDayOfWeek({1,6}) 'the results of this function should 'DaysOfTheWeek.Monday Or DaysOfTheWeek.Saturday'
귀하의 질문은 매우 명확하지 않습니다이다. 너 뭐하려고? –
배열 {1,2,3}을 1 또는 2 또는 3으로 변환하려고 시도합니다. – printf
그래서 속성을 1에서 6 사이의 값으로 지정 하시겠습니까? – OneFineDay