[ADDED] lobby to the shared project and almost done with start GUI
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Client"
|
||||
StartupUri="MainWindow.xaml">
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
|
||||
@@ -13,5 +13,17 @@ namespace Client
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
MainWindow startWindow = new MainWindow();
|
||||
ViewModel VM = new ViewModel();
|
||||
startWindow.DataContext = VM;
|
||||
startWindow.Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AsyncAwaitBestPractices" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
3
Client/FodyWeavers.xml
Normal file
3
Client/FodyWeavers.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
||||
74
Client/FodyWeavers.xsd
Normal file
74
Client/FodyWeavers.xsd
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressWarnings" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -7,6 +7,60 @@
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Content="This client information:" FontSize="17"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Your username:" FontSize="15" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" MaxLength="10" FontSize="15" VerticalAlignment="Center"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Which color you want to be:" FontSize="15" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" FontSize="15">
|
||||
<ComboBoxItem Content="BLUE"/>
|
||||
<ComboBoxItem Content="RED"/>
|
||||
<ComboBoxItem Content="YELLOW"/>
|
||||
<ComboBoxItem Content="BLACK"/>
|
||||
<ComboBoxItem Content="GREEN"/>
|
||||
<ComboBoxItem Content="ORANGE"/>
|
||||
<ComboBoxItem Content="PURPLE"/>
|
||||
</ComboBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<ListView Name="LobbyList" Grid.Row="1" Grid.Column="0" Margin="10, 10, 10, 10" ItemsSource="{Binding Path=Lobbies}">
|
||||
<ListView.View>
|
||||
<GridView x:Name="grdList">
|
||||
<GridViewColumn Header="Lobby ID" DisplayMemberBinding="{Binding ID}" Width="70"/>
|
||||
<GridViewColumn Header="Players in" DisplayMemberBinding="{Binding PlayersIn}" Width="70"/>
|
||||
<GridViewColumn Header="max players available" DisplayMemberBinding="{Binding MaxPlayers}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<Button Grid.Column="1" Grid.Row="0" Content="CHECK" Command="{Binding ButtonCommand}"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
50
Client/Model.cs
Normal file
50
Client/Model.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
class Model : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private int _numbers;
|
||||
private bool _status;
|
||||
|
||||
public int Numbers
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numbers;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_numbers = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _status;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_status = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Model()
|
||||
{
|
||||
_status = false;
|
||||
_numbers = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
70
Client/ViewModel.cs
Normal file
70
Client/ViewModel.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
|
||||
public ViewModel()
|
||||
{
|
||||
_model = new Model();
|
||||
ButtonCommand = new RelayCommand(() =>
|
||||
{
|
||||
ClickCheck();
|
||||
});
|
||||
|
||||
_lobbies = new List<Lobby>();
|
||||
|
||||
_lobbies.Add(new Lobby(50, 3, 8));
|
||||
_lobbies.Add(new Lobby(69, 1, 9));
|
||||
_lobbies.Add(new Lobby(420, 7, 7));
|
||||
}
|
||||
|
||||
private void ClickCheck()
|
||||
{
|
||||
if(!(_model.Status))
|
||||
_model.Status = true;
|
||||
|
||||
_model.Numbers = _model.Numbers + 5;
|
||||
}
|
||||
|
||||
public ICommand ButtonCommand { get; set; }
|
||||
|
||||
|
||||
private Model _model;
|
||||
public Model Model
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_model == null)
|
||||
_model = new Model();
|
||||
|
||||
return _model;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_model = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Lobby> _lobbies;
|
||||
public List<Lobby> Lobbies
|
||||
{
|
||||
get { return _lobbies; }
|
||||
set { _lobbies = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
44
SharedClientServer/Lobby.cs
Normal file
44
SharedClientServer/Lobby.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
class Lobby : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
private int _id;
|
||||
private int _playersIn;
|
||||
private int _maxPlayers;
|
||||
|
||||
public Lobby(int id, int playersIn, int maxPlayers)
|
||||
{
|
||||
_id = id;
|
||||
_playersIn = playersIn;
|
||||
_maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
public int PlayersIn
|
||||
{
|
||||
get { return _playersIn; }
|
||||
set { _playersIn = value; }
|
||||
}
|
||||
|
||||
public int MaxPlayers
|
||||
{
|
||||
get { return _maxPlayers; }
|
||||
set { _maxPlayers = value; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user