Here are the examples of the csharp api System.Collections.Generic.ICollection.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1594 Examples
19
Source : ListSnapshot.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Clear() {
((ICollection<T>) List).Clear();
}
19
Source : BindableObjectCollection.cs
with MIT License
from 1iveowl
with MIT License
from 1iveowl
public void Clear()
{
_items.Clear();
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
19
Source : SegmentedControl.cs
with MIT License
from 1iveowl
with MIT License
from 1iveowl
private static void OnChildrenChanging(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is SegmentedControl segmentedControl
&& newValue is IList<SegmentedControlOption> newItemsList
&& segmentedControl.Children != null)
{
segmentedControl.OnElementChildrenChanging?.Invoke(segmentedControl, new ElementChildrenChanging((IList<SegmentedControlOption>)oldValue, newItemsList));
segmentedControl.Children.Clear();
foreach (var newSegment in newItemsList)
{
newSegment.BindingContext = segmentedControl.BindingContext;
segmentedControl.Children.Add(newSegment);
}
}
}
19
Source : LProjectDependencies.cs
with MIT License
from 3F
with MIT License
from 3F
public override void PreProcessing(ISvc svc)
{
Projects.Clear();
order.Clear();
map.Clear();
}
19
Source : JsonData.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
void IDictionary.Clear ()
{
EnsureDictionary ().Clear ();
object_list.Clear ();
json = null;
}
19
Source : JsonMapper.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public static void UnregisterExporters ()
{
custom_exporters_table.Clear ();
}
19
Source : JsonMapper.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public static void UnregisterImporters ()
{
custom_importers_table.Clear ();
}
19
Source : IteratorExpression.cs
with MIT License
from 71
with MIT License
from 71
private void CountYields()
{
_yields.Clear();
Expressive.Pipeline(CountYield).Visit(Iterator);
}
19
Source : DispatcherObservableCollection.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
public void Clear()
{
lock (_syncRoot)
{
_collection.Clear();
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
19
Source : QuestManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void EraseAll()
{
if (Debug)
Console.WriteLine($"{Name}.QuestManager.EraseAll");
if (Creature is Player player)
{
player.Character.EraseAllQuests(out var questNamesErased, player.CharacterDatabaseLock);
if (questNamesErased.Count > 0)
{
player.CharacterChangesDetected = true;
foreach (var questName in questNamesErased)
player.ContractManager.NotifyOfQuestUpdate(questName);
}
}
else
{
// Not a player
runtimeQuests.Clear();
}
}
19
Source : ExtendedObservableCollection.cs
with GNU General Public License v3.0
from Acumatica
with GNU General Public License v3.0
from Acumatica
public void Reset(IEnumerable<T> range)
{
Items.Clear();
AddRange(range);
}
19
Source : Packet.cs
with MIT License
from adamtcroft
with MIT License
from adamtcroft
public void Clear()
{
procedure = "";
keywordArguments.Clear();
}
19
Source : TreeElementUtility.cs
with MIT License
from Adsito
with MIT License
from Adsito
public static void TreeToList<T>(T root, IList<T> result) where T : TreeElement
{
if (result == null)
throw new NullReferenceException("The input 'IList<T> result' list is null");
result.Clear();
Stack<T> stack = new Stack<T>();
stack.Push(root);
while (stack.Count > 0)
{
T current = stack.Pop();
result.Add(current);
if (current.children != null && current.children.Count > 0)
{
for (int i = current.children.Count - 1; i >= 0; i--)
{
stack.Push((T)current.children[i]);
}
}
}
}
19
Source : PathHierarchyTreeView.cs
with MIT License
from Adsito
with MIT License
from Adsito
public static void TreeToList(TreeViewItem root, IList<TreeViewItem> result)
{
if (root == null)
throw new NullReferenceException("root");
if (result == null)
throw new NullReferenceException("result");
result.Clear();
if (root.children == null)
return;
Stack<TreeViewItem> stack = new Stack<TreeViewItem>();
for (int i = root.children.Count - 1; i >= 0; i--)
stack.Push(root.children[i]);
while (stack.Count > 0)
{
TreeViewItem current = stack.Pop();
result.Add(current);
if (current.hasChildren && current.children[0] != null)
{
for (int i = current.children.Count - 1; i >= 0; i--)
{
stack.Push(current.children[i]);
}
}
}
}
19
Source : PrefabHierarchyTreeView.cs
with MIT License
from Adsito
with MIT License
from Adsito
public static void TreeToList (TreeViewItem root, IList<TreeViewItem> result)
{
if (root == null)
throw new NullReferenceException("root");
if (result == null)
throw new NullReferenceException("result");
result.Clear();
if (root.children == null)
return;
Stack<TreeViewItem> stack = new Stack<TreeViewItem>();
for (int i = root.children.Count - 1; i >= 0; i--)
stack.Push(root.children[i]);
while (stack.Count > 0)
{
TreeViewItem current = stack.Pop();
result.Add(current);
if (current.hasChildren && current.children[0] != null)
for (int i = current.children.Count - 1; i >= 0; i--)
stack.Push(current.children[i]);
}
}
19
Source : PrefabsListTreeView.cs
with MIT License
from Adsito
with MIT License
from Adsito
public static void TreeToList(TreeViewItem root, IList<TreeViewItem> result)
{
if (root == null)
throw new NullReferenceException("root");
if (result == null)
throw new NullReferenceException("result");
result.Clear();
if (root.children == null)
return;
Stack<TreeViewItem> stack = new Stack<TreeViewItem>();
for (int i = root.children.Count - 1; i >= 0; i--)
stack.Push(root.children[i]);
while (stack.Count > 0)
{
TreeViewItem current = stack.Pop();
result.Add(current);
if (current.hasChildren && current.children[0] != null)
for (int i = current.children.Count - 1; i >= 0; i--)
stack.Push(current.children[i]);
}
}
19
Source : RedisLite.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
protected bool SendCommand(params byte[][] cmdWithBinaryArgs)
{
if (!replacedertConnectedSocket()) return false;
try
{
CmdLog(cmdWithBinaryArgs);
//Total command lines count
WriteAllToSendBuffer(cmdWithBinaryArgs);
FlushSendBuffer();
}
catch (SocketException ex)
{
_cmdBuffer.Clear();
return HandleSocketException(ex);
}
return true;
}
19
Source : ConvexHullHelper.Pruning.cs
with The Unlicense
from aeroson
with The Unlicense
from aeroson
public static void RemoveRedundantPoints(IList<Vector3> points, double cellSize)
{
var rawPoints = CommonResources.GetVectorList();
rawPoints.AddRange(points);
RemoveRedundantPoints(rawPoints, cellSize);
points.Clear();
for (int i = 0; i < rawPoints.Count; ++i)
{
points.Add(rawPoints.Elements[i]);
}
CommonResources.GiveBack(rawPoints);
}
19
Source : KDTree.cs
with MIT License
from aillieo
with MIT License
from aillieo
public void QueryInRange(Vector2 center, float radius, ICollection<T> toFill)
{
if (managed.Count == 0)
{
return;
}
processingQueue.Clear();
toFill.Clear();
float radiusSq = radius * radius;
processingQueue.Enqueue(root);
while (processingQueue.Count > 0)
{
KDNode node = processingQueue.Dequeue();
if (node.leftLeaf == null && node.rightLeaf == null)
{
// leaf
for (int i = node.startIndex; i < node.endIndex; ++i)
{
int index = permutation[i];
if (Vector2.SqrMagnitude(managed[index].position - center) <= radiusSq)
{
toFill.Add(managed[index]);
}
}
}
else
{
// todo 可以缓存更多信息 加速叶节点的查找
if (IsKDNodeInRange(node.leftLeaf, center, radiusSq))
{
processingQueue.Enqueue(node.leftLeaf);
}
if (IsKDNodeInRange(node.rightLeaf, center, radiusSq))
{
processingQueue.Enqueue(node.rightLeaf);
}
}
}
}
19
Source : OpenIdConnectOptionsBuilder.cs
with GNU General Public License v3.0
from AISGorod
with GNU General Public License v3.0
from AISGorod
private void _FillScopes(ICollection<string> optionsScope)
{
optionsScope.Clear();
optionsScope.Add("openid");
if (esiaOptions.Scope != null)
{
foreach (var scope in esiaOptions.Scope)
{
if (!scope.Equals("openid", StringComparison.OrdinalIgnoreCase))
{
optionsScope.Add(scope);
}
}
}
}
19
Source : FlowableDistinct.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public override void OnError(Exception cause)
{
set.Clear();
actual.OnError(cause);
}
19
Source : FlowableDistinct.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public override void OnComplete()
{
set.Clear();
actual.OnComplete();
}
19
Source : FlowableDistinct.cs
with Apache License 2.0
from akarnokd
with Apache License 2.0
from akarnokd
public override void OnError(Exception cause)
{
set.Clear();
actual.OnComplete();
}
19
Source : JContainer.cs
with MIT License
from akaskela
with MIT License
from akaskela
internal virtual void ClearItems()
{
CheckReentrancy();
IList<JToken> children = ChildrenTokens;
foreach (JToken item in children)
{
item.Parent = null;
item.Previous = null;
item.Next = null;
}
children.Clear();
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
{
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
}
#endif
#if !(NET20 || NET35 || PORTABLE40)
if (_collectionChanged != null)
{
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
#endif
}
19
Source : CollectionWrapper.cs
with MIT License
from akaskela
with MIT License
from akaskela
public virtual void Clear()
{
if (_genericCollection != null)
{
_genericCollection.Clear();
}
else
{
_list.Clear();
}
}
19
Source : DictionaryWrapper.cs
with MIT License
from akaskela
with MIT License
from akaskela
public void Clear()
{
if (_dictionary != null)
{
_dictionary.Clear();
}
#if !(NET40 || NET35 || NET20 || PORTABLE40)
else if (_readOnlyDictionary != null)
{
throw new NotSupportedException();
}
#endif
else
{
_genericDictionary.Clear();
}
}
19
Source : PointSet.cs
with MIT License
from Alan-FGR
with MIT License
from Alan-FGR
public void ClearTriangles()
{
Triangles.Clear();
}
19
Source : PointSet.cs
with MIT License
from Alan-FGR
with MIT License
from Alan-FGR
public virtual void PrepareTriangulation(TriangulationContext tcx)
{
if (Triangles == null)
{
Triangles = new List<DelaunayTriangle>(Points.Count);
}
else
{
Triangles.Clear();
}
tcx.Points.AddRange(Points);
}
19
Source : MainForm.cs
with MIT License
from AlexanderPro
with MIT License
from AlexanderPro
private void Start()
{
Environment.CurrentDirectory = replacedemblyUtils.replacedemblyDirectory;
_isProgramStarted = false;
try
{
_settings = ProgramSettings.Read();
}
catch
{
MessageBox.Show("Failed to read a program setting file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (_listerForm != null && _listerForm.IsHandleCreated)
{
_listerForm.Close();
}
_plugins = _plugins ?? new List<Plugin>();
foreach (var plugin in _plugins)
{
try
{
plugin.UnloadModule();
}
catch
{
var message = string.Format("Failed to unload a plugin \"{0}\".", plugin.ModuleName);
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
_plugins.Clear();
foreach (var pluginInfo in _settings.Plugins)
{
var plugin = new Plugin(pluginInfo.Path);
var pluginLoaded = false;
var pluginInitialized = true;
try
{
pluginLoaded = plugin.LoadModule();
}
catch
{
pluginLoaded = false;
}
try
{
if (plugin.ListSetDefaultParamsExist)
{
var pluginExtension = Path.GetExtension(pluginInfo.Path);
var pluginIniFile = Path.GetFullPath(pluginInfo.Path).Replace(pluginExtension, ".ini");
if (!File.Exists(pluginIniFile))
{
plugin.ListSetDefaultParams(_settings.PluginLowVersion, _settings.PluginHighVersion, _settings.PluginIniFile);
}
}
}
catch
{
pluginInitialized = false;
}
if (pluginLoaded && pluginInitialized)
{
_plugins.Add(plugin);
}
else
if (!pluginLoaded)
{
var message = string.Format("Failed to load the plugin {0} \"{1}\".", Environment.NewLine, pluginInfo.Path);
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
var message = string.Format("Failed to initialize the plugin with default settings {0} \"{1}\".", Environment.NewLine, pluginInfo.Path);
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
try
{
_keyboardKook = _keyboardKook ?? new KeyboardHook();
_keyboardKook.Stop();
_keyboardKook.Hooked -= KeyHooked;
_keyboardKook.Hooked += KeyHooked;
bool result = _keyboardKook.Start(_settings.ListerFormKey1, _settings.ListerFormKey2, _settings.ListerFormKey3);
if (!result) throw new Exception("Failed to run a keyboard hook.");
_isProgramStarted = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
19
Source : MainForm.cs
with MIT License
from AlexanderPro
with MIT License
from AlexanderPro
private void Stop()
{
if (_listerForm != null && _listerForm.IsHandleCreated)
{
_listerForm.Close();
}
_plugins = _plugins ?? new List<Plugin>();
foreach (var plugin in _plugins)
{
try
{
plugin.UnloadModule();
}
catch
{
var message = string.Format("Failed to unload a plugin \"{0}\".", plugin.ModuleName);
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
_plugins.Clear();
_keyboardKook = _keyboardKook ?? new KeyboardHook();
_keyboardKook.Stop();
_keyboardKook.Hooked -= KeyHooked;
_isProgramStarted = false;
}
19
Source : PluginManager.cs
with GNU General Public License v3.0
from alexdillon
with GNU General Public License v3.0
from alexdillon
public void LoadPlugins(string pluginsPath)
{
this.GroupChatPluginsAutoInstalled.Clear();
this.GroupChatPluginsBuiltIn.Clear();
this.GroupChatPluginsManuallyInstalled.Clear();
this.MessageComposePluginsAutoInstalled.Clear();
this.MessageComposePluginsBuiltIn.Clear();
this.MessageComposePluginsManuallyInstalled.Clear();
Directory.CreateDirectory(pluginsPath);
Directory.CreateDirectory(Path.Combine(pluginsPath, PluginInstaller.PackagesDirectory));
if (Directory.Exists(pluginsPath))
{
// Handle staged removals
foreach (var file in Directory.GetFiles(Path.Combine(pluginsPath, PluginInstaller.PackagesDirectory), "*.rm"))
{
if (Path.GetFileNameWithoutExtension(file).EndsWith(PluginInstaller.StagingSuffix))
{
var originalPluginName = Path.GetFileNameWithoutExtension(file).Replace(PluginInstaller.StagingSuffix, string.Empty);
var originalPluginFullPath = Path.Combine(pluginsPath, PluginInstaller.PackagesDirectory, originalPluginName);
if (new FileInfo(file).Length == 0)
{
// Delete the zero-byte staging stub
File.Delete(file);
// Delete the staged installation directory
if (Directory.Exists(originalPluginFullPath))
{
Directory.Delete(originalPluginFullPath, true);
}
}
}
}
// Handle staged upgrades
foreach (var directory in Directory.GetDirectories(Path.Combine(pluginsPath, PluginInstaller.PackagesDirectory)))
{
if (Path.GetFileNameWithoutExtension(directory).EndsWith(PluginInstaller.StagingSuffix))
{
var originalPluginName = Path.GetFileNameWithoutExtension(directory).Replace(PluginInstaller.StagingSuffix, string.Empty);
var originalPluginFullPath = Path.Combine(pluginsPath, PluginInstaller.PackagesDirectory, originalPluginName);
if (Directory.Exists(originalPluginFullPath))
{
Directory.Delete(originalPluginFullPath, true);
}
Directory.Move(directory, originalPluginFullPath);
}
}
var dllFileNames = Directory.GetFiles(pluginsPath, "*.dll", SearchOption.AllDirectories);
var replacedemblies = new List<replacedembly>(dllFileNames.Length);
foreach (string dllFile in dllFileNames)
{
var an = replacedemblyName.GetreplacedemblyName(dllFile);
var replacedembly = replacedembly.Load(an);
replacedemblies.Add(replacedembly);
}
var pluginType = typeof(PluginBase);
var pluginTypes = new List<Type>();
foreach (var replacedembly in replacedemblies)
{
if (replacedembly != null)
{
try
{
var types = replacedembly.GetTypes();
foreach (var type in types)
{
if (type.IsInterface || type.IsAbstract)
{
continue;
}
else
{
if (type.IsSubclreplacedOf(pluginType))
{
pluginTypes.Add(type);
}
}
}
}
catch (Exception)
{
Debug.WriteLine($"Failed to load plugin {replacedembly.FullName}");
}
}
}
var pluginInstaller = Ioc.Default.GetService<PluginInstaller>();
foreach (var type in pluginTypes)
{
var hostedreplacedemblyName = Path.GetFileNameWithoutExtension(Path.GetDirectoryName(type.Module.replacedembly.Location));
var installedPlugin = pluginInstaller.InstalledPlugins.FirstOrDefault(p => p.InstallationGuid == hostedreplacedemblyName);
var plugin = (PluginBase)Activator.CreateInstance(type);
if (plugin is IMessageComposePlugin messageComposePlugin)
{
if (installedPlugin == null)
{
this.MessageComposePluginsManuallyInstalled.Add(messageComposePlugin);
}
else
{
this.MessageComposePluginsAutoInstalled.Add(messageComposePlugin);
}
}
else if (plugin is IGroupChatPlugin groupChatPlugin)
{
if (installedPlugin == null)
{
this.GroupChatPluginsManuallyInstalled.Add(groupChatPlugin);
}
else
{
this.GroupChatPluginsAutoInstalled.Add(groupChatPlugin);
}
}
}
}
// Load plugins that ship directly in GMDC/Wpf
this.GroupChatPluginsBuiltIn.Add(new ImageGalleryPlugin());
}
19
Source : PluginManager.cs
with GNU General Public License v3.0
from alexdillon
with GNU General Public License v3.0
from alexdillon
public void LoadPlugins(string pluginsPath)
{
if (!Directory.Exists(pluginsPath))
{
return;
}
string[] dllFileNames = Directory.GetFiles(pluginsPath, "*.dll");
ICollection<replacedembly> replacedemblies = new List<replacedembly>(dllFileNames.Length);
foreach (string dllFile in dllFileNames)
{
replacedembly pluginreplacedembly = LoadPlugin(dllFile);
replacedemblies.Add(pluginreplacedembly);
}
Type pluginType = typeof(PluginBase);
ICollection<Type> pluginTypes = new List<Type>();
foreach (replacedembly replacedembly in replacedemblies)
{
try
{
if (replacedembly != null)
{
Type[] types = replacedembly.GetTypes();
foreach (Type type in types)
{
if (type.IsInterface || type.IsAbstract)
{
continue;
}
else
{
if (type.IsSubclreplacedOf(pluginType))
{
pluginTypes.Add(type);
}
}
}
}
}
catch (Exception ex)
{
Debug.WriteLine("Error loading plugin {0}. Error Code: {1}", replacedembly.FullName, ex.Message);
}
}
this.GroupChatPlugins.Clear();
this.MessageComposePlugins.Clear();
foreach (Type type in pluginTypes)
{
var plugin = (PluginBase)Activator.CreateInstance(type);
if (plugin is IMessageComposePlugin messageComposePlugin)
{
this.MessageComposePlugins.Add(messageComposePlugin);
}
else if (plugin is IGroupChatPlugin groupChatPlugin)
{
this.GroupChatPlugins.Add(groupChatPlugin);
}
else if (plugin is IGroupChatCachePlugin groupChatCachePlugin)
{
this.GroupChatCachePlugins.Add(groupChatCachePlugin);
}
}
}
19
Source : Settings.cs
with GNU General Public License v3.0
from alexgracianoarj
with GNU General Public License v3.0
from alexgracianoarj
private void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e)
{
if (CSharpImportList == null)
CSharpImportList = new StringCollection();
if (JavaImportList == null)
JavaImportList = new StringCollection();
ImportList.Clear();
ImportList.Add(CSharp.CSharpLanguage.Instance, CSharpImportList);
ImportList.Add(Java.JavaLanguage.Instance, JavaImportList);
if (string.IsNullOrEmpty(DestinationPath))
{
string myDoreplacedents = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents);
DestinationPath = Path.Combine(myDoreplacedents, "NClreplaced Generated Projects");
}
}
19
Source : TreeColumnCollection.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected override void ClearItems()
{
foreach (TreeColumn c in Items)
UnbindEvents(c);
Items.Clear();
_treeView.UpdateColumns();
}
19
Source : CategoryAxis.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
public override void GetTickValues(
out IList<double> majorLabelValues, out IList<double> majorTickValues, out IList<double> minorTickValues)
{
base.GetTickValues(out majorLabelValues, out majorTickValues, out minorTickValues);
minorTickValues.Clear();
if (!this.IsTickCentered)
{
// Subtract 0.5 from the label values to get the tick values.
// Add one extra tick at the end.
var mv = new List<double>(majorLabelValues.Count);
mv.AddRange(majorLabelValues.Select(v => v - 0.5));
if (mv.Count > 0)
{
mv.Add(mv[mv.Count - 1] + 1);
}
majorTickValues = mv;
}
}
19
Source : CategoryAxis.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
internal void UpdateLabels(IEnumerable<Series> series)
{
if (this.ItemsSource != null)
{
this.Labels.Clear();
ReflectionHelper.FillList(this.ItemsSource, this.LabelField, this.Labels);
}
if (this.Labels.Count == 0)
{
foreach (var s in series)
{
if (!s.IsUsing(this))
{
continue;
}
var bsb = s as CategorizedSeries;
if (bsb != null)
{
int max = bsb.Gereplacedems().Count;
while (this.Labels.Count < max)
{
this.Labels.Add((this.Labels.Count + 1).ToString(CultureInfo.InvariantCulture));
}
}
}
}
}
19
Source : IntervalBarSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected internal override void UpdateData()
{
if (this.ItemsSource != null)
{
this.Items.Clear();
var filler = new ListFiller<IntervalBarItem>();
filler.Add(this.MinimumField, (item, value) => item.Start = Convert.ToDouble(value));
filler.Add(this.MaximumField, (item, value) => item.End = Convert.ToDouble(value));
filler.FillT(this.Items, this.ItemsSource);
}
}
19
Source : DataPointSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected void AddDataPoints(IList<IDataPoint> pts)
{
pts.Clear();
// Use the mapping to generate the points
if (this.Mapping != null)
{
foreach (var item in this.ItemsSource)
{
pts.Add(this.Mapping(item));
}
return;
}
// Get DataPoints from the items in ItemsSource
// if they implement IDataPointProvider
// If DataFields are set, this is not used
if (this.DataFieldX == null || this.DataFieldY == null)
{
foreach (var item in this.ItemsSource)
{
var dp = item as IDataPoint;
if (dp != null)
{
pts.Add(dp);
continue;
}
var idpp = item as IDataPointProvider;
if (idpp == null)
{
continue;
}
pts.Add(idpp.GetDataPoint());
}
}
else
{
// TODO: is there a better way to do this?
// http://msdn.microsoft.com/en-us/library/bb613546.aspx
// Using reflection on DataFieldX and DataFieldY
this.AddDataPoints((IList)pts, this.ItemsSource, this.DataFieldX, this.DataFieldY);
}
}
19
Source : HighLowSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected internal override void UpdateData()
{
if (this.ItemsSource == null)
{
return;
}
this.items.Clear();
// Use the mapping to generate the points
if (this.Mapping != null)
{
foreach (var item in this.ItemsSource)
{
this.items.Add(this.Mapping(item));
}
return;
}
var filler = new ListFiller<HighLowItem>();
filler.Add(this.DataFieldX, (p, v) => p.X = this.ToDouble(v));
filler.Add(this.DataFieldHigh, (p, v) => p.High = this.ToDouble(v));
filler.Add(this.DataFieldLow, (p, v) => p.Low = this.ToDouble(v));
filler.Add(this.DataFieldOpen, (p, v) => p.Open = this.ToDouble(v));
filler.Add(this.DataFieldClose, (p, v) => p.Close = this.ToDouble(v));
filler.FillT(this.items, this.ItemsSource);
}
19
Source : PieSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected internal override void UpdateData()
{
if (this.ItemsSource == null)
{
return;
}
this.slices.Clear();
var filler = new ListFiller<PieSlice>();
filler.Add(this.LabelField, (item, value) => item.Label = Convert.ToString(value));
filler.Add(this.ValueField, (item, value) => item.Value = Convert.ToDouble(value));
filler.Add(this.ColorField, (item, value) => item.Fill = (OxyColor)value);
filler.Add(this.IsExplodedField, (item, value) => item.IsExploded = (bool)value);
filler.FillT(this.slices, this.ItemsSource);
}
19
Source : RectangleBarSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected internal override void UpdateData()
{
if (this.ItemsSource == null)
{
return;
}
this.Items.Clear();
// ReflectionHelper.FillList(
// this.ItemsSource,
// this.Items,
// new[] { this.MinimumField, this.MaximumField },
// (item, value) => item.Minimum = Convert.ToDouble(value),
// (item, value) => item.Maximum = Convert.ToDouble(value));
throw new NotImplementedException();
}
19
Source : TornadoBarSeries.cs
with MIT License
from AlexGyver
with MIT License
from AlexGyver
protected internal override void UpdateData()
{
if (this.ItemsSource != null)
{
this.Items.Clear();
var filler = new ListFiller<TornadoBarItem>();
filler.Add(this.MinimumField, (item, value) => item.Minimum = Convert.ToDouble(value));
filler.Add(this.MaximumField, (item, value) => item.Maximum = Convert.ToDouble(value));
filler.FillT(this.Items, this.ItemsSource);
}
}
19
Source : VssWriterDescriptor.cs
with MIT License
from alexis-
with MIT License
from alexis-
internal void InitializeComponentsForRestore(IVssWriterComponents components)
{
// Erase the current list of components for this writer.
ComponentDescriptors.Clear();
// Enumerate the components from the BC doreplacedent
foreach (IVssComponent component in components.Components)
{
VssComponentDescriptor desc = new VssComponentDescriptor(m_host, this.WriterMetadata.WriterName, component);
m_host.WriteDebug("Found component available for restore: \"{0}\"", desc.FullPath);
ComponentDescriptors.Add(desc);
}
}
19
Source : JsonConfigurationFileParser.cs
with MIT License
from aliencube
with MIT License
from aliencube
private IDictionary<string, string> ParseStream(Stream input)
{
_data.Clear();
_reader = new JsonTextReader(new StreamReader(input));
_reader.DateParseHandling = DateParseHandling.None;
var jsonConfig = JObject.Load(_reader);
VisitJObject(jsonConfig);
return _data;
}
19
Source : TransferManager.cs
with MIT License
from aljazsim
with MIT License
from aljazsim
public void Dispose()
{
if (!this.IsDisposed)
{
this.IsDisposed = true;
Debug.WriteLine($"disposing torrent manager for torrent {this.TorrentInfo.InfoHash}");
this.Stop();
lock (((IDictionary)this.trackers).SyncRoot)
{
if (this.trackers != null)
{
this.trackers.Clear();
this.trackers = null;
}
}
lock (((IDictionary)this.peers).SyncRoot)
{
if (this.peers != null)
{
this.peers.Clear();
this.peers = null;
}
}
if (this.pieceManager != null)
{
this.pieceManager.Dispose();
this.pieceManager = null;
}
}
}
19
Source : SimplePriorityQueue.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public void Clear()
{
lock(_queue)
{
_queue.Clear();
_itemToNodesCache.Clear();
_nullNodesCache.Clear();
}
}
19
Source : MongoIndexContext.cs
with MIT License
from AlphaYu
with MIT License
from AlphaYu
public void Clear() => _indexes.Clear();
19
Source : JsonConfigurationFileParser.cs
with MIT License
from AlphaYu
with MIT License
from AlphaYu
private IDictionary<string, string> ParseStream(Stream input)
{
_data.Clear();
var jsonDoreplacedentOptions = new JsonDoreplacedentOptions
{
CommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true,
};
using (var reader = new StreamReader(input))
using (JsonDoreplacedent doc = JsonDoreplacedent.Parse(reader.ReadToEnd(), jsonDoreplacedentOptions))
{
if (doc.RootElement.ValueKind != JsonValueKind.Object)
{
throw new FormatException("数据格式不正确");
}
VisitElement(doc.RootElement);
}
return _data;
}
19
Source : ObservableCollectionEx.cs
with GNU General Public License v3.0
from Amebis
with GNU General Public License v3.0
from Amebis
public void Reset(IEnumerable<T> range)
{
Items.Clear();
AddRange(range);
}
19
Source : ObservableCollectionEx.cs
with GNU General Public License v3.0
from Amebis
with GNU General Public License v3.0
from Amebis
public void Reset(T el)
{
Items.Clear();
Items.Add(el);
EndUpdate();
}
See More Examples