本文整理汇总了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!");
}
示例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;
}
}
示例3: insightWindow_items_CollectionChanged
void insightWindow_items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged("Count");
OnPropertyChanged("CurrentHeader");
OnPropertyChanged("CurrentContent");
OnPropertyChanged("CurrentIndexText");
}
示例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";
}
示例5: OnNavigationViewsChanged
private void OnNavigationViewsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
PopulateRegion(e.NewItems);
}
}
示例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();
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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;
}
}
}
示例11: ctrlTranscriptEntries_CollectionChanged
private void ctrlTranscriptEntries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (ctrlTranscriptEntries.Items.Count > 0)
{
ctrlTranscriptEntries.ScrollIntoView(ctrlTranscriptEntries.Items[ctrlTranscriptEntries.Items.Count - 1]);
}
}
示例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);
}
示例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();
}
}
示例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]);
}
}
示例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);
}
}