Upgrade Guide for Anyline 46.1.0

We have completed a major update to the Anyline classes in version 43. If you were coming from a previous Anyline version, it is important to go over some of the more significant changes in this page. For more detailed information about the classes, please head over to the API documentation API documentation.

Updating the JSON configuration

Here’s a direct comparison of the same JSON configuration in the old vs. new style:

Old JSON

New JSON

{
  "camera": { (1)
    "captureResolution": "1080p",
    "pictureResolution": "1080p"
  },
  "flash": { (2)
    "mode": "manual",
    "alignment": "top_right"
  },
  "viewPlugin": { (3)
    "plugin": { (4)
      "id": "METER_PLUGIN",
      "meterPlugin": {
        "scanMode": "AUTO_ANALOG_DIGITAL_METER"
      }
    },
    "cutoutConfig" : {
      "style" : "rect",
      "alignment" : "top",
      "strokeWidth" : 2,
      "strokeColor" : "FFFFFF",
      "cornerRadius" : 4,
      "outerColor" : "000000",
      "outerAlpha" : 0.5,
      "feedbackStrokeColor" : "0099FF",
      "offset": {
        "x": 0,
        "y": 120
      }
    },
    "scanFeedback": { (5)
      "style": "CONTOUR_RECT",
      "strokeColor": "0099FF",
      "strokeWidth": 2,
      "fillColor": "220099FF",
      "cornerRadius": 2,
      "redrawTimeout": 200,
      "animationDuration": 75,
      "blinkOnResult": true,
      "beepOnResult": true,
      "vibrateOnResult": true
    },
    "cancelOnResult": true (6)
  }
}
{
  "cameraConfig": { (7)
    "captureResolution": "1080p",
    "pictureResolution": "1080p"
  },
  "flashConfig": { (8)
    "mode": "manual",
    "alignment": "top_right"
  },
  "viewPluginConfig": { (9)
    "pluginConfig": {
      "id": "METER_PLUGIN",
      "meterConfig": {
        "scanMode": "auto_analog_digital_meter"
      },
      "cancelOnResult": true (10)
    },
    "cutoutConfig" : {
      "style" : "rect",
      "alignment" : "top",
      "strokeWidth" : 2,
      "strokeColor" : "FFFFFF",
      "cornerRadius" : 4,
      "outerColor" : "000000",
      "outerAlpha" : 0.5,
      "feedbackStrokeColor" : "0099FF",
      "offset": {
        "x": 0,
        "y": 120
      }
    },
    "scanFeedbackConfig": { (11)
      "style": "CONTOUR_RECT",
      "strokeColor": "0099FF",
      "strokeWidth": 2,
      "fillColor": "220099FF",
      "cornerRadius": 2,
      "redrawTimeout": 200,
      "animationDuration": 75,
      "blinkOnResult": true,
      "beepOnResult": true,
      "vibrateOnResult": true
    }
  }
}
1 camera is now called cameraConfig (see 7.)
2 flash is now called flashConfig (see 8.)
3 viewPlugin is now called viewPluginConfig (see 9.)
4 plugin is now called pluginConfig and does not include a plugin anymore, instead it includes the XXXconfig (in this case meterConfig)
5 scanFeedback is now called scanFeedbackConfig (see 11.)
6 cancelOnResult is not part of the viewPlugin anymore, instead it is part of the pluginConfig (see 10.)

Updating the Scanning Implementation

Here’s a direct comparison of how the scanning implementation changed:

Old Implementation

New Implementation

public sealed partial class ScanViewPage : Page, IScanResultListener<MeterScanResult> (1)
{
    public override async void OnNavigatedTo(NavigationEventArgs args)
    {
        base.OnNavigatedTo(args);

        await AnylineScanView.InitAsync(pathToJsonConfig);

        ScanViewPlugin scanViewPlugin = AnylineScanView.ScanViewPlugin; (2)
        scanViewPlugin.AddScanResultListener(this); (3)

        AnylineScanView.StartScanning();
    }

    public void OnResult(MeterScanResult result) (4)
    {
        // do something with the result
    }
}
public sealed partial class ScanViewPage : Page
{
    public override async void OnNavigatedTo(NavigationEventArgs args)
    {
        base.OnNavigatedTo(args);

        await AnylineScanView.InitAsync(pathToJsonConfig);
        ScanViewPlugin scanViewPlugin = AnylineScanView.ScanViewPlugin as ScanViewPlugin; (5)

        scanViewPlugin.ScanPlugin.ResultReceived += ScanPlugin_ResultReceived; (6)

        AnylineScanView.StartScanning();
    }

    private void ScanPlugin_ResultReceived(object sender, Anyline.SDK.Plugins.ScanResult scanResult) (7)
    {
        // do something with the result
    }
}
1 You don’t need to implement any more callback interfaces
2 The type of ScanView.ScanViewPlugin is now a ViewPluginBase which can either be a ViewPluginComposite or a ScanViewPlugin - in this case, it’s the second one. (See 5.)
3 There is no more result listener - instead, directly access the ScanPlugin and register to the respective event - in this case: ResultReceived (see 6.)
4 There is no more implementation of an interface, instead provide your own implementation that shall be called once an event is received (see 7.)

Have a look at the Scanning Capabilities section for more specific implementation details.

Questions or need further assistance? Please reach out to the Anyline Support Helpdesk.