當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。