Пример #1
0
        public void OnJavaScriptCollectionChanges(IJavascriptObject collectionchanged, IJavascriptObject[] value, IJavascriptObject[] status, IJavascriptObject[] index)
        {
            try
            {
                var res = GetFromJavascript(collectionchanged) as JSArray;
                if (res == null)
                {
                    return;
                }

                CollectionChanges cc = res.GetChanger(value, status, index, this);

                using (ReListen(null))
                {
                    INotifyCollectionChanged inc = res.CValue as INotifyCollectionChanged;
                    if (inc != null)
                    {
                        inc.CollectionChanged -= CollectionChanged;
                    }
                    res.UpdateEventArgsFromJavascript(cc);
                    if (inc != null)
                    {
                        inc.CollectionChanged += CollectionChanged;
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.Log(string.Format("Unable to update ViewModel from View, exception raised: {0}", e));
            }
        }
Пример #2
0
        public void UpdateEventArgsFromJavascript(CollectionChanges iCollectionChanges)
        {
            IList ilist = CValue as IList;

            if (ilist == null)
            {
                return;
            }

            iCollectionChanges.IndividualChanges.ForEach(c => ReplayChanges(c, ilist));
        }