当前位置: 首页>>代码示例>>C#>>正文


C# INotifyCollectionChanged.GetType方法代码示例

本文整理汇总了C#中INotifyCollectionChanged.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# INotifyCollectionChanged.GetType方法的具体用法?C# INotifyCollectionChanged.GetType怎么用?C# INotifyCollectionChanged.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INotifyCollectionChanged的用法示例。


在下文中一共展示了INotifyCollectionChanged.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnregisterCollection

        /// <summary>
        /// Unregisters the collection and stops automatically watching the collection. All undo/redo history will be removed.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="collection"/> is <c>null</c>.</exception>
        public void UnregisterCollection(INotifyCollectionChanged collection)
        {
            Argument.IsNotNull("collection", collection);

            Log.Debug("Unregistering collection of type '{0}'", collection.GetType().Name);

            ClearActionsForObject(collection);

            if (_observers.ContainsKey(collection))
            {
                _observers[collection].CancelSubscription();
                _observers.Remove(collection);

                Log.Debug("Unregistered collection");
            }
            else
            {
                Log.Debug("Collection was not registered, not unregistered");
            }
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:25,代码来源:MementoService.cs

示例2: ResetCollection

		private void ResetCollection(INotifyCollectionChanged collection, IList newCollection)
		{	
			if (collection != null)
			{
				var collectionChangedMethod = collection.GetType().GetMethod("OnCollectionChanged", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance);
				if (collectionChangedMethod != null)
				{
					collectionChangedMethod.Invoke(collection, new object[] { new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null) });
					collectionChangedMethod.Invoke(collection, new object[] { new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, newCollection) });

					SetDataContextBinder(DataContextBinder);
				}
			}
		}
开发者ID:RobertKozak,项目名称:MonoMobile.Views,代码行数:14,代码来源:MemberData.cs

示例3: RegisterCollection

        /// <summary>
        /// Registers the collection and automatically. As soon as the <see cref="INotifyCollectionChanged.CollectionChanged"/> event
        /// occurs, it will automatically create a backup of the collection to support undo.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="tag">The tag.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="collection"/> is <c>null</c>.</exception>
        public void RegisterCollection(INotifyCollectionChanged collection, object tag = null)
        {
            Argument.IsNotNull("collection", collection);

            Log.Debug("Registering collection of type '{0}' with tag '{1}'", collection.GetType().Name, TagHelper.ToString(tag));

            if (!_observers.ContainsKey(collection))
            {
                _observers[collection] = new CollectionObserver(collection, tag, this);

                Log.Debug("Registered collection");
            }
            else
            {
                Log.Debug("Collection already registered, not registered");
            }
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:24,代码来源:MementoService.cs


注:本文中的INotifyCollectionChanged.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。