SDK 初始化
1.准备工作
- Visual Studio 2013,请参考 https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
- 需安装 Directx End-User Runtime Web,请参考 https://www.microsoft.com/zh-tw/download/details.aspx?id=35
- 需要在Visual Studio 2013中建立WPF工程
- 需要下载的SDK包
2.导入SDK
导入 SDK 具体步骤如下:
- 将压缩包解压后的 bin 目录中的 原生 dll(hpmpdll.dll,mtcdll.dll,mtcwrap.dll,sqlite3.dll,zmf.dll)托管 dll(mtcmanaged.dll,zmfmanaged.dll)和模块化dll(JcApi.dll)文件复制到您的工程目录bin/Debug中,接下来需要将托管 dll 文件和模块化dll加入到 UI 项目的 References 中。bin/Debug 目录包含的dll文件如下图所示
2.在Solution Explorer中右键点击你的项目下的References,如下图所示
3.在打开的Reference Manager中按顺序进行下面的操作
4.在弹出的对话框内按顺序进行以下操作
5.最后点击Reference Manager中的OK按钮完成。
3.初始化SDK
在任何操作前都要先初始化SDK。
APPKEY获取请参考如何创建你的应用
初始化JCApi调用JCApi.getInstance().initialize(this, APPKEY);
初始化JCConference调用JCConference.getInstance().initialize(this, APPKEY);
4. 销毁
在用完JCApi和JCConference接口以后需要及时销毁以释放内存。
销毁JCApi 调用JCApi.getInstance().destroy();
销毁JCConference调用JCConference.getInstance().destroy();
5.关键代码解析
启动页面的关键代码如下
...
using JcApi.Api;
using JcApi;
using JcApi.Conference;
using JcApi.Conference.Model;
...
public partial class App : Application
{
private const string APPKEY = "************";
//APP启动事件
protected override void OnStartup(StartupEventArgs e)
{
...
base.OnStartup(e);
//初始化JcApi
JCApi.getInstance().initialize(this, APPKEY);
//初始化JCConference
JCConference.getInstance().initialize(this, APPKEY);
}
//APP退出事件
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
//退出时销毁
JCApi.getInstance().destroy();
JCConference.getInstance().destroy();
}
}