[skip ci] converting more tasks to jobs
This commit is contained in:
1 parent
9dbc0a7e66
commit
965ac9dfce
6 files changed
+74
-68
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import "pkg:/source/QrCode/QrImage.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
@job("GenerateQrCodeJob")
|
||||
function ExecuteJob() as void
|
||||
input = JobGetInput()
|
||||
|
||||
poster = input.poster
|
||||
mode = input.mode
|
||||
text = input.text
|
||||
size = input.size
|
||||
padding = input.padding
|
||||
|
||||
if mode = invalid
|
||||
mode = QrCode.QRMode.Byte
|
||||
end if
|
||||
|
||||
if size = invalid
|
||||
size = 200
|
||||
end if
|
||||
|
||||
if padding = invalid
|
||||
padding = 0
|
||||
end if
|
||||
|
||||
qr = new QrCode.QRImage()
|
||||
imagePath = qr.Generate(text, size, padding, mode)
|
||||
|
||||
if JobIsCancelled()
|
||||
JobCancel()
|
||||
return
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(imagePath)
|
||||
poster.uri = imagePath
|
||||
end if
|
||||
end function
|
||||
Reference in new issue
Block a user