/******************************************************
//**软件首页 类
//******************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
public partial class Software{
/// Moves the specified old index.
/// <param name="oldIndex">The old index.</param>
/// <param name="newIndex">The new index.</param>
public void Move(int oldIndex, int newIndex)
{
this.MoveItem(oldIndex, newIndex);
}
/// Adds the range.
/// <param name="items">The items.</param>
public void AddRange(params T[] items)
{
this.BeginUpdate();
for (int i = 0; i < items.Length; i++)
{
this.Add(items[i]);
this.EndUpdate();
}
/// Begins the update.
public void BeginUpdate()
{
this.update++;
}
/// Ends the update.
public void EndUpdate()
{
this.EndUpdate(true);
}
internal virtual void EndUpdate(bool notify)
{
update--;
if (update <= 0)
{
this.update = 0;
if (notify)
{
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
}
#endregion
#region Overrides
protected internal int Version
{
get
{
return this.version;
}
}
桌卡制作 protected bool IsInUpdate
{
get { return this.update > 0; }
}
组合屋
电子元件打标机 protected override void InsertItem(int index, T item) {
base.InsertItem(index, item);
this.OnPropertyChanged("Count");
this.OnPropertyChanged("Item[]");
this.OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
}
protected override void SetItem(int index, T item)
{
T oldItem = base[index];
base.SetItem(index, item);
this.OnPropertyChanged("Item[]");
虚拟路由器 this.OnCollectionChanged(NotifyCollectionChangedAction.Replace, oldItem, item, index); }
protected override void RemoveItem(int index)
{
T item = base[index];
base.RemoveItem(index);
this.OnPropertyChanged("Count");
this.OnPropertyChanged("Item[]");
this.OnCollectionChanged(NotifyCollectionChangedAction.Remove, item, index);
}
protected override void ClearItems()
{
base.ClearItems();
this.OnPropertyChanged("Count");
this.OnPropertyChanged("Item[]");
this.OnCollectionChanged(NotifyCollectionChangedAction.Reset);
}
protected virtual void MoveItem(int oldIndex, int newIndex)
{
T item = base[oldIndex];
base.RemoveItem(oldIndex);
base.InsertItem(newIndex, item);
this.OnPropertyChanged("Item[]");
this.OnCollectionChanged(NotifyCollectionChangedAction.Move, item, newIndex, oldIndex);
}
#endregion
#region INotifyCollectionChanged Members
public event NotifyCollectionChangedEventHandler CollectionChanged;
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
{
if (this.CollectionChanged != null && update == 0)
{
this.CollectionChanged(this, args);
this.version++;
}
}
private void OnCollectionChanged(NotifyCollectionChangedAction action)
8418模具钢 {
OnCollectionChanged(new NotifyCollectionChangedEventArgs(action));
}
private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)