本文整理汇总了C#中CollectionChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# CollectionChangedEventArgs类的具体用法?C# CollectionChangedEventArgs怎么用?C# CollectionChangedEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionChangedEventArgs类属于命名空间,在下文中一共展示了CollectionChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Items_Added
private void Items_Added(object sender, CollectionChangedEventArgs<Item> e)
{
Dispatcher.Invoke(() =>
{
foreach (Item i in e)
list.Items.Add(i);
});
}
示例2: NamedReporters_RemovedItem
private void NamedReporters_RemovedItem(object sender, CollectionChangedEventArgs e)
{
Invoke(new Action(() =>
{
var reporter = e.TargetObject as INamedProgressReporter;
_reporterContexts.Remove(reporter);
outputSourcesToolStripComboBox.Items.RemoveAt(e.TargetIndex);
}));
}
示例3: References_RemovedItem
private void References_RemovedItem(object sender, CollectionChangedEventArgs e)
{
foreach (TreeNode node in Nodes)
{
if (node is FileReferenceNode && (node as FileReferenceNode).Reference == e.TargetObject as string)
{
node.Remove();
break;
}
}
}
示例4: collectionChangedEventArgs_ctor_changeType_should_set_default_values
public void collectionChangedEventArgs_ctor_changeType_should_set_default_values()
{
var cType = CollectionChangeType.Reset;
var target = new CollectionChangedEventArgs<Object>( cType );
target.ChangeType.Should().Be.EqualTo( cType );
target.Index.Should().Be.EqualTo( -1 );
target.Item.Should().Be.Null();
target.OldIndex.Should().Be.EqualTo( -1 );
}
示例5: Mobiles_Added
private void Mobiles_Added(object sender, CollectionChangedEventArgs<Mobile> e)
{
Dispatcher.Invoke(() =>
{
foreach (Mobile m in e)
{
m.AppearanceChanged += Mobile_AppearanceChanged;
list.Items.Add(m);
}
});
}
示例6: Items_Removed
private void Items_Removed(object sender, CollectionChangedEventArgs<Item> e)
{
Dispatcher.Invoke(() =>
{
foreach (Item i in e)
{
list.Items.Remove(i);
if (list.SelectedItem == i)
list.SelectedItem = null;
}
});
}
示例7: NamedReporters_InsertedItem
private void NamedReporters_InsertedItem(object sender, CollectionChangedEventArgs e)
{
Invoke(new Action(() =>
{
var reporter = e.TargetObject as INamedProgressReporter;
_reporterContexts.Add(reporter, new ReporterContext(reporter));
outputSourcesToolStripComboBox.Items.Insert(e.TargetIndex, reporter.DisplayName);
reporter.DisplayNameChanged += reporter_DisplayNameChanged;
}));
}
示例8: Mobiles_Removed
private void Mobiles_Removed(object sender, CollectionChangedEventArgs<Mobile> e)
{
Dispatcher.Invoke(() =>
{
foreach (Mobile m in e)
{
list.Items.Remove(m);
m.AppearanceChanged -= Mobile_AppearanceChanged;
if (list.SelectedItem == m)
list.SelectedItem = null;
}
});
}
示例9: collectionChangedEventArgs_ctor_changeType_index_oldIndex_item_should_set_default_values
public void collectionChangedEventArgs_ctor_changeType_index_oldIndex_item_should_set_default_values()
{
var item = new Object();
var cType = CollectionChangeType.ItemMoved;
var index = 10;
var oldIndex = 1;
var target = new CollectionChangedEventArgs<Object>( cType, index, oldIndex, item );
target.ChangeType.Should().Be.EqualTo( cType );
target.Index.Should().Be.EqualTo( index );
target.Item.Should().Be.EqualTo( item );
target.OldIndex.Should().Be.EqualTo( oldIndex );
}
示例10: Bookmarks_InsertedItem
private void Bookmarks_InsertedItem(object sender, CollectionChangedEventArgs e)
{
var bookmark = e.TargetObject as Bookmark;
var item = new ListViewItem(new string[] {
bookmark.Location.Line.ToString(),
// bookmark.Tooltip,
bookmark.Location.FilePath.ToString() })
{
ImageIndex = listView1.Items.Count
};
_imageList.Images.Add(bookmark.Image);
listView1.Items.Add(item);
bookmark.LocationChanged += bookmark_LocationChanged;
bookmark.ImageChanged += bookmark_ImageChanged;
_bookmarkItems.Add(bookmark, item);
}
示例11: viewItems_RemovedItem
private void viewItems_RemovedItem(object sender, CollectionChangedEventArgs e)
{
ViewMenu.DropDownItems.Remove(e.TargetObject as ToolStripItem);
}
示例12: viewItems_InsertedItem
private void viewItems_InsertedItem(object sender, CollectionChangedEventArgs e)
{
// insert before full screen menu item.
ViewMenu.DropDownItems.Insert(ViewMenu.DropDownItems.Count - 2, e.TargetObject as ToolStripItem);
}
示例13: viewContent_RemovedItem
private void viewContent_RemovedItem(object sender, CollectionChangedEventArgs e)
{
LiteViewContent viewContent = e.TargetObject as LiteViewContent;
var dockContent = DockPanel.GetContainer(viewContent);
dockContent.DockHandler.Close();
}
示例14: viewContent_InsertedItem
private void viewContent_InsertedItem(object sender, CollectionChangedEventArgs e)
{
AddContainer(e.TargetObject as LiteViewContent).ShowAndActivate(DockPanel);
}
示例15: Assemblies_RemovedItem
private static void Assemblies_RemovedItem(object sender, CollectionChangedEventArgs<AssemblyDefinition> e)
{
e.TargetObject.Compilation = null;
}