/// <summary> /// Create and initialise a watchitem instance which corresponds with the pbw /// </summary> /// <param name="_Bundle"></param> /// <returns></returns> public static WatchItem Load(P3bble.Types.Bundle _Bundle) { WatchItem _newItem = new WatchItem(); _newItem.ID = _Bundle.Application.Uuid; _newItem.Name = _Bundle.Application.AppName; _newItem.Developer = _Bundle.Application.CompanyName; _newItem.File = _Bundle.Filename; _newItem.VersionMajor = _Bundle.Application.AppMajorVersion; _newItem.VersionMinor = _Bundle.Application.AppMinorVersion; _newItem.SDKVersionMajor = _Bundle.Application.SdkMajorVersion; _newItem.SDKVersionMinor = _Bundle.Application.SdkMinorVersion; _newItem.Flags = (byte)_Bundle.Application.Flags; _newItem.IconResourceID = (byte)_Bundle.Application.IconResourceID; _newItem.Configurable = false; try { if (_Bundle.AppInfo.Capabilities != null) { _newItem.Configurable = _Bundle.AppInfo.Capabilities.Contains("configurable"); } } catch (Exception) { } try { _newItem.Platforms = new List <string>(); _newItem.Platforms.AddRange(_Bundle.AppInfo.TargetPlatforms); } catch (Exception) { } try { _newItem.AppKeys = new Dictionary <string, int>(); foreach (var item in _Bundle.AppInfo.AppKeys) { _newItem.AppKeys.Add(item.Key, item.Value); } } catch (Exception) { } _newItem.Type = WatchItemType.WatchApp; if ((_newItem.Flags & 1) == 1) { _newItem.Type = WatchItemType.WatchFace; } return(_newItem); }
/// <summary> /// Loads a bundle from ApplicationData.Current.LocalFolder. /// </summary> /// <param name="name">The name of the file in ApplicationData.Current.LocalFolder.</param> /// <returns>A bundle</returns> public static async Task<Bundle> LoadFromLocalStorageAsync(string name) { var bundle = new Bundle(name); await bundle.Initialise(); return bundle; }