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
View Source File : ListSnapshot.cs
License : MIT License
Project Creator : 0x0ade
License : MIT License
Project Creator : 0x0ade
public void Clear() {
((ICollection<T>) List).Clear();
}
19
View Source File : BindableObjectCollection.cs
License : MIT License
Project Creator : 1iveowl
License : MIT License
Project Creator : 1iveowl
public void Clear()
{
_items.Clear();
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
19
View Source File : SegmentedControl.cs
License : MIT License
Project Creator : 1iveowl
License : MIT License
Project Creator : 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
View Source File : LProjectDependencies.cs
License : MIT License
Project Creator : 3F
License : MIT License
Project Creator : 3F
public override void PreProcessing(ISvc svc)
{
Projects.Clear();
order.Clear();
map.Clear();
}
19
View Source File : JsonData.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
void IDictionary.Clear ()
{
EnsureDictionary ().Clear ();
object_list.Clear ();
json = null;
}
19
View Source File : JsonMapper.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public static void UnregisterExporters ()
{
custom_exporters_table.Clear ();
}
19
View Source File : JsonMapper.cs
License : MIT License
Project Creator : 404Lcc
License : MIT License
Project Creator : 404Lcc
public static void UnregisterImporters ()
{
custom_importers_table.Clear ();
}
19
View Source File : IteratorExpression.cs
License : MIT License
Project Creator : 71
License : MIT License
Project Creator : 71
private void CountYields()
{
_yields.Clear();
Expressive.Pipeline(CountYield).Visit(Iterator);
}
19
View Source File : DispatcherObservableCollection.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
public void Clear()
{
lock (_syncRoot)
{
_collection.Clear();
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
19
View Source File : QuestManager.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : 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
View Source File : ExtendedObservableCollection.cs
License : GNU General Public License v3.0
Project Creator : Acumatica
License : GNU General Public License v3.0
Project Creator : Acumatica
public void Reset(IEnumerable<T> range)
{
Items.Clear();
AddRange(range);
}
19
View Source File : Packet.cs
License : MIT License
Project Creator : adamtcroft
License : MIT License
Project Creator : adamtcroft
public void Clear()
{
procedure = "";
keywordArguments.Clear();
}
19
View Source File : TreeElementUtility.cs
License : MIT License
Project Creator : Adsito
License : MIT License
Project Creator : 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
View Source File : PathHierarchyTreeView.cs
License : MIT License
Project Creator : Adsito
License : MIT License
Project Creator : 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
View Source File : PrefabHierarchyTreeView.cs
License : MIT License
Project Creator : Adsito
License : MIT License
Project Creator : 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
View Source File : PrefabsListTreeView.cs
License : MIT License
Project Creator : Adsito
License : MIT License
Project Creator : 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
View Source File : RedisLite.cs
License : MIT License
Project Creator : AElfProject
License : MIT License
Project Creator : 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
View Source File : ConvexHullHelper.Pruning.cs
License : The Unlicense
Project Creator : aeroson
License : The Unlicense
Project Creator : 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
View Source File : KDTree.cs
License : MIT License
Project Creator : aillieo
License : MIT License
Project Creator : 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
View Source File : OpenIdConnectOptionsBuilder.cs
License : GNU General Public License v3.0
Project Creator : AISGorod
License : GNU General Public License v3.0
Project Creator : 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
View Source File : FlowableDistinct.cs
License : Apache License 2.0
Project Creator : akarnokd
License : Apache License 2.0
Project Creator : akarnokd
public override void OnError(Exception cause)
{
set.Clear();
actual.OnError(cause);
}
19
View Source File : FlowableDistinct.cs
License : Apache License 2.0
Project Creator : akarnokd
License : Apache License 2.0
Project Creator : akarnokd
public override void OnComplete()
{
set.Clear();
actual.OnComplete();
}
19
View Source File : FlowableDistinct.cs
License : Apache License 2.0
Project Creator : akarnokd
License : Apache License 2.0
Project Creator : akarnokd
public override void OnError(Exception cause)
{
set.Clear();
actual.OnComplete();
}
19
View Source File : JContainer.cs
License : MIT License
Project Creator : akaskela
License : MIT License
Project Creator : 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
View Source File : CollectionWrapper.cs
License : MIT License
Project Creator : akaskela
License : MIT License
Project Creator : akaskela
public virtual void Clear()
{
if (_genericCollection != null)
{
_genericCollection.Clear();
}
else
{
_list.Clear();
}
}
19
View Source File : DictionaryWrapper.cs
License : MIT License
Project Creator : akaskela
License : MIT License
Project Creator : 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
View Source File : PointSet.cs
License : MIT License
Project Creator : Alan-FGR
License : MIT License
Project Creator : Alan-FGR
public void ClearTriangles()
{
Triangles.Clear();
}
19
View Source File : PointSet.cs
License : MIT License
Project Creator : Alan-FGR
License : MIT License
Project Creator : 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
View Source File : MainForm.cs
License : MIT License
Project Creator : AlexanderPro
License : MIT License
Project Creator : 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
View Source File : MainForm.cs
License : MIT License
Project Creator : AlexanderPro
License : MIT License
Project Creator : 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
View Source File : PluginManager.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : 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
View Source File : PluginManager.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : 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
View Source File : Settings.cs
License : GNU General Public License v3.0
Project Creator : alexgracianoarj
License : GNU General Public License v3.0
Project Creator : 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
View Source File : TreeColumnCollection.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : AlexGyver
protected override void ClearItems()
{
foreach (TreeColumn c in Items)
UnbindEvents(c);
Items.Clear();
_treeView.UpdateColumns();
}
19
View Source File : CategoryAxis.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : CategoryAxis.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : IntervalBarSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : DataPointSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : HighLowSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : PieSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : RectangleBarSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : TornadoBarSeries.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : 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
View Source File : VssWriterDescriptor.cs
License : MIT License
Project Creator : alexis-
License : MIT License
Project Creator : 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
View Source File : JsonConfigurationFileParser.cs
License : MIT License
Project Creator : aliencube
License : MIT License
Project Creator : 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
View Source File : TransferManager.cs
License : MIT License
Project Creator : aljazsim
License : MIT License
Project Creator : 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
View Source File : SimplePriorityQueue.cs
License : Apache License 2.0
Project Creator : allenai
License : Apache License 2.0
Project Creator : allenai
public void Clear()
{
lock(_queue)
{
_queue.Clear();
_itemToNodesCache.Clear();
_nullNodesCache.Clear();
}
}
19
View Source File : MongoIndexContext.cs
License : MIT License
Project Creator : AlphaYu
License : MIT License
Project Creator : AlphaYu
public void Clear() => _indexes.Clear();
19
View Source File : JsonConfigurationFileParser.cs
License : MIT License
Project Creator : AlphaYu
License : MIT License
Project Creator : 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
View Source File : ObservableCollectionEx.cs
License : GNU General Public License v3.0
Project Creator : Amebis
License : GNU General Public License v3.0
Project Creator : Amebis
public void Reset(IEnumerable<T> range)
{
Items.Clear();
AddRange(range);
}
19
View Source File : ObservableCollectionEx.cs
License : GNU General Public License v3.0
Project Creator : Amebis
License : GNU General Public License v3.0
Project Creator : Amebis
public void Reset(T el)
{
Items.Clear();
Items.Add(el);
EndUpdate();
}
See More Examples