Hi Dojo,
is there any easily available way to use this functionality? The description in the release notes sounds very promising, so we'd be very happy to be able to send a notification as a pop up directly to all connected users.
Any ideas?
Thanks a lot! 🙂
Hi Nils,
It should be possible to get a list of all connected users as following:
var users = connection.HandleResponseMessage(new GetInfoMessage(InfoType.ClientList))
.Cast<LoginInfoResponseMessage>()
.Where(c => (c.ConnectionAttributes & ConnectionAttributes.Cube) == ConnectionAttributes.Cube)
.Select(c => c.Name)
.ToList();
Which you can then use to send out a popup message to these users like this:
BroadcastPopupRequestMessage req = new BroadcastPopupRequestMessage
{
PopupInfo = new Skyline.DataMiner.Net.Broadcast.PopupInfo
{
Source = connectionId,
Title = "Your Title",
Message = "Your Message",
UserNames = users,
Expiration = new DateTime(DateTime.Now.Ticks + tickOffset),
}
};
Kind regards,

Hi Seppe,
Thanks for your reply! That was a great hint — we got it working with the code below.
using System;
using System.Collections.Generic;
using System.Linq;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net;
using Skyline.DataMiner.Net.Messages;
using Skyline.DataMiner.Net.Messages.SLDataGateway;
public class Script
{
public void Run(Engine engine)
{
// Konfiguration
string title = "Systemmeldung";
string message = "Wartung beginnt in 1 Minuten.";
TimeSpan duration = TimeSpan.FromMinutes(1);
try
{
// 1. Cube-User abrufen über SLNet
var response = engine.SendSLNetMessage(new GetInfoMessage(InfoType.ClientList));
var cubeUsers = response
.OfType<LoginInfoResponseMessage>()
.Where(c => (c.ConnectionAttributes & ConnectionAttributes.Cube) == ConnectionAttributes.Cube)
.Select(c => c.Name)
.Distinct()
.ToList();
if (cubeUsers.Count == 0)
{
engine.Log("Keine aktiven Cube-User gefunden.");
return;
}
// 2. Popup vorbereiten
DateTime expiration = DateTime.Now.Add(duration);
var popup = new BroadcastPopupRequestMessage
{
PopupInfo = new Skyline.DataMiner.Net.Broadcast.PopupInfo
{
Source = Guid.NewGuid(),
Title = title,
Message = message,
UserNames = cubeUsers,
Expiration = expiration
}
};
// 3. Nachricht senden
bool sendPopup = true; // Auf true setzen, wenn wirklich senden, ansonsten Logfile
if (sendPopup)
{
engine.SendSLNetMessage(popup);
}
else
{
engine.Log("Popup wurde NICHT gesendet – nur Testausgabe:");
engine.Log("Title: " + popup.PopupInfo.Title);
engine.Log("Message: " + popup.PopupInfo.Message);
engine.Log("Users: " + string.Join(", ", popup.PopupInfo.UserNames));
engine.Log("Expiration: " + popup.PopupInfo.Expiration);
engine.Log("Source GUID: " + popup.PopupInfo.Source);
}
engine.Log($"Popup an {cubeUsers.Count} Benutzer gesendet.");
}
catch (Exception ex)
{
engine.Log("Fehler: " + ex.Message);
}
}
}
Best regards! (and sorry about the German comments in the code)