基本信息
源码名称:大疆精灵4SDK客户端认证
源码大小:55.70M
文件格式:.rar
开发语言:C#
更新时间:2018-12-26
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using DJI.WindowsSDK;
// https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
namespace App1
{
/// <summary>
/// 可用于自身或导航至 Frame 内部的空白页。
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
DJISDKManager.Instance.SDKRegistrationStateChanged = Instance_SDKRegistrationEventAsync;
//Replace app key with the real key registered. Make sure that the key is matched with your application's package id.
DJISDKManager.Instance.RegisterApp("20eaef58f5b281fc6dfb2720");
}
private async void Instance_SDKRegistrationEventAsync(SDKRegistrationState state, SDKError resultCode)
{
if (resultCode == SDKError.NO_ERROR)
{
System.Diagnostics.Debug.WriteLine("Register app successfully.");
DJISDKManager.Instance.ComponentManager.GetProductHandler(0).ProductTypeChanged = async delegate (object sender, ProductTypeMsg? value)
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
if (value != null && value?.value != ProductType.NONE)
{
System.Diagnostics.Debug.WriteLine("Aircraft is connected now.");
//You can load/display your pages relative to aircraft operations here.
}
else
{
System.Diagnostics.Debug.WriteLine("Aircraft is disconnected now.");
//You can hide your pages relative to aircraft operations, or provide users with some aircraft connection tips here.
}
});
};
//You need to get the product's connection state after activating, if you have already connected the aircraft before activate Windows SDK.
var productType = (await DJISDKManager.Instance.ComponentManager.GetProductHandler(0).GetProductTypeAsync()).value;
if (productType != null && productType?.value != ProductType.NONE)
{
System.Diagnostics.Debug.WriteLine("Aircraft is connected now.");
//You can load/display your pages relative to aircraft operations here.
}
}
else
{
System.Diagnostics.Debug.WriteLine("SDK register failed, the error is: ");
System.Diagnostics.Debug.WriteLine(resultCode.ToString());
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using DJI.WindowsSDK;
// https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
namespace App1
{
/// <summary>
/// 可用于自身或导航至 Frame 内部的空白页。
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
DJISDKManager.Instance.SDKRegistrationStateChanged = Instance_SDKRegistrationEventAsync;
//Replace app key with the real key registered. Make sure that the key is matched with your application's package id.
DJISDKManager.Instance.RegisterApp("20eaef58f5b281fc6dfb2720");
}
private async void Instance_SDKRegistrationEventAsync(SDKRegistrationState state, SDKError resultCode)
{
if (resultCode == SDKError.NO_ERROR)
{
System.Diagnostics.Debug.WriteLine("Register app successfully.");
DJISDKManager.Instance.ComponentManager.GetProductHandler(0).ProductTypeChanged = async delegate (object sender, ProductTypeMsg? value)
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
if (value != null && value?.value != ProductType.NONE)
{
System.Diagnostics.Debug.WriteLine("Aircraft is connected now.");
//You can load/display your pages relative to aircraft operations here.
}
else
{
System.Diagnostics.Debug.WriteLine("Aircraft is disconnected now.");
//You can hide your pages relative to aircraft operations, or provide users with some aircraft connection tips here.
}
});
};
//You need to get the product's connection state after activating, if you have already connected the aircraft before activate Windows SDK.
var productType = (await DJISDKManager.Instance.ComponentManager.GetProductHandler(0).GetProductTypeAsync()).value;
if (productType != null && productType?.value != ProductType.NONE)
{
System.Diagnostics.Debug.WriteLine("Aircraft is connected now.");
//You can load/display your pages relative to aircraft operations here.
}
}
else
{
System.Diagnostics.Debug.WriteLine("SDK register failed, the error is: ");
System.Diagnostics.Debug.WriteLine(resultCode.ToString());
}
}
}
}