-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0741919
commit 6707657
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace PropertyRetrieval.ItemTypes | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using PropertyRetrieval.DTO; | ||
using Skyline.DataMiner.Net; | ||
using Skyline.DataMiner.Net.Messages; | ||
|
||
internal class ElementTypes : BaseItemTypes | ||
{ | ||
private readonly IConnection _connection; | ||
|
||
public ElementTypes(IConnection connection) : base(connection, "Element") | ||
{ | ||
_connection = connection; | ||
} | ||
|
||
protected override IEnumerable<ItemInfo> GetItemInfoFromServer() | ||
{ | ||
var elementPropertyValues = _connection.HandleMessage(new GetInfoMessage { Type = InfoType.ElementInfo }); | ||
List<ItemInfo> items = new List<ItemInfo>(); | ||
|
||
foreach (var elemenMessage in elementPropertyValues) | ||
{ | ||
var elementInfo = (ElementInfoEventMessage)elemenMessage; | ||
|
||
items.Add(new ItemInfo | ||
{ | ||
Id = Convert.ToString(elementInfo.ElementID), | ||
Name = elementInfo.Name, | ||
PropertyNameAndValues = elementInfo.Properties.Select(x=> new KeyValuePair<string, string>(x.Name, x.Value)), | ||
}); | ||
} | ||
|
||
return items; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters