-
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
6707657
commit 08857b0
Showing
2 changed files
with
41 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,40 @@ | ||
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 ServiceTypes : BaseItemTypes | ||
{ | ||
private readonly IConnection _connection; | ||
|
||
public ServiceTypes(IConnection connection) : base(connection, "Service") | ||
{ | ||
_connection = connection; | ||
} | ||
|
||
protected override IEnumerable<ItemInfo> GetItemInfoFromServer() | ||
{ | ||
var servicePropertyValues = _connection.HandleMessage(new GetInfoMessage { Type = InfoType.ServiceInfo }); | ||
|
||
List<ItemInfo> items = new List<ItemInfo>(); | ||
|
||
foreach (var serviceMessage in servicePropertyValues) | ||
{ | ||
var serviceInfo = (ServiceInfoEventMessage)serviceMessage; | ||
|
||
items.Add(new ItemInfo | ||
{ | ||
Id = Convert.ToString(serviceInfo.ID), | ||
Name = serviceInfo.Name, | ||
PropertyNameAndValues = serviceInfo.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