vb.net - Convert Array to DayOfWeek -


any idea how make function convertarraytodayofweek. using dll https://taskscheduler.codeplex.com/documentation

import system.win32.taskscheduler  ...  function convertarraytodayofweek() dayofweek     dim a() integer = {1,2,3,4,5,6}     dim d dayofweek      'todo : how change a()     d = 1 or 2 or 3 or 4 or 5 or 6      return d end function 

i try create task trigger every monday , saturday (or other day depending on user wishes)

imports microsoft.win32.taskscheduler  module module1      sub main()         using ts new taskservice()             ' create new task definition , assign properties             dim td taskdefinition = ts.newtask             td.registrationinfo.description = "does something"              ' add trigger will, starting tomorrow, fire every other week on monday             ' , saturday , repeat every 10 minutes following 11 hours             dim wt new weeklytrigger()             wt.startboundary = datetime.today.adddays(1)              '--------------------- need change value part @ 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 action (shorthand) runs notepad             td.actions.add(new execaction("notepad.exe", "c:\test.log"))              ' register task in root folder             ts.rootfolder.registertaskdefinition("test", td)         end using     end sub  end module 

look @

wt.daysofweek = daysoftheweek.monday or daysoftheweek.saturday 

how change value @ runtime. use :

wt.daysofweek = convertarraytodayofweek({1,6}) 'the results of function should 'daysoftheweek.monday or daysoftheweek.saturday'  

daysofweek daysoftheweek enum

function convertarraytodayofweek(a() integer) dayoftheweek 'change dayofweek dayoftheweek     'dim a() integer = {1,2,3,4,5,6} 'receive value outside     dim d dayoftheweek 'change dayofweek dayoftheweek      each integer in         select case             case 1 : d += microsoft.win32.taskscheduler.daysoftheweek.monday             case 2 : d += microsoft.win32.taskscheduler.daysoftheweek.tuesday             case 3 : d += microsoft.win32.taskscheduler.daysoftheweek.wednesday             case 4 : d += microsoft.win32.taskscheduler.daysoftheweek.thursday             case 5 : d += microsoft.win32.taskscheduler.daysoftheweek.friday             case 6 : d += microsoft.win32.taskscheduler.daysoftheweek.saturday             case 7 : d += microsoft.win32.taskscheduler.daysoftheweek.sunday         end select        next      return d end function 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -