本文整理汇总了C#中ObservableCollectionEx类的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollectionEx类的具体用法?C# ObservableCollectionEx怎么用?C# ObservableCollectionEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObservableCollectionEx类属于命名空间,在下文中一共展示了ObservableCollectionEx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddRangeOnlyRaisesOneCollectionChangedEventAtTheEnd
public void AddRangeOnlyRaisesOneCollectionChangedEventAtTheEnd()
{
var oc = new ObservableCollectionEx<string>();
var toAdd = new List<string>
{
"Foo",
"Bar"
};
var itemCount = 0;
var eventCount = 0;
var action = NotifyCollectionChangedAction.Add;
IList<string> addedItems = null;
oc.CollectionChanged += (sender, args) =>
{
++eventCount;
itemCount = oc.Count;
action = args.Action;
addedItems = args.NewItems.OfType<string>().ToList();
};
oc.AddRange(toAdd);
itemCount.Should().Be(2);
eventCount.Should().Be(1);
action.Should().Be(NotifyCollectionChangedAction.Add);
addedItems.Should().NotBeNull();
addedItems.ShouldBeEquivalentTo(toAdd);
}
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:31,代码来源:ObservableCollectionExTest.cs
示例2: UserDatabase
public UserDatabase()
{
XDocument doc = Open();
Users = new ObservableCollectionEx<User>(from u in doc.Descendants(Tags.User) select new User(u));
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
foreach (var user in Users)
{
foreach (var download in user.Downloads)
{
string path = Utils.MediaFilePath(user, download);
if (isf.FileExists(path))
{
using (var fileStream = isf.OpenFile(path, FileMode.Open))
{
download.DownloadedBytes = fileStream.Length;
}
}
}
}
}
Users.CollectionChanged += (sender, e) => { Save(true); };
}
开发者ID:nokiaeducationdelivery,项目名称:ned-mobile-client-for-WP,代码行数:25,代码来源:UserDatabase.cs
示例3: RiskPanel
/// <summary>
/// Initializes a new instance of the <see cref="RiskPanel"/>.
/// </summary>
public RiskPanel()
{
InitializeComponent();
var ruleTypes = new[]
{
typeof(RiskCommissionRule),
typeof(RiskOrderFreqRule),
typeof(RiskOrderPriceRule),
typeof(RiskOrderVolumeRule),
typeof(RiskPnLRule),
typeof(RiskPositionSizeRule),
typeof(RiskPositionTimeRule),
typeof(RiskSlippageRule),
typeof(RiskTradeFreqRule),
typeof(RiskTradePriceRule),
typeof(RiskTradeVolumeRule)
};
_names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName()));
TypeCtrl.ItemsSource = _names;
TypeCtrl.SelectedIndex = 0;
var itemsSource = new ObservableCollectionEx<RuleItem>();
RuleGrid.ItemsSource = itemsSource;
_rules = new ConvertibleObservableCollection<IRiskRule, RuleItem>(new ThreadSafeObservableCollection<RuleItem>(itemsSource), CreateItem);
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:32,代码来源:RiskPanel.xaml.cs
示例4: UpdateProvider
private void UpdateProvider(ISecurityProvider provider)
{
if (_securityProvider == provider)
return;
if (_securityProvider != null)
{
_securityProvider.Added -= AddSecurities;
_securityProvider.Removed -= RemoveSecurities;
_securityProvider.Cleared -= ClearSecurities;
SecurityTextBox.ItemsSource = Enumerable.Empty<Security>();
_itemsSource = null;
}
_securityProvider = provider;
if (_securityProvider == null)
return;
var itemsSource = new ObservableCollectionEx<Security>();
_itemsSource = new ThreadSafeObservableCollection<Security>(itemsSource);
_itemsSource.AddRange(_securityProvider.LookupAll());
_securityProvider.Added += AddSecurities;
_securityProvider.Removed += RemoveSecurities;
_securityProvider.Cleared += ClearSecurities;
SecurityTextBox.ItemsSource = itemsSource;
}
开发者ID:qiujoe,项目名称:StockSharp,代码行数:31,代码来源:SecurityEditor.xaml.cs
示例5: BUG__0001__CollectionIsReadOnlyAfterInstanceCreated_NothingCanBeAdded
public void BUG__0001__CollectionIsReadOnlyAfterInstanceCreated_NothingCanBeAdded()
{
var col = new ObservableCollectionEx<object>();
col.Add(1);
Assert.IsTrue(true);
}
开发者ID:squaredinfinity,项目名称:Foundation,代码行数:7,代码来源:ObservableCollectionEx.bugfixes.cs
示例6: MainWindow
public MainWindow()
{
InitializeComponent();
var assetsSource = new ObservableCollectionEx<Security>();
var optionsSource = new ObservableCollectionEx<Security>();
Options.ItemsSource = optionsSource;
Assets.ItemsSource = assetsSource;
_assets = new ThreadSafeObservableCollection<Security>(assetsSource);
_options = new ThreadSafeObservableCollection<Security>(optionsSource);
// попробовать сразу найти месторасположение Quik по запущенному процессу
Path.Text = QuikTerminal.GetDefaultPath();
var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
timer.Tick += (sender, args) =>
{
if (!_isDirty)
return;
_isDirty = false;
RefreshChart();
};
timer.Start();
//
// добавляем тестовый данные для отображения графика
var asset = new Security { Id = "[email protected]" };
Connector = new FakeConnector(new[] { asset });
PosChart.AssetPosition = new Position
{
Security = asset,
CurrentValue = -1,
};
PosChart.MarketDataProvider = Connector;
PosChart.SecurityProvider = Connector;
var expDate = new DateTime(2014, 6, 14);
PosChart.Positions.Add(new Position
{
Security = new Security { Code = "RI C 110000", Strike = 110000, ImpliedVolatility = 45, OptionType = OptionTypes.Call, ExpiryDate = expDate, Board = ExchangeBoard.Forts, UnderlyingSecurityId = asset.Id },
CurrentValue = 10,
});
PosChart.Positions.Add(new Position
{
Security = new Security { Code = "RI P 95000", Strike = 95000, ImpliedVolatility = 30, OptionType = OptionTypes.Put, ExpiryDate = expDate, Board = ExchangeBoard.Forts, UnderlyingSecurityId = asset.Id },
CurrentValue = -3,
});
PosChart.Refresh(100000, 10, new DateTime(2014, 5, 5), expDate);
Instance = this;
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:60,代码来源:MainWindow.xaml.cs
示例7: CommissionPanel
/// <summary>
/// Initializes a new instance of the <see cref="CommissionPanel"/>.
/// </summary>
public CommissionPanel()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<RuleItem>();
RuleGrid.ItemsSource = itemsSource;
_rules = new ConvertibleObservableCollection<ICommissionRule, RuleItem>(new ThreadSafeObservableCollection<RuleItem>(itemsSource), CreateItem);
var ruleTypes = new[]
{
typeof(CommissionPerOrderCountRule),
typeof(CommissionPerOrderRule),
typeof(CommissionPerOrderVolumeRule),
typeof(CommissionPerTradeCountRule),
typeof(CommissionPerTradePriceRule),
typeof(CommissionPerTradeRule),
typeof(CommissionPerTradeVolumeRule),
typeof(CommissionSecurityIdRule),
typeof(CommissionSecurityTypeRule),
typeof(CommissionTurnOverRule),
typeof(CommissionBoardCodeRule)
};
_names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName()));
TypeCtrl.ItemsSource = _names;
TypeCtrl.SelectedIndex = 0;
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:32,代码来源:CommissionPanel.xaml.cs
示例8: Device
public Device(Guid id, string name, string description = null, ISpatialLocation location = null)
: base(id, name, description)
{
Location = location;
Recordables = new ObservableCollectionEx<IRecordable, Guid>();
Recordables.Added.Subscribe(OnRecordablesAdded);
Recordables.Removed.Subscribe(OnRecordablesRemoved);
}
开发者ID:Ce-Ma-S,项目名称:SenseLab.old,代码行数:8,代码来源:Device.cs
示例9: PortfolioPickerWindow
/// <summary>
/// Initializes a new instance of the <see cref="PortfolioPickerWindow"/>.
/// </summary>
public PortfolioPickerWindow()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<Portfolio>();
PortfoliosCtrl.ItemsSource = itemsSource;
Portfolios = new ThreadSafeObservableCollection<Portfolio>(itemsSource);
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:11,代码来源:PortfolioPickerWindow.xaml.cs
示例10: CandlesWindow
public CandlesWindow()
{
InitializeComponent();
var candlesSource = new ObservableCollectionEx<QuikCandle>();
CandleDetails.ItemsSource = candlesSource;
Candles = new ThreadSafeObservableCollection<QuikCandle>(candlesSource);
}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:8,代码来源:CandlesWindow.xaml.cs
示例11: SearchItemEditWindow
public SearchItemEditWindow(ref SearchItem searchItem)
{
_searchItem = searchItem;
InitializeComponent();
{
var icon = new BitmapImage();
icon.BeginInit();
icon.StreamSource = new FileStream(Path.Combine(App.DirectoryPaths["Icons"], "Amoeba.ico"), FileMode.Open, FileAccess.Read, FileShare.Read);
icon.EndInit();
if (icon.CanFreeze) icon.Freeze();
this.Icon = icon;
}
lock (_searchItem.ThisLock)
{
_searchTreeViewItemNameTextBox.Text = _searchItem.Name;
_nameCollection = new ObservableCollectionEx<SearchContains<string>>(_searchItem.SearchNameCollection);
_nameRegexCollection = new ObservableCollectionEx<SearchContains<SearchRegex>>(_searchItem.SearchNameRegexCollection);
_signatureCollection = new ObservableCollectionEx<SearchContains<SearchRegex>>(_searchItem.SearchSignatureCollection);
_keywordCollection = new ObservableCollectionEx<SearchContains<string>>(_searchItem.SearchKeywordCollection);
_creationTimeRangeCollection = new ObservableCollectionEx<SearchContains<SearchRange<DateTime>>>(_searchItem.SearchCreationTimeRangeCollection);
_lengthRangeCollection = new ObservableCollectionEx<SearchContains<SearchRange<long>>>(_searchItem.SearchLengthRangeCollection);
_seedCollection = new ObservableCollectionEx<SearchContains<Seed>>(_searchItem.SearchSeedCollection);
_stateCollection = new ObservableCollectionEx<SearchContains<SearchState>>(_searchItem.SearchStateCollection);
}
_searchTreeViewItemNameTextBox_TextChanged(null, null);
_nameListView.ItemsSource = _nameCollection;
_nameRegexListView.ItemsSource = _nameRegexCollection;
_signatureListView.ItemsSource = _signatureCollection;
_keywordListView.ItemsSource = _keywordCollection;
_creationTimeRangeListView.ItemsSource = _creationTimeRangeCollection;
_lengthRangeListView.ItemsSource = _lengthRangeCollection;
_seedListView.ItemsSource = _seedCollection;
_stateListView.ItemsSource = _stateCollection;
_nameListViewUpdate();
_nameRegexListViewUpdate();
_signatureListViewUpdate();
_keywordListViewUpdate();
_creationTimeRangeListViewUpdate();
_lengthRangeListViewUpdate();
_seedListViewUpdate();
_stateListViewUpdate();
foreach (var item in Enum.GetValues(typeof(SearchState)).Cast<SearchState>())
{
_stateComboBox.Items.Add(item);
}
_stateComboBox.SelectedIndex = 0;
}
开发者ID:networkelements,项目名称:Amoeba,代码行数:58,代码来源:SearchItemEditWindow.xaml.cs
示例12: MyTradeGrid
/// <summary>
/// Initializes a new instance of the <see cref="MyTradeGrid"/>.
/// </summary>
public MyTradeGrid()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<MyTrade>();
ItemsSource = itemsSource;
_trades = new ThreadSafeObservableCollection<MyTrade>(itemsSource) { MaxCount = 10000 };
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:12,代码来源:MyTradeGrid.xaml.cs
示例13: OrderLogGrid
/// <summary>
/// Initializes a new instance of the <see cref="OrderLogGrid"/>.
/// </summary>
public OrderLogGrid()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<OrderLogItem>();
ItemsSource = itemsSource;
_items = new ThreadSafeObservableCollection<OrderLogItem>(itemsSource) { MaxCount = 100000 };
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:12,代码来源:OrderLogGrid.xaml.cs
示例14: ImageShrinkerViewModel
public ImageShrinkerViewModel()
{
ImageThumbs = new ObservableCollectionEx<ImageThumbViewModel>();
Scale = 100;
Quality = 90;
ArchiveName = "BilderArchiv";
_filenames = new Dictionary<string, string>();
_selectedThumb = null;
}
开发者ID:trommlbomml,项目名称:ImageShrinker,代码行数:9,代码来源:ImageShrinkerViewModel.cs
示例15: Level1Grid
/// <summary>
/// Initializes a new instance of the <see cref="Level1Grid"/>.
/// </summary>
public Level1Grid()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<Level1ChangeMessage>();
ItemsSource = itemsSource;
_messages = new ThreadSafeObservableCollection<Level1ChangeMessage>(itemsSource) { MaxCount = 10000 };
}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:12,代码来源:Level1Grid.xaml.cs
示例16: NewsGrid
/// <summary>
/// Создать <see cref="NewsGrid"/>.
/// </summary>
public NewsGrid()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<News>();
ItemsSource = itemsSource;
_news = new ThreadSafeObservableCollection<News>(itemsSource) { MaxCount = 10000 };
}
开发者ID:reddream,项目名称:StockSharp,代码行数:12,代码来源:NewsGrid.xaml.cs
示例17: ExecutionGrid
/// <summary>
/// Initializes a new instance of the <see cref="ExecutionGrid"/>.
/// </summary>
public ExecutionGrid()
{
InitializeComponent();
var itemsSource = new ObservableCollectionEx<ExecutionMessage>();
ItemsSource = itemsSource;
_messages = new ThreadSafeObservableCollection<ExecutionMessage>(itemsSource) { MaxCount = 1000000 };
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:12,代码来源:ExecutionGrid.xaml.cs
示例18: SimpleListViewModel
public SimpleListViewModel()
{
items = new ObservableCollectionEx<string>()
{
"Alpha",
"Beta",
"Gamma"
};
}
开发者ID:red-gate,项目名称:Knockout.Binding,代码行数:9,代码来源:SimpleListViewModel.cs
示例19: ObsCollExCollectionChangedTest
public void ObsCollExCollectionChangedTest()
{
ObservableCollectionEx<string> target = new ObservableCollectionEx<string>();
target.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(target_CollectionChanged);
target.Add("Walter White");
Assert.AreEqual(NotifyCollectionChangedAction.Add,_Args.Action);
Assert.AreEqual(1, _Args.NewItems.Count);
Assert.AreEqual("Walter White", _Args.NewItems[0]);
_Args = null;
}
开发者ID:PigDogBay,项目名称:MpdbSharedLibrary,代码行数:10,代码来源:ObservableCollectionExTest.cs
示例20: SignatureTreeViewModel
public SignatureTreeViewModel(TreeViewModelBase parent, SignatureTreeItem value)
: base(parent)
{
if (value == null) throw new ArgumentNullException(nameof(value));
_children = new ObservableCollectionEx<TreeViewModelBase>();
_readonlyChildren = new ReadOnlyObservableCollection<TreeViewModelBase>(_children);
this.Value = value;
}
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:10,代码来源:SignatureTreeViewModel.cs
注:本文中的ObservableCollectionEx类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论