本文整理汇总了C#中BindableCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# BindableCollection.Clear方法的具体用法?C# BindableCollection.Clear怎么用?C# BindableCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindableCollection
的用法示例。
在下文中一共展示了BindableCollection.Clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SynchronizeDiagnozy
/// <summary>
/// button evet click handler, handles Diagnozy synchronization
/// </summary>
public void SynchronizeDiagnozy()
{
ambulanceDiagonzies = new BindableCollection<Cis_Diagnoza>();
AmbulanceSynchronizationDomainContext ambulance = _serviceLocator.GetInstance<AmbulanceSynchronizationDomainContext>();
EntityQuery<Cis_Diagnoza> query = ambulance.GetCis_DiagnozaQuery();
EntityQuery<Diagnozy> query2 = _laboratoryDomainContext.GetAllDiagnoziesQuery();
List<IResult> results = new List<IResult>();
results.Add(Show.Busy());
LoadData<Cis_Diagnoza> loadResult = new LoadData<Cis_Diagnoza>(ambulance,query,LoadBehavior.RefreshCurrent,(sender) =>
{
ambulanceDiagonzies.Clear();
ambulanceDiagonzies.AddRange(((LoadOperation<Cis_Diagnoza>)sender).Entities);
}
);
LoadData<Diagnozy> loadResult2 = new LoadData<Diagnozy>(_laboratoryDomainContext, query2, LoadBehavior.RefreshCurrent, (sender) =>
{
laboratoryDiagnozy.Clear();
laboratoryDiagnozy.AddRange(((LoadOperation<Diagnozy>)sender).Entities);
bool found = false;
foreach (var item in ambulanceDiagonzies)
{
for (int i = 0; i < laboratoryDiagnozy.Count; i++)
{
found = false;
if (item.Nazov == laboratoryDiagnozy[i].nazov && item.Poznamka == laboratoryDiagnozy[i].popis)
{
laboratoryDiagnozy.RemoveAt(i);
found = true;
break;
}
}
if (found == false)
{
Diagnozy novaDiagnoza = new Diagnozy();
novaDiagnoza.nazov = item.Nazov;
novaDiagnoza.popis = item.Poznamka;
_laboratoryDomainContext.Diagnozies.Add(novaDiagnoza);
}
}
_laboratoryDomainContext.SubmitChanges();
Coroutine.BeginExecuteFor(Show.NotBusy(), this);
}
);
results.Add(loadResult);
results.Add(loadResult2);
Coroutine.BeginExecuteFor(results, this);
}
示例2: when_Clear_is_called_then_Reset_event_is_fired
public void when_Clear_is_called_then_Reset_event_is_fired()
{
var testSchedulerProvider = new TestDispatcherSchedulerProvider();
var result = false;
var bindableCollection = new BindableCollection<Guid>(testSchedulerProvider);
var newGuid = Guid.NewGuid();
bindableCollection.Add(newGuid);
bindableCollection.CollectionChanged += (sender, args) =>
{
if (args.Action == NotifyCollectionChangedAction.Reset)
{
result = true;
}
};
bindableCollection.Clear();
Assert.That(result, Is.True);
}
示例3: SynchronizePoistovne
/// <summary>
/// button evet click handler, handles Poistovne synchronization
/// </summary>
public void SynchronizePoistovne()
{
ambulancePoistovne = new BindableCollection<Cis_Poistovne>();
AmbulanceSynchronizationDomainContext ambulance = _serviceLocator.GetInstance<AmbulanceSynchronizationDomainContext>();
EntityQuery<Cis_Poistovne> query = ambulance.GetCis_PoistovneQuery();
EntityQuery<Poistovne> query2 = _laboratoryDomainContext.GetAllPoistovneQuery();
List<IResult> results = new List<IResult>();
results.Add(Show.Busy());
LoadData<Cis_Poistovne> loadResult = new LoadData<Cis_Poistovne>(ambulance, query, LoadBehavior.RefreshCurrent, (sender) =>
{
ambulancePoistovne.Clear();
ambulancePoistovne.AddRange(((LoadOperation<Cis_Poistovne>)sender).Entities);
}
);
LoadData<Poistovne> loadResult2 = new LoadData<Poistovne>(_laboratoryDomainContext, query2, LoadBehavior.RefreshCurrent, (sender) =>
{
laboratoryPoistovne.Clear();
laboratoryPoistovne.AddRange(((LoadOperation<Poistovne>)sender).Entities);
bool found = false;
foreach (var item in ambulancePoistovne)
{
for (int i = 0; i < laboratoryPoistovne.Count; i++)
{
found = false;
if (item.Nazov == laboratoryPoistovne[i].nazov)
{
laboratoryPoistovne.RemoveAt(i);
found = true;
break;
}
}
if (found == false)
{
Poistovne novaPoistovna = new Poistovne();
novaPoistovna.nazov = item.Nazov;
_laboratoryDomainContext.Poistovnes.Add(novaPoistovna);
}
}
_laboratoryDomainContext.SubmitChanges();
Coroutine.BeginExecuteFor(Show.NotBusy(), this);
}
);
results.Add(loadResult);
results.Add(loadResult2);
Coroutine.BeginExecuteFor(results, this);
}
示例4: SynchronizeLieky
/// <summary>
/// button evet click handler, handles Lieky synchronization
/// </summary>
public void SynchronizeLieky()
{
ambulanceLieky = new BindableCollection<Cis_Lieky>();
AmbulanceSynchronizationDomainContext ambulance = _serviceLocator.GetInstance<AmbulanceSynchronizationDomainContext>();
EntityQuery<Cis_Lieky> query = ambulance.GetCis_LiekyQuery();
EntityQuery<Lieky> query2 = _laboratoryDomainContext.GetAllLiekiesQuery();
List<IResult> results = new List<IResult>();
results.Add(Show.Busy());
LoadData<Cis_Lieky> loadResult = new LoadData<Cis_Lieky>(ambulance, query, LoadBehavior.RefreshCurrent, (sender) =>
{
ambulanceLieky.Clear();
ambulanceLieky.AddRange(((LoadOperation<Cis_Lieky>)sender).Entities);
}
);
LoadData<Lieky> loadResult2 = new LoadData<Lieky>(_laboratoryDomainContext, query2, LoadBehavior.RefreshCurrent, (sender) =>
{
laboratoryLieky.Clear();
laboratoryLieky.AddRange(((LoadOperation<Lieky>)sender).Entities);
bool found = false;
foreach (var item in ambulanceLieky)
{
for (int i = 0; i < laboratoryLieky.Count; i++)
{
found = false;
if (item.Nazov == laboratoryLieky[i].nazov && item.Kod == laboratoryLieky[i].kod)
{
laboratoryLieky.RemoveAt(i);
found = true;
break;
}
}
if (found == false)
{
Lieky novyLiek = new Lieky();
novyLiek.nazov = item.Nazov;
novyLiek.kod = item.Kod;
_laboratoryDomainContext.Liekies.Add(novyLiek);
}
}
_laboratoryDomainContext.SubmitChanges();
Coroutine.BeginExecuteFor(Show.NotBusy(), this);
}
);
results.Add(loadResult);
results.Add(loadResult2);
Coroutine.BeginExecuteFor(results, this);
}
示例5: getHerdAgentList
public void getHerdAgentList(ref BindableCollection <HerdAgentViewModel> outHerdAgentList, int timeoutSeconds= 10)
{
lock (m_listLock)
{
outHerdAgentList.Clear();
foreach (var agent in m_herdAgentList)
if (System.DateTime.Now.Subtract(agent.Value.lastACK).TotalSeconds < timeoutSeconds)
outHerdAgentList.Add(agent.Value);
}
}
示例6: ClearItemsUsesDispatcherToRaiseEvents
public void ClearItemsUsesDispatcherToRaiseEvents()
{
var collection = new BindableCollection<Element>() { new Element() };
bool propertyChangedRaised = false;
((INotifyPropertyChanged)collection).PropertyChanged += (o, e) => propertyChangedRaised = true;
bool collectionChangingRaised = false;
collection.CollectionChanging += (o, e) => collectionChangingRaised = true;
bool collectionChangedRaised = false;
collection.CollectionChanged += (o, e) => collectionChangedRaised = true;
var dispatcher = new TestDispatcher();
Execute.Dispatcher = dispatcher;
collection.Clear();
Assert.False(propertyChangedRaised);
Assert.False(collectionChangingRaised);
Assert.False(collectionChangedRaised);
Assert.NotNull(dispatcher.SendAction);
dispatcher.SendAction();
Assert.True(propertyChangedRaised);
Assert.True(collectionChangingRaised);
Assert.True(collectionChangedRaised);
}
示例7: ClearItemsUsesDispatcherToClearItems
public void ClearItemsUsesDispatcherToClearItems()
{
var collection = new BindableCollection<Element>() { new Element() };
var dispatcher = new TestDispatcher();
Execute.Dispatcher = dispatcher;
collection.Clear();
Assert.AreEqual(1, collection.Count);
Assert.NotNull(dispatcher.SendAction);
dispatcher.SendAction();
Assert.AreEqual(0, collection.Count);
}
示例8: ClearItemsRaisesCollectionChangingBeforeClearingItems
public void ClearItemsRaisesCollectionChangingBeforeClearingItems()
{
var collection = new BindableCollection<Element>() { new Element() };
// We assert elsewhere that this event is raised
collection.CollectionChanging += (o, e) =>
{
Assert.AreEqual(1, collection.Count);
Assert.AreEqual(NotifyCollectionChangedAction.Reset, e.Action);
};
collection.Clear();
}