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


C# Specialized.NotifyCollectionChangedEventArgs类代码示例

本文整理汇总了C#中System.Collections.Specialized.NotifyCollectionChangedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# NotifyCollectionChangedEventArgs类的具体用法?C# NotifyCollectionChangedEventArgs怎么用?C# NotifyCollectionChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NotifyCollectionChangedEventArgs类属于System.Collections.Specialized命名空间,在下文中一共展示了NotifyCollectionChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: newMail

        /// <summary>
        /// When a new item is added to the Inbox Collection we will get a notification here which we will distribute to the listening clients
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void newMail(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (Clients != null)
                Clients.updateInbox(MvcApplication.Inbox);

            // Clients.alert("You've got mail!");
        }
开发者ID:irony,项目名称:Mailfeed,代码行数:12,代码来源:MailHub.cs

示例2: Clients_CollectionChanged

 private void Clients_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             IMPClient addedItem = e.NewItems[0] as IMPClient;
             if (addedItem != null)
             {
                 Dispatcher.BeginInvoke(
                     new Action(() =>
                     {
                         clientList.Add(addedItem);
                         Lbl_ClientCount.Content = clientList.Count;
                     })
                 );
             }
             break;
         case NotifyCollectionChangedAction.Remove:
             IMPClient removedItem = e.OldItems[0] as IMPClient;
             if (removedItem != null)
             {
                 Dispatcher.BeginInvoke(
                     new Action(() =>
                     {
                         clientList.Remove(removedItem);
                         Lbl_ClientCount.Content = clientList.Count;
                     })
                 );
             }
             break;
     }
 }
开发者ID:jjustme,项目名称:IMPCSharp,代码行数:32,代码来源:MainWindow.xaml.cs

示例3: insightWindow_items_CollectionChanged

			void insightWindow_items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
			{
				OnPropertyChanged("Count");
				OnPropertyChanged("CurrentHeader");
				OnPropertyChanged("CurrentContent");
				OnPropertyChanged("CurrentIndexText");
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:SharpDevelopInsightWindow.cs

示例4: TeamMembers_CollectionChanged

 void TeamMembers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     TeamOneList.UpdateLayout();
     TeamTwoList.UpdateLayout();
     team1SkaterCount.Text = GameViewModel.Instance.Team1.TeamMembers.Count + " Skaters";
     team2SkaterCount.Text = GameViewModel.Instance.Team2.TeamMembers.Count + " Skaters";
 }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:7,代码来源:TeamManager.xaml.cs

示例5: OnNavigationViewsChanged

 private void OnNavigationViewsChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         PopulateRegion(e.NewItems);
     }
 }
开发者ID:Kendry06,项目名称:Gymnastika,代码行数:7,代码来源:NavigationRegionViewModel.cs

示例6: AllFilesOnCollectionChanged

 private void AllFilesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
 {
     switch (notifyCollectionChangedEventArgs.Action)
       {
     case NotifyCollectionChangedAction.Add:
       foreach (FileViewModel fileViewModel in notifyCollectionChangedEventArgs.NewItems)
       {
     if (fileViewModel.Path.EndsWith("template.json"))
       Templates.Add(new Template(fileViewModel));
       }
       break;
     case NotifyCollectionChangedAction.Remove:
       foreach (FileViewModel fileViewModel in notifyCollectionChangedEventArgs.OldItems)
       {
     if (fileViewModel.Path.EndsWith("template.json"))
     {
       Template template = m_templates.FirstOrDefault(n => n.FileViewModel == fileViewModel);
       m_templates.Remove(template);
     }
       }
       break;
     case NotifyCollectionChangedAction.Replace:
       break;
     case NotifyCollectionChangedAction.Move:
       break;
     case NotifyCollectionChangedAction.Reset:
       break;
     default:
       throw new ArgumentOutOfRangeException();
       }
 }
开发者ID:grarup,项目名称:SharpE,代码行数:31,代码来源:TemplateManager.cs

示例7: Columns_CollectionChanged

        private void Columns_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    foreach (DataGridColumn column in e.NewItems ?? EmptyList)
                    {
                        AddEventHandlers(column);
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    foreach (DataGridColumn column in e.OldItems ?? EmptyList)
                    {
                        RemoveEventHandlers(column);
                    }
                    break;

                case NotifyCollectionChangedAction.Replace:
                    foreach (DataGridColumn column in e.OldItems ?? EmptyList)
                    {
                        RemoveEventHandlers(column);
                    }
                    foreach (DataGridColumn column in e.NewItems ?? EmptyList)
                    {
                        AddEventHandlers(column);
                    }
                    break;
            }
        }
开发者ID:tom-englert,项目名称:DataGridExtensions,代码行数:30,代码来源:DataGridEventsProvider.cs

示例8: boxesCollectionChanged

		private void boxesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
		{
			//VIEW0
			int i = 0;
			if (e.NewItems != null)
				foreach (var newBoxViewModel in e.NewItems.Cast<BoxViewModel>())
				{
					var boxIndex = e.NewStartingIndex + i;
					var box = new Box(newBoxViewModel, ((Box)this.Parent).CaretPerTree);
					this.locations.Insert(boxIndex, default(Point));
					this.Children.Insert(boxIndex, box);
					SetLeft(box, 0);
					SetTop(box, 0);
					newBoxViewModel.PropertyChanged += (_, _e) =>
					{
						//if (_e.PropertyName == nameof(BoxViewModel.Layout))//TODO: filter all calls to the following method by only propagating those properties that cause a layout change
						this.boxLayoutChanged();
					};
				}
			//VIEW1//VIEW2
			if (e.OldItems != null)
				foreach (var newBoxViewModel in e.OldItems.Cast<BoxViewModel>())
				{
					this.locations.RemoveAt(e.OldStartingIndex);
					this.Children.RemoveAt(e.OldStartingIndex);
				}
		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:27,代码来源:BoxComposition.cs

示例9: _container_ItemsChanged

        void _container_ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                var separators = _control.Items.OfType<ToolStripSeparator>().ToArray();

                foreach (var separator in separators)
                {
                    ((GroupControl)separator.Tag).Dispose();
                }
            }
            else
            {
                if (e.OldItems != null)
                {
                    foreach (NiCommandBarGroup group in e.OldItems)
                    {
                        GetGroupControl(group).Dispose();
                    }
                }

                if (e.NewItems != null)
                {
                    foreach (NiCommandBarGroup group in e.NewItems)
                    {
                        new GroupControl(_serviceProvider, _control, group);
                    }
                }
            }
        }
开发者ID:netide,项目名称:netide,代码行数:30,代码来源:GroupManager.cs

示例10: OnCollectionChanged

 private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (_isInitialized)
     {
         switch (e.Action)
         {
             case NotifyCollectionChangedAction.Reset:
                 ClearChildren();
                 break;
             case NotifyCollectionChangedAction.Add:
                 int index = e.NewStartingIndex;
                 foreach (var item in e.NewItems)
                 {
                     AddItem(item, index++);
                 }
                 SelectedIndexChanged(this.SelectedIndex);
                 break;
             case NotifyCollectionChangedAction.Remove:
                 foreach (var item in e.OldItems)
                 {
                     RemoveItem(item);
                 }
                 SelectedIndexChanged(this.SelectedIndex);
                 break;
             case NotifyCollectionChangedAction.Replace:
             case NotifyCollectionChangedAction.Move:
             default:
                 break;
         }
     }
 }
开发者ID:Microsoft,项目名称:TVHelpers,代码行数:31,代码来源:Indicator.Items.cs

示例11: ctrlTranscriptEntries_CollectionChanged

 private void ctrlTranscriptEntries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (ctrlTranscriptEntries.Items.Count > 0)
     {
         ctrlTranscriptEntries.ScrollIntoView(ctrlTranscriptEntries.Items[ctrlTranscriptEntries.Items.Count - 1]);
     }
 }
开发者ID:wallymathieu,项目名称:Prolog.NET,代码行数:7,代码来源:TranscriptComponent.xaml.cs

示例12: _positions_CollectionChanged

 private void _positions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             HandlePositionAddEvent(e.NewItems);
             break;
         case NotifyCollectionChangedAction.Move:
             // don't care
             break;
         case NotifyCollectionChangedAction.Remove:
             HandlePositionRemoveEvent(e.OldItems);
             break;
         case NotifyCollectionChangedAction.Replace:
             HandlePositionAddEvent(e.NewItems);
             HandlePositionRemoveEvent(e.OldItems);
             break;
         case NotifyCollectionChangedAction.Reset:
             HandlePositionAddEvent(e.NewItems);
             HandlePositionRemoveEvent(e.OldItems);
             break;
         default:
             throw new Exception(String.Format("unexpected action type {0}", e.Action));
     }
     // We *could* be clever, check to see if TotalValues really changed,
     // and only report Positions changing if TotalValues stayed the same,
     // but it's simpler to just assume TotalValue will change as well
     RaisePropertyChanged(String.Empty);
 }
开发者ID:edmundschweppe,项目名称:InvestOMatic,代码行数:29,代码来源:Portfolio.cs

示例13: ElementsChanged

        private void ElementsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (var item in e.NewItems)
                {
                    var elementViewModel = item as ElementViewModel;
                    if (elementViewModel == null) continue;
                    AddElementResultsCollections(elementViewModel);
                }
            }

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (var item in e.OldItems)
                {
                    var elementViewModel = item as ElementViewModel;
                    if (elementViewModel == null) continue;
                    RemoveElementResultsCollections(elementViewModel);
                }
            }
            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                ResetCollection();
            }
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:26,代码来源:ValidationModel.cs

示例14: _onConvertersCollectionChanged

      private void _onConvertersCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
         IList C = null;

         switch (e.Action) {
            case NotifyCollectionChangedAction.Add:
               C = e.NewItems;
               break;

            case NotifyCollectionChangedAction.Replace:
               C = e.NewItems;
               break;

            case NotifyCollectionChangedAction.Remove:
               foreach (IValueConverter c in e.OldItems) {
                  _convertersInfo.Remove(c); 
               }
               break;

            case NotifyCollectionChangedAction.Reset:
               _convertersInfo.Clear();
               C = Converters;
               break;
         }
         if (C == null || C.Count == 0) return;

         foreach (IValueConverter c in C) {
            var attrs = c.GetType().GetAttributes<ValueConversionAttribute>();
            Assumption.IsTrue(attrs.Length == 1, "All value converters in a converter chain must be decorated with the ValueConversion attribute exactly once.");
            _convertersInfo.Add(c, attrs[0]);
         }
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:31,代码来源:ConverterChain.cs

示例15: CollectionChanged

        private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            bool update = false;

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    update = _intArgs[0] >= e.NewStartingIndex;
                    break;
                case NotifyCollectionChangedAction.Remove:
                    update = _intArgs[0] >= e.OldStartingIndex;
                    break;
                case NotifyCollectionChangedAction.Replace:
                    update = _intArgs[0] >= e.NewStartingIndex &&
                             _intArgs[0] < e.NewStartingIndex + e.NewItems.Count;
                    break;
                case NotifyCollectionChangedAction.Move:
                    update = (_intArgs[0] >= e.NewStartingIndex &&
                              _intArgs[0] < e.NewStartingIndex + e.NewItems.Count) ||
                             (_intArgs[0] >= e.OldStartingIndex &&
                             _intArgs[0] < e.OldStartingIndex + e.OldItems.Count);
                    break;
                case NotifyCollectionChangedAction.Reset:
                    update = true;
                    break;
            }

            if (update)
            {
                CurrentValue = GetValue(sender);
            }
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:32,代码来源:IndexerNode.cs


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