convert VB to C#
This commit is contained in:
104
Pilz.Configuration/ConfigurationManagerList.cs
Normal file
104
Pilz.Configuration/ConfigurationManagerList.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using global::Pilz.GeneralEventArgs;
|
||||
|
||||
namespace Pilz.Configuration
|
||||
{
|
||||
public class ConfigurationManagerList : IList<ConfigurationManager>
|
||||
{
|
||||
public event GettingParentManagerEventHandler GettingParentManager;
|
||||
|
||||
public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs<SimpleConfiguration> e);
|
||||
|
||||
private readonly List<ConfigurationManager> myList = new List<ConfigurationManager>();
|
||||
|
||||
private object GetParentManager()
|
||||
{
|
||||
var args = new GetValueEventArgs<SimpleConfiguration>();
|
||||
GettingParentManager?.Invoke(this, args);
|
||||
return args.Value;
|
||||
}
|
||||
|
||||
public ConfigurationManager this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return myList[index];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myList[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return myList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Insert(int index, ConfigurationManager item)
|
||||
{
|
||||
myList.Insert(index, item);
|
||||
item.SetConfiguration((SimpleConfiguration)GetParentManager());
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
}
|
||||
|
||||
public void Add(ConfigurationManager item)
|
||||
{
|
||||
item.SetConfiguration((SimpleConfiguration)GetParentManager());
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (ConfigurationManager item in myList)
|
||||
item.SetConfiguration(null);
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
public void CopyTo(ConfigurationManager[] array, int arrayIndex)
|
||||
{
|
||||
myList.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int IndexOf(ConfigurationManager item)
|
||||
{
|
||||
return myList.IndexOf(item);
|
||||
}
|
||||
|
||||
public bool Contains(ConfigurationManager item)
|
||||
{
|
||||
return myList.Contains(item);
|
||||
}
|
||||
|
||||
public bool Remove(ConfigurationManager item)
|
||||
{
|
||||
item.SetConfiguration(null);
|
||||
return myList.Remove(item);
|
||||
}
|
||||
|
||||
public IEnumerator<ConfigurationManager> GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return myList.GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user