private async voidSelectBarcode(object sender, EventArgs e){ // Use FilePicker to allow the user to select an image file. var images = awaitFilePicker.Default.PickAsync(new PickOptions {PickerTitle = "Pick image",FileTypes = FilePickerFileType.Images }); // Get the full path of the selected image file. var imageSource = images.FullPath.ToString(); // Set the source of the Image view to the selected image's path. barcodeImage.Source = imageSource; // Use IronBarcode to read the barcode from the image file and get the first result. var result = BarcodeReader.Read(imageSource).First().Text; // Display the read result in the Editor. outputText.Text = result;}
private async void SelectBarcode(object sender, EventArgs e)
{
// Use FilePicker to allow the user to select an image file.
var images = await FilePicker.Default.PickAsync(new PickOptions
{
PickerTitle = "Pick image",
FileTypes = FilePickerFileType.Images
});
// Get the full path of the selected image file.
var imageSource = images.FullPath.ToString();
// Set the source of the Image view to the selected image's path.
barcodeImage.Source = imageSource;
// Use IronBarcode to read the barcode from the image file and get the first result.
var result = BarcodeReader.Read(imageSource).First().Text;
// Display the read result in the Editor.
outputText.Text = result;
}
PrivateAsync Sub SelectBarcode(ByVal sender AsObject, ByVal e AsEventArgs) ' Use FilePicker to allow the user to select an image file. Dim images = AwaitFilePicker.Default.PickAsync(New PickOptionsWith { .PickerTitle = "Pick image", .FileTypes = FilePickerFileType.Images }) ' Get the full path of the selected image file. Dim imageSource = images.FullPath.ToString() ' Set the source of the Image view to the selected image's path. barcodeImage.Source = imageSource ' Use IronBarcode to read the barcode from the image file and get the first result. Dim result = BarcodeReader.Read(imageSource).First().Text ' Display the read result in the Editor. outputText.Text = resultEnd Sub
Private Async Sub SelectBarcode(ByVal sender As Object, ByVal e As EventArgs)
' Use FilePicker to allow the user to select an image file.
Dim images = Await FilePicker.Default.PickAsync(New PickOptions With {
.PickerTitle = "Pick image",
.FileTypes = FilePickerFileType.Images
})
' Get the full path of the selected image file.
Dim imageSource = images.FullPath.ToString()
' Set the source of the Image view to the selected image's path.
barcodeImage.Source = imageSource
' Use IronBarcode to read the barcode from the image file and get the first result.
Dim result = BarcodeReader.Read(imageSource).First().Text
' Display the read result in the Editor.
outputText.Text = result
End Sub
以下程式碼將用於複製文字編輯器中的文字,並向使用者顯示一則提示訊息,告知文字已成功複製。
private async voidCopyEditorText(object sender, EventArgs e){ // Copy the text from the Editor to the clipboard. awaitClipboard.SetTextAsync(outputText.Text); // Show a success message to the user. awaitDisplayAlert("Success", "Text is copied!", "OK");}
private async void CopyEditorText(object sender, EventArgs e)
{
// Copy the text from the Editor to the clipboard.
await Clipboard.SetTextAsync(outputText.Text);
// Show a success message to the user.
await DisplayAlert("Success", "Text is copied!", "OK");
}
PrivateAsync Sub CopyEditorText(ByVal sender AsObject, ByVal e AsEventArgs) ' Copy the text from the Editor to the clipboard.AwaitClipboard.SetTextAsync(outputText.Text) ' Show a success message to the user.AwaitDisplayAlert("Success", "Text is copied!", "OK")End Sub
Private Async Sub CopyEditorText(ByVal sender As Object, ByVal e As EventArgs)
' Copy the text from the Editor to the clipboard.
Await Clipboard.SetTextAsync(outputText.Text)
' Show a success message to the user.
Await DisplayAlert("Success", "Text is copied!", "OK")
End Sub
You can find the project source code in this article on GitHub.
Do I need a license to use IronBarcode in a commercial application?
Yes, IronBarcode requires a license for both development and commercial use. More information on licensing can be found on the IronBarcode licensing page.