Skip to content
Snippets Groups Projects
Commit 8b3a4249 authored by Marcel Kehrberg's avatar Marcel Kehrberg
Browse files

Overview aufruf der Send methode für distractingWebsites

parent 807fc972
No related branches found
No related tags found
1 merge request!60Web socket server
...@@ -267,7 +267,34 @@ namespace InnoLabProjektDektopApp ...@@ -267,7 +267,34 @@ namespace InnoLabProjektDektopApp
// Ereignis-Handler für den "Start"-Button // Ereignis-Handler für den "Start"-Button
private void StartButton_Click(object sender, RoutedEventArgs e) private void StartButton_Click(object sender, RoutedEventArgs e)
{ {
Server.Instance.SendMessageToAllClients("true"); Server.Instance.SendMessageToAllClients("{\"action\": \"startTracking\", \"status\": true}");
try
{
string jsonContent = File.ReadAllText("F:\\Dokumente\\Schule\\Studium\\InoLab\\procrastinator\\InnoLabProjektDektopApp\\InnoLabProjektDektopApp\\Assets\\distractingWebsites.json");
//string message = $"{{\"action\": \"sendJsonContent\", \"status\": true, \"content\": {jsonContent}}}";
// Erstelle ein Objekt für die Nachricht
var messageObject = new
{
action = "sendJsonContent",
status = true,
content = JsonSerializer.Deserialize<object>(jsonContent) // Parse den JSON-Inhalt
};
// Serialisiere das Objekt zu einem JSON-String
string message = JsonSerializer.Serialize(messageObject);
Server.Instance.SendMessageToAllClients(message);
}
catch
{
}
// Werte auslesen // Werte auslesen
int focusPeriod; int focusPeriod;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment