【问题标题】:Can I use Zebble for only UI and use Xamarin for everything else我可以仅将 Zebble 用于 UI 并将 Xamarin 用于其他所有内容吗
【发布时间】:2017-12-14 07:08:43
【问题描述】:

我只想将 Zebble 用于生成 UI 和所有其他我想使用 Xamarin apis/custom http apis/local db 或其他任何东西的东西。基本上一个带有 zebble 和其他东西的 UI 项目将在 PCL 中。

会兼容吗?可以请教吗?

【问题讨论】:

    标签: xamarin-zebble


    【解决方案1】:

    是的,你可以。 Zebble 中没有任何东西可以阻止您直接使用本机 API。

    对于自定义 http 调用,我建议使用 HttpClient 类,默认情况下该类在新创建的 Zebble 项目的所有 3 个平台中都可用。

    对于设备 API,您当然可以使用每个平台的标准 API 类,但为了节省时间并实现 100% 代码重用,我强烈建议使用http://zebble.net/docs/device-api。例如,如果您想使用灯泡(又名闪光灯、led 或手电筒),您可以非常轻松地在所有平台上实现,只需很少的代码:

    // Determines if a lamp feature is available on the device.
    if (await Device.Torch.IsAvailable()) { ... }
    
    // This will switch the lamp on.
    await Device.Torch.TurnOn(); 
    
    // This will switch the lamp off.
    await Device.Torch.TurnOff();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-04
      • 2020-01-11
      • 1970-01-01
      • 2015-02-04
      相关资源
      最近更新 更多