[
ADD] added message sending to all clients, doesn't work yet
This commit is contained in:
@@ -43,7 +43,7 @@ namespace ClientApp.Utils
|
||||
/// </summary>
|
||||
private void initEngine()
|
||||
{
|
||||
Debug.WriteLine("init engine");
|
||||
Debug.WriteLine("[CLIENT] init engine");
|
||||
engineConnection = EngineConnection.INSTANCE;
|
||||
engineConnection.OnNoTunnelId = RetryEngineConnection;
|
||||
engineConnection.OnSuccessFullConnection = engineConnected;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ClientApp.Utils
|
||||
//new PC("DESKTOP-M2CIH87", "Fabian"),
|
||||
//new PC("T470S", "Shinichi"),
|
||||
//new PC("DESKTOP-DHS478C", "semme"),
|
||||
//new PC("HP-ZBOOK-SEM", "Sem")
|
||||
new PC("HP-ZBOOK-SEM", "Sem")
|
||||
//new PC("DESKTOP-TV73FKO", "Wouter"),
|
||||
//new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
|
||||
//new PC("NA", "Bart")
|
||||
@@ -71,7 +71,7 @@ namespace ClientApp.Utils
|
||||
updateTimer.AutoReset = true;
|
||||
updateTimer.Enabled = false;
|
||||
|
||||
noVRResponseTimer = new System.Timers.Timer(15000);
|
||||
noVRResponseTimer = new System.Timers.Timer(30000);
|
||||
noVRResponseTimer.Elapsed += noVRResponseTimeout;
|
||||
noVRResponseTimer.AutoReset = false;
|
||||
noVRResponseTimer.Enabled = false;
|
||||
|
||||
@@ -43,12 +43,14 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
public MainWindowViewModel MainWindowViewModel { get; set; }
|
||||
private Client client;
|
||||
private MainViewModel parent;
|
||||
|
||||
public Chart Chart { get; set; }
|
||||
|
||||
public ClientInfoViewModel(MainWindowViewModel mainWindowViewModel, string username)
|
||||
public ClientInfoViewModel(MainViewModel parent,MainWindowViewModel mainWindowViewModel, string username)
|
||||
{
|
||||
MainWindowViewModel = mainWindowViewModel;
|
||||
this.parent = parent;
|
||||
this.PatientInfo = new PatientInfo() { Username = username, Status = "Waiting to start" };
|
||||
this.Chart = new Chart(this.PatientInfo);
|
||||
PatientInfo.ChatLog = new ObservableCollection<string>();
|
||||
@@ -75,8 +77,7 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
ChatToAll = new RelayCommand<object>((parameter) =>
|
||||
{
|
||||
//todo save clientinfoviewmodels in mainviewmodel
|
||||
//todo send message to client of every clientinfoviewmodel
|
||||
this.parent?.SendToAllClients(((TextBox)parameter).Text);
|
||||
});
|
||||
|
||||
SetResistance = new RelayCommand<object>((parameter) =>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace DoctorApp.ViewModels
|
||||
Debug.WriteLine("new tab with name " + username);
|
||||
App.Current.Dispatcher.Invoke((Action)delegate
|
||||
{
|
||||
Tabs.Add(new ClientInfoViewModel(MainWindowViewModel, username));
|
||||
Tabs.Add(new ClientInfoViewModel(this,MainWindowViewModel, username));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,6 +72,15 @@ namespace DoctorApp.ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void SendToAllClients(string text)
|
||||
{
|
||||
Debug.WriteLine("[MAINVIEWMODEL] Sending message to all clients: " + text);
|
||||
foreach (ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
item.SendMessageToClient(item.PatientInfo.Username, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Windows.Input;
|
||||
using DoctorApp.Models;
|
||||
using DoctorApp.Utils;
|
||||
using Util.MagicCode;
|
||||
using System;
|
||||
|
||||
namespace DoctorApp.ViewModels
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user