Table of contents
Swift
Objective-C

How to migrate from Xamarin Forms to MAUI

Xamarin.Forms platform is no longer supported, you can update to MAUI instead. To upgrade to the latest MAUI package, we recommend you to follow the User Guide to re-writing your code.

Update the Project

Previously, you created a Mobile App (Xamarin.Forms) project. Now, you’ll need to create a standalone .NET MAUI App project.

Update the Library

In your Xamarin.Forms project, you referenced the Dynamsoft.CaptureVision.Xamarin.Forms library. Now, in your MAUI project, you’ll need to reference the Dynamsoft.BarcodeReaderBundle.Maui library. Please refer to the User Guide for further instructions.

Update the License Activation Code

Starting from 2.4.2000, we have unified the API for setting licenses across different Dynamsoft products.

Old APIs New APIs
BarcodeReader.initLicense LicenseManager.initLicense
  • code in Xamarin.Forms
public partial class App : Application, ILicenseVerificationListener
{
    public App(IDCVCameraEnhancer dce, IDCVBarcodeReader dbr)
    {
        ...
        // Initialize the license of barcode reader module. Please note that the following license is a public trial.
        barcodeReader.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this);
    }

    // Implement LicenseVerificationCallback to get message from the license server.
    public void LicenseVerificationCallback(bool isSuccess, string msg)
    {
        if (!isSuccess)
        {
            System.Console.WriteLine(msg);
        }
    }
}
  • code in MAUI
public partial class MainPage : ContentPage, ILicenseVerificationListener
{
    public MainPage()
    {
        InitializeComponent();
        LicenseManager.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this);
    }
    public void OnLicenseVerified(bool isSuccess, string message)
    {
        if (!isSuccess)
        {
            Debug.WriteLine(message);
        }
    }
}

Update Video Streaming Decoding APIs

The APIs for decoding video frames has been adjusted as follows:

Old APIs New APIs
BarcodeReader.SetCameraEnhancer CaptureVisionRouter.SetInput
BarcodeReader.StartScanning CaptureVisionRouter.StartCapturing
BarcodeReader.StopScanning CaptureVisionRouter.StopCapturing
BarcodeReader.AddResultReceiver CaptureVisionRouter.addResultReceiver
BarcodeReader.Set/GetMinImageReadingInterval SimplifiedCaptureVisionSettings.MinImageCaptureInterval
BarcodeReader.EnableResultVerification MultiFrameResultCrossFilter.EnableResultCrossVerification
BarcodeReader.EnableDuplicateFilter MultiFrameResultCrossFilter.EnableResultDeduplication
interface IBarcodeResultListener interface ICapturedResultReceiver
class BarcodeResult class BarcodeResultItem

Migrate Your Templates

You can use the template converter to upgrade your template. View the online template converter.

The template-based APIs have been updated as follows:

Old APIs New APIs
BarcodeReader.UpdateRuntimeSettings CaptureVisionRouter.InitSettings
BarcodeReader.ResetRuntimeSettings CaptureVisionRouter.ResetRuntimeSettings
BarcodeReader.OutputRuntimeSettingsToString CaptureVisionRouter.OutputSettings

Migrate Your DBRPublicRuntimeSettings

The class DBRPublicRuntimeSettings has been refactored. The APIs for accessing and updating DBRPublicRuntimeSettings has been adjusted as follows:

Old APIs New APIs
BarcodeReader.GetRuntimeSettings CaptureVisionRouter.GetSimplifiedSettings
BarcodeReader.UpdateRuntimeSettings CaptureVisionRouter.UpdateSettings

Migrate to SimplifiedCaptureVisionSettings

The following properties are replaced by similar properties under SimplifiedCaptureVisionSettings. They can also be set via a template file(String).

PublicRuntimeSettings Property SimplifiedCaptureVisionSettings Property Template File Parameter
Timeout Timeout CaptureVisionTemplates.Timeout

Migrate to SimplifiedBarcodeReaderSettings

The following properties are replaced by similar properties under SimplifiedBarcodeReaderSettings. The majority of them can also be set via a template file(String).

PublicRuntimeSettings Property SimplifiedBarcodeReaderSettings Property Template File Parameter
MinBarcodeTextLength MinBarcodeTextLength BarcodeFormatSpecification.BarcodeTextLengthRangeArray
MinResultConfidence MinResultConfidence BarcodeFormatSpecification.MinResultConfidence
ExpectedBarcodesCount ExpectedBarcodesCount BarcodeReaderTaskSetting.ExpectedBarcodesCount
BarcodeFormatIds BarcodeFormatIds BarcodeReaderTaskSetting.BarcodeFormatIds
BarcodeFormatIds_2 BarcodeFormatIds BarcodeReaderTaskSetting.BarcodeFormatIds

Remarks:

  • The 2 groups of barcode formats are merged.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: