private void UnsafeCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { JSArray arr = _FromCSharp[sender] as JSArray; if (arr == null) { return; } switch (e.Action) { case NotifyCollectionChangedAction.Add: IJSCSGlue addvalue = _JSObjectBuilder.Map(e.NewItems[0]); if (addvalue == null) { return; } RegisterAndDo(addvalue, () => arr.Add(addvalue, e.NewStartingIndex)); break; case NotifyCollectionChangedAction.Replace: IJSCSGlue newvalue = _JSObjectBuilder.Map(e.NewItems[0]); if (newvalue == null) { return; } RegisterAndDo(newvalue, () => arr.Insert(newvalue, e.NewStartingIndex)); break; case NotifyCollectionChangedAction.Remove: RegisterAndDo(null, () => arr.Remove(e.OldStartingIndex)); break; case NotifyCollectionChangedAction.Reset: RegisterAndDo(null, () => arr.Reset()); break; } }
private bool Convert(IEnumerable source, out IJSCSGlue res) { res = new JSArray(this._IWebView, _UIDispatcher, source.Cast <object>().Select(s => Map(s)), source); _Cacher.Cache(source, res); return(true); }