added clients connected
This commit is contained in:
@@ -17,6 +17,6 @@ namespace Server.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ClientsConnected{ get; set; }
|
public int ClientsConnected{ get { return ServerCommunication.INSTANCE.ClientsConnected; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ namespace Server.Models
|
|||||||
private TcpListener listener;
|
private TcpListener listener;
|
||||||
private List<ServerClient> serverClients;
|
private List<ServerClient> serverClients;
|
||||||
public bool Started = false;
|
public bool Started = false;
|
||||||
|
public int ClientsConnected { get { return serverClients.Count; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// use a padlock object to make sure the singleton is thread-safe
|
/// use a padlock object to make sure the singleton is thread-safe
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ namespace Server.ViewModels
|
|||||||
|
|
||||||
public MainViewModel(MainWindow mainWindow)
|
public MainViewModel(MainWindow mainWindow)
|
||||||
{
|
{
|
||||||
|
serverCommunication = ServerCommunication.INSTANCE;
|
||||||
this.mainWindow = mainWindow;
|
this.mainWindow = mainWindow;
|
||||||
Debug.WriteLine("init mainviewmodel");
|
Debug.WriteLine("init mainviewmodel");
|
||||||
InformationModel = new Information();
|
InformationModel = new Information();
|
||||||
InformationModel.ClientsConnected = 0;
|
|
||||||
InformationModel.CanStartServer = true;
|
InformationModel.CanStartServer = true;
|
||||||
InformationModel.ServerOnline = false;
|
InformationModel.ServerOnline = false;
|
||||||
//BitmapImage onlineImg = new BitmapImage(new Uri(@"/img/online.png",UriKind.Relative));
|
//BitmapImage onlineImg = new BitmapImage(new Uri(@"/img/online.png",UriKind.Relative));
|
||||||
@@ -34,15 +34,9 @@ namespace Server.ViewModels
|
|||||||
this.ServerStartCommand = new RelayCommand(() =>
|
this.ServerStartCommand = new RelayCommand(() =>
|
||||||
{
|
{
|
||||||
Debug.WriteLine("connect button clicked");
|
Debug.WriteLine("connect button clicked");
|
||||||
if (serverCommunication == null)
|
|
||||||
{
|
|
||||||
Debug.WriteLine("making new server communication");
|
|
||||||
serverCommunication = ServerCommunication.INSTANCE;
|
|
||||||
}
|
|
||||||
if (!serverCommunication.Started)
|
if (!serverCommunication.Started)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
serverCommunication.Start();
|
serverCommunication.Start();
|
||||||
InformationModel.ServerOnline = true;
|
InformationModel.ServerOnline = true;
|
||||||
InformationModel.CanStartServer = false;
|
InformationModel.CanStartServer = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user