Merge remote-tracking branch 'origin/master'
This commit is contained in:
37
Client/ViewModels/LoginViewModel.cs
Normal file
37
Client/ViewModels/LoginViewModel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using SharedClientServer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace Client.ViewModels
|
||||
{
|
||||
|
||||
class LoginViewModel
|
||||
{
|
||||
ClientData data = ClientData.Instance;
|
||||
private Window window;
|
||||
|
||||
public LoginViewModel(Window window)
|
||||
{
|
||||
this.window = window;
|
||||
}
|
||||
public void UsernameEntered(string name) {
|
||||
User user = new User(name);
|
||||
|
||||
Client client = new Client(user.Username);
|
||||
client.OnSuccessfullConnect = () =>
|
||||
{
|
||||
// because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread
|
||||
Application.Current.Dispatcher.Invoke(delegate {
|
||||
data.User = user;
|
||||
data.Client = client;
|
||||
client.SendMessage(JSONConvert.ConstructLobbyRequestMessage());
|
||||
MainWindow startWindow = new MainWindow();
|
||||
startWindow.Show();
|
||||
window.Close();
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Diagnostics;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Client.ViewModels
|
||||
@@ -34,6 +34,7 @@ namespace Client.ViewModels
|
||||
|
||||
public string _username;
|
||||
|
||||
|
||||
public string _message;
|
||||
public string Message
|
||||
{
|
||||
|
||||
12
Eindproject/Client2/Client2.csproj
Normal file
12
Eindproject/Client2/Client2.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Client\Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
Eindproject/Client2/Program.cs
Normal file
14
Eindproject/Client2/Program.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Client2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Client.App app = new Client.App();
|
||||
app.Run();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "..\Client\Client.
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedClientServer", "..\SharedClientServer\SharedClientServer.shproj", "{6D26F969-9CB1-414F-AC3E-7253D449AC5A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{4CB2CD76-07D9-44D0-A559-A7A301621D30}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\SharedClientServer\SharedClientServer.projitems*{4cb2cd76-07d9-44d0-a559-a7a301621d30}*SharedItemsImports = 5
|
||||
..\SharedClientServer\SharedClientServer.projitems*{67a9bf1a-d317-47ca-9f07-c3480d1360ff}*SharedItemsImports = 5
|
||||
..\SharedClientServer\SharedClientServer.projitems*{6d26f969-9cb1-414f-ac3e-7253d449ac5a}*SharedItemsImports = 13
|
||||
..\SharedClientServer\SharedClientServer.projitems*{83768edb-097e-4089-a5de-208cb252d1a0}*SharedItemsImports = 5
|
||||
@@ -28,6 +31,10 @@ Global
|
||||
{83768EDB-097E-4089-A5DE-208CB252D1A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83768EDB-097E-4089-A5DE-208CB252D1A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83768EDB-097E-4089-A5DE-208CB252D1A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4CB2CD76-07D9-44D0-A559-A7A301621D30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4CB2CD76-07D9-44D0-A559-A7A301621D30}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4CB2CD76-07D9-44D0-A559-A7A301621D30}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4CB2CD76-07D9-44D0-A559-A7A301621D30}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
15
Eindproject/Tests/JSONConvertTest.cs
Normal file
15
Eindproject/Tests/JSONConvertTest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharedClientServer;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class JSONConvertTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Eindproject/Tests/Tests.csproj
Normal file
19
Eindproject/Tests/Tests.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\..\SharedClientServer\SharedClientServer.projitems" Label="Shared" />
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user