本文整理汇总了C#中BlockingCollection.ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C# BlockingCollection.ElementAt方法的具体用法?C# BlockingCollection.ElementAt怎么用?C# BlockingCollection.ElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockingCollection
的用法示例。
在下文中一共展示了BlockingCollection.ElementAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bw_DoWork
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
treeData = new BlockingCollection<TreeNode>();
RootNodes.Clear();
int i = -1;
int j = 0;
targetDoneCount = Targets.Count();
foreach (Target myTarget in Targets)
{
if (!RootNodes.Contains(myTarget.documentURL))
{
i++;
j = 0;
TreeNode newNode = new TreeNode();
newNode.Name = myTarget.targetId.ToString();
Font boldFont = new Font(treeView1.Font, FontStyle.Bold);
newNode.NodeFont = boldFont;
newNode.Text = myTarget.friendlyName;
newNode.Text = newNode.Text;
newNode.ToolTipText = "Device Description:\r\n" + myTarget.friendlyName +
"\r\nDocument URL:\r\n" + myTarget.documentURL +
"\r\nControl URL:\r\n" + myTarget.controlURL + "\r\n";
newNode.Tag = myTarget;
treeData.Add(newNode);
RootNodes.Add(myTarget.documentURL);
}
else
{
i = RootNodes.IndexOf(myTarget.documentURL);
j = treeData.ElementAt(i).GetNodeCount(false);
}
string makeSOAPRequest = "<?xml version=\"1.0\"?>\r\n" +
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n" +
"<s:Body>\r\n" +
"<m:" + myTarget.actionDesc.Name + " xmlns:m=\"" + myTarget.ServiceTypeIdentifier + "\">\r\n";
string makeSOAPResponse = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n" +
"<s:Body>\r\n" +
"<u:" + myTarget.actionDesc.Name + " xmlns:u=\"" + myTarget.ServiceTypeIdentifier + "\">";
List<String> collectDataType = new List<string>();
bool alreadyHasAction = false;
foreach (TreeNode checkNode in treeData.ElementAt(i).Nodes)
{
if (checkNode.Text == myTarget.actionDesc.Name)
{
alreadyHasAction = true;
}
}
if (!alreadyHasAction)
{
treeData.ElementAt(i).Nodes.Add(myTarget.targetId.ToString(), myTarget.actionDesc.Name);
treeData.ElementAt(i).Nodes[j].Tag = myTarget;
foreach (ArgumentDescription nArg in myTarget.actionDesc.Arguments.Values)
{
if (nArg.Direction == "in")
{
TreeNode argumentNode = treeData.ElementAt(i).Nodes[j].Nodes.Add(myTarget.targetId.ToString(), String.Format("->{0}", nArg.Name));
argumentNode.Tag = myTarget;
argumentNode.Nodes.Add(myTarget.targetId.ToString(), String.Format("Data Type: {0}", myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].DataType));
if (myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].DefaultValue != "")
{
argumentNode.Nodes.Add(myTarget.targetId.ToString(), String.Format("Default Value: {0}", myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].DefaultValue));
}
if (myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedValues.Count > 0)
{
int av = 1;
foreach (string allowedValue in myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedValues)
{
argumentNode.Nodes.Add(myTarget.targetId.ToString(), String.Format("Allowed Value {0}: {1}", av.ToString(), allowedValue));
av++;
}
}
if (myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedRange.Minimum != "")
{
argumentNode.Nodes.Add(myTarget.targetId.ToString(), String.Format("Minimum Value: {0}", myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedRange.Minimum));
}
if (myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedRange.Maximum != "")
{
argumentNode.Nodes.Add(myTarget.targetId.ToString(), String.Format("Maximum Value: {0}", myTarget.targetServiceDesc.StateVariables[nArg.RelatedStateVariable].AllowedRange.Maximum));
}
//.........这里部分代码省略.........