public void BuildIconSet( DeviceAssetSet assetSet, DeviceIconSetConstructionCompletedCallback callback) { if (!Application.IsApplicationThread) { throw new Exception("DeviceIconSet loading is only supported on the application thread. This feature is not thread-safe."); } if (this._assetSet != null) { throw new Exception("BuildIconSet was called while a set was already being built. Calls to BuildIconSet cannot be reentrant."); } if (assetSet == null) { throw new ArgumentNullException(nameof(assetSet)); } if (callback == null) { throw new ArgumentNullException(nameof(callback)); } this._assetSet = assetSet; this._callback = callback; Application.DeferredInvoke(delegate { this.LoadSmallImages(); }, null); }
private void End() { DeviceIconSetConstructionCompletedCallback callback = this._callback; IDeviceIconSet result = null; result = this._smallImageSubset == null || this._detailedImageSubset == null || this._backgroundImageAndColorSubset == null ? DefaultIconSet : new DeviceIconSet(this._detailedImageSubset.LargeImages, this._detailedImageSubset.MediumImages, this._smallImageSubset, this._backgroundImageAndColorSubset.BackgroundImage, this._backgroundImageAndColorSubset.Colors); Application.DeferredInvoke(delegate { callback(result); }, null); this._assetSet = null; this._callback = null; }
public static IDeviceIconSet BuildDeviceIconSet( DeviceAssetSet assetSet, DeviceIconSetConstructionCompletedCallback callback) { DeviceIconSetBuilder builder = new DeviceIconSetBuilder(); _builders.Add(builder); builder.BuildIconSet(assetSet, result => { callback(result); _builders.Remove(builder); }); return(UnloadedIconSet); }