added test bool to server gui
This commit is contained in:
@@ -10,5 +10,7 @@ namespace Server.Models
|
||||
class Information : ObservableObject
|
||||
{
|
||||
public bool CanStartServer { get; set; }
|
||||
|
||||
public bool ServerOnline { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Server.ViewModels
|
||||
Debug.WriteLine("init mainviewmodel");
|
||||
InformationModel = new Information();
|
||||
InformationModel.CanStartServer = true;
|
||||
InformationModel.ServerOnline = false;
|
||||
this.ServerStartCommand = new RelayCommand(() =>
|
||||
{
|
||||
Debug.WriteLine("connect button clicked");
|
||||
@@ -35,7 +36,7 @@ namespace Server.ViewModels
|
||||
|
||||
Debug.WriteLine("can start server " + InformationModel.CanStartServer);
|
||||
serverCommunication.Start();
|
||||
|
||||
InformationModel.ServerOnline = true;
|
||||
InformationModel.CanStartServer = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Button Content="Start Server" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Command="{Binding ServerStartCommand}" IsEnabled="{Binding MainViewModel.InformationModel.CanStartServer}"/>
|
||||
<Label Content="{Binding MainViewModel.InformationModel.CanStartServer}" HorizontalAlignment="Left" Margin="97,7,0,0" VerticalAlignment="Top"/>
|
||||
<Button Content="Start Server" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Command="{Binding ServerStartCommand}" IsEnabled="{Binding InformationModel.CanStartServer}"/>
|
||||
<Label Content="{Binding InformationModel.ServerOnline}" HorizontalAlignment="Left" Margin="169,10,0,0" VerticalAlignment="Top"/>
|
||||
<Label Content="Server Online:" HorizontalAlignment="Left" Margin="80,7,0,0" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace Server
|
||||
public MainWindow()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
// use mainviewmodel for the bindings of our methods
|
||||
DataContext = new MainViewModel();
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user