图表控件LightningChart.NET 系列教程(六):许可证管理介绍(中)
LightningChart.NET SDK 是一款高性能数据可视化插件工具,由数据可视化软件组件和工具类组成,可支持基于 Windows 的用户界面框架(Windows Presentation Foundation)、Windows 通用应用平台(Universal Windows Platform)和 Windows Forms.NET 平台。
在 LightningChart .NET系列教程中,上一章我们介绍了许可证管理的前三部分内容,包括“添加许可证”、“删除许可证”、“更新许可证”,本次将详细介绍许可证管理的另一部分内容,包括“提取部署密钥”、在应用程序中应用部署密钥”两部分内容。
四、提取部署密钥
要在配置了该软件的计算机中运行 LightningChart 应用程序,必须以代码形式应用部署密钥。部署密钥可以通过点击“Copy deployment key to Clipboard”按钮从许可证密钥中提取。
图 4-5. 将部署密钥复制到 License Manager 的剪贴板
五、在应用程序中应用部署密钥在代码中,使用需要的组件时需要用到静态 SetDeploymentKey 方法。用不到的组件则不需要设置密钥(例如,在无绑定应用程序中为全绑定图表设置密钥)。在需要使用组件之前,在某处调用 SetDeploymentKey 方法。调用 SetDeploymentKey 的最佳位置是使用图表的类的静态构造函数,或者在应用程序的主类中。
更多有关发布的详细介绍,请参阅第 299 章。
WinForms
以下示例展示了如何在 Program 类的静态构造函数方法(默认为每个 WinForms 应用程序创建的)上应用密钥。using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
static class Program
{
static Program()
{
//为Arction组件设置部署密钥
string deploymentKey = "VMalgCAAO6kO1RgiNIBJABVcG.R..Kikfd...";
Arction.WinForms.Charting.LightningChart.SetDeploymentKey(deploymentKey);
Arction.WinForms.SignalProcessing.SignalGenerator.SetDeploymentKey(deploymentKey);
Arction.WinForms.SignalProcessing.AudioInput.SetDeploymentKey(deploymentKey);
Arction.WinForms.SignalProcessing.AudioOutput.SetDeploymentKey(deploymentKey);
Arction.WinForms.SignalProcessing.SpectrumCalculator.SetDeploymentKey(deploymentKey);
Arction.WinForms.SignalProcessing.SignalReader.SetDeploymentKey(deploymentKey);
}
// 其余的类
}
}
WPF以下示例展示了如何在 App 类的静态构造函数中,在 App.xaml.cs 开头应用密钥。
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Arction.Wpf.SignalProcessing;
namespace WpfApplication1
{
/// <summary>
///用于App.xaml的交互逻辑
/// </summary>
public partial class App : Application
{
static App()
{
// 为 Arction 组件设置部署密钥
string deploymentKey = "- DEPLOYMENT KEY FROM LICENSE MANAGER
GOES HERE-";
// 为全绑定图表设置部署密钥
Arction.Wpf.ChartingMVVM.LightningChart
.SetDeploymentKey(deploymentKey);
// 为无绑定图表设置部署密钥
Arction.Wpf.Charting.LightningChart
.SetDeploymentKey(deploymentKey);
// 为其他 Arction 组件设置部署密钥
SignalGenerator.SetDeploymentKey(deploymentKey);
AudioInput.SetDeploymentKey(deploymentKey);
AudioOutput.SetDeploymentKey(deploymentKey);
SpectrumCalculator.SetDeploymentKey(deploymentKey);
SignalReader.SetDeploymentKey(deploymentKey);
}
}
}
在 UWP 应用中,可以使用开发者密钥或部署密钥,但不能同时使用。在开发和调试 app 时使用开发者密钥,在部署 app 时使用部署密钥。值得注意的是,如果未能在应用程序中设置部署密钥,目标计算机中的 LightningChart 应用程序将会转成为期 30 天的试用模式(适用于尚未安装开发许可密钥的计算机)。
今天关于LightningChart中许可证管理的介绍到这里了,点击查看LightningChart系列教程。
欢迎加入LightningChart技术交流群,获取最新产品咨询:740060302
想要了解或购买LightningChart 正版授权的朋友,欢迎咨询慧都官方客服。

浙公网安备 33010602011771号