本文整理汇总了C#中BindableCollection.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# BindableCollection.Insert方法的具体用法?C# BindableCollection.Insert怎么用?C# BindableCollection.Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindableCollection
的用法示例。
在下文中一共展示了BindableCollection.Insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DatabaseModel
public DatabaseModel(string name, DocumentStore documentStore)
{
this.name = name;
this.documentStore = documentStore;
Tasks = new BindableCollection<TaskModel>(x => x.Name)
{
new ImportTask(),
new ExportTask(),
new StartBackupTask(),
new IndexingTask(),
new SampleDataTask(),
new CsvImportTask()
};
if (name == null || name == Constants.SystemDatabase)
Tasks.Insert(3, new StartRestoreTask());
SelectedTask = new Observable<TaskModel> { Value = Tasks.FirstOrDefault() };
Statistics = new Observable<DatabaseStatistics>();
Status = new Observable<string>
{
Value = "Offline"
};
asyncDatabaseCommands = name.Equals(Constants.SystemDatabase, StringComparison.OrdinalIgnoreCase)
? documentStore.AsyncDatabaseCommands.ForDefaultDatabase()
: documentStore.AsyncDatabaseCommands.ForDatabase(name);
DocumentChanges.Select(c => Unit.Default).Merge(IndexChanges.Select(c => Unit.Default))
.SampleResponsive(TimeSpan.FromSeconds(2))
.Subscribe(_ => RefreshStatistics(), exception => ApplicationModel.Current.Server.Value.IsConnected.Value = false);
databaseChanges.ConnectionStatusCahnged += (sender, args) =>
{
ApplicationModel.Current.Server.Value.IsConnected.Value = (sender as IDatabaseChanges).Connected;
OnPropertyChanged(() => ApplicationModel.Current.Server.Value.IsConnected);
UpdateStatus();
};
RefreshStatistics();
}
示例2: ShellViewModel
public ShellViewModel()
{
Messages = new BindableCollection<LogMessage>();
SelectedMessages = new BindableCollection<LogMessage>();
IgnoredProcesses = new BindableCollection<string>();
IgnoredText = new BindableCollection<string>();
_listener = new WpfTraceListener();
_listener.CollectionChanged += (sender, e) =>
{
if (e.Action != NotifyCollectionChangedAction.Add) return;
var logMessage = (LogMessage) e.NewItems[0];
if(FilterMessage(logMessage))
{
IgnoredMessages += 1;
return;
}
Messages.Insert(0, logMessage);
};
}