Compare commits
32 Commits
e6c971bf15
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9274f8b609 | ||
![]() |
7926c808af | ||
![]() |
39cda1170e | ||
![]() |
c390dfe5e3 | ||
![]() |
4edc2f2188 | ||
![]() |
fd2ebc5aaa | ||
![]() |
8b71f84284 | ||
![]() |
f9d5053029 | ||
![]() |
d9976ff520 | ||
![]() |
ce490cf68f | ||
![]() |
eb97a29912 | ||
![]() |
96fbb4498d | ||
![]() |
ab0ac8597d | ||
![]() |
8ac2eeabdf | ||
![]() |
c9f38ba451 | ||
![]() |
580a039a0e | ||
![]() |
6f36ecf630 | ||
![]() |
897a0dc848 | ||
![]() |
76695263a1 | ||
![]() |
a05b392aea | ||
![]() |
80f2610b04 | ||
![]() |
28460e3312 | ||
![]() |
891f3f9e87 | ||
![]() |
068ba16156 | ||
![]() |
fe3e428f31 | ||
![]() |
dd92942809 | ||
![]() |
313bb6d990 | ||
![]() |
3feff69b9e | ||
![]() |
1dad331471 | ||
![]() |
f2b84ec28e | ||
![]() |
cbb33c6cac | ||
![]() |
ef01b50e53 |
BIN
Bib_Talk_Entwurfsdokumentation.pdf
Normal file
BIN
Projekt Dokumentation.pdf
Normal file
BIN
Testdokumentation bib-Talk.pdf
Normal file
20
bibtalk/UnitTestProject1/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("UnitTestProject1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTestProject1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("5ab576d6-0fab-4721-acc8-e94e9cdba4bc")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
14
bibtalk/UnitTestProject1/UnitTest1.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace UnitTestProject1
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
68
bibtalk/UnitTestProject1/UnitTestProject1.csproj
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5AB576D6-0FAB-4721-ACC8-E94E9CDBA4BC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTestProject1</RootNamespace>
|
||||
<AssemblyName>UnitTestProject1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
5
bibtalk/UnitTestProject1/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.2.10" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.2.10" targetFramework="net472" />
|
||||
</packages>
|
20
bibtalk/UnitTestProject2/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("UnitTestProject2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTestProject2")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("2206e204-1087-4204-b79d-1880c23798eb")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
15
bibtalk/UnitTestProject2/UnitTest1.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace UnitTestProject2
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
74
bibtalk/UnitTestProject2/UnitTestProject2.csproj
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2206E204-1087-4204-B79D-1880C23798EB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTestProject2</RootNamespace>
|
||||
<AssemblyName>UnitTestProject2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bib-talk\bib-talk.csproj">
|
||||
<Project>{92b3214e-6fb1-4d94-b93f-6f1a9d9f2224}</Project>
|
||||
<Name>bib-talk</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
5
bibtalk/UnitTestProject2/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.2.10" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.2.10" targetFramework="net472" />
|
||||
</packages>
|
1
bibtalk/UserTest/GlobalUsings.cs
Normal file
@@ -0,0 +1 @@
|
||||
global using Microsoft.VisualStudio.TestTools.UnitTesting;
|
11
bibtalk/UserTest/UnitTest1.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace UserTest
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
23
bibtalk/UserTest/UserTest.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bib-talk\bib-talk.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
BIN
bibtalk/UserTests/Fakes/bib-talk.fakes
Normal file
1
bibtalk/UserTests/GlobalUsings.cs
Normal file
@@ -0,0 +1 @@
|
||||
global using Microsoft.VisualStudio.TestTools.UnitTesting;
|
12
bibtalk/UserTests/UnitTest1.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace UserTests
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
34
bibtalk/UserTests/UserTests.csproj
Normal file
@@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="FakesAssemblies\**" />
|
||||
<EmbeddedResource Remove="FakesAssemblies\**" />
|
||||
<None Remove="FakesAssemblies\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||
<PackageReference Include="Microsoft.QualityTools.Testing.Fakes" Version="16.11.230815" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bib-talk\bib-talk.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalDesignTimeBuildInput Remove="FakesAssemblies\**" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33213.308
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bib-talk", "bib-talk\bib-talk.csproj", "{92B3214E-6FB1-4D94-B93F-6F1A9D9F2224}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bib-talk", "bib-talk\bib-talk.csproj", "{92B3214E-6FB1-4D94-B93F-6F1A9D9F2224}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@@ -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:bib_talk"
|
||||
StartupUri="Login.xaml">
|
||||
StartupUri="UI/Login.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
|
52
bibtalk/bib-talk/Business/LoginManager.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using bib_talk.Repository;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
public class LoginManager
|
||||
{
|
||||
private LoginDatabase loginDatabase; // LoginDatabase Objekt initialisieren
|
||||
|
||||
// Konstruktor für den LoginManager
|
||||
public LoginManager(Login loginWindow)
|
||||
{
|
||||
loginDatabase = new LoginDatabase(loginWindow); // LoginDatabase Objekt deklarieren
|
||||
}
|
||||
|
||||
// Methode zum User einloggen via LoginDatabase
|
||||
public async void Login()
|
||||
{
|
||||
await loginDatabase.LoginServer();
|
||||
}
|
||||
|
||||
// DEBUG METHODE
|
||||
// Methode um Bots einzuloggen
|
||||
//public async Task LoginBots(string username, string password)
|
||||
//{
|
||||
// var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = "" };
|
||||
// string json = JsonConvert.SerializeObject(loginData);
|
||||
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
// var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/login", content);
|
||||
|
||||
// if (response.IsSuccessStatusCode)
|
||||
// {
|
||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||
// var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent);
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||
// MessageBox.Show($"Login failed: {responseContent}");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
54
bibtalk/bib-talk/Business/MainWindowManager.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Threading.Tasks;
|
||||
using bib_talk.Repository;
|
||||
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
public class MainWindowManager
|
||||
{
|
||||
private MainWindowDatabase mwDatabase; //MainWindowDatabase initializeren
|
||||
private string loggedInUser; // Feld um eingeloggten User zu speichern
|
||||
|
||||
// Konstruktor für MainWindowManager mit MainWindow und User Referenz
|
||||
public MainWindowManager(MainWindow mainWindow, string user)
|
||||
{
|
||||
mwDatabase = new MainWindowDatabase(mainWindow, user);
|
||||
loggedInUser = user;
|
||||
}
|
||||
|
||||
// Methode zum Senden einer Nachricht via Datenbankmanager
|
||||
public void SendMessage()
|
||||
{
|
||||
mwDatabase.SendMessage();
|
||||
}
|
||||
|
||||
// Methode zum Laden der Nachrichten via Datenbankmanager
|
||||
public void LoadMessages()
|
||||
{
|
||||
mwDatabase.LoadMessages();
|
||||
}
|
||||
|
||||
// Methode zum Laden der Online Benutzer via Datenbankmanager
|
||||
public void LoadOnlineUsers()
|
||||
{
|
||||
mwDatabase.LoadOnlineUsers();
|
||||
}
|
||||
|
||||
// Methode zum Ausloggen des Users via Datenbankmanager
|
||||
public void LogoutUser()
|
||||
{
|
||||
mwDatabase.LogoutUser();
|
||||
}
|
||||
|
||||
// Methode zum Löschen des Gesamten Chats
|
||||
public void DeleteMessages()
|
||||
{
|
||||
mwDatabase.ClearMessages();
|
||||
}
|
||||
|
||||
// Methode zum Hochladen eines Profilbildes via Datenbankmanager
|
||||
public async Task UploadProfileImage(string filePath)
|
||||
{
|
||||
await mwDatabase.UploadProfileImage(filePath);
|
||||
}
|
||||
}
|
||||
}
|
13
bibtalk/bib-talk/Business/Message.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
// Klasse um die Nachrichten in der Datenbank zu speichern
|
||||
public class Message
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Text { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
}
|
12
bibtalk/bib-talk/Business/MessageDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
// Klasse damit die Nachrichten in der App benutzt werden können
|
||||
public class MessageDto
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Message { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
}
|
49
bibtalk/bib-talk/Business/RegisterManager.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using bib_talk.Repository;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
public class RegisterManager
|
||||
{
|
||||
private RegisterDatabase registerDatabase; // RegisterDatabase Objekt initialisieren
|
||||
|
||||
// Konstruktor für den RegisterManager
|
||||
public RegisterManager(RegisterWindow registerWindow)
|
||||
{
|
||||
registerDatabase = new RegisterDatabase(registerWindow); // RegisterDatabase Objekt deklarieren
|
||||
}
|
||||
|
||||
// Methode um einen neuen Nutzer zu Registrieren via der RegisterDatabase
|
||||
public async void RegisterServer()
|
||||
{
|
||||
await registerDatabase.RegisterServer();
|
||||
}
|
||||
|
||||
|
||||
// DEBUG METHODE
|
||||
// Methode um einen Bot Nutzer auf der Datenbank anzulegen
|
||||
public async void RegisterBots(string username, string password, string email, string birthday)
|
||||
{
|
||||
var newUser = new { Username = username, Password = password, Email = email, Birthday = birthday, IsOnline = "" };
|
||||
string json = JsonConvert.SerializeObject(newUser);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/register", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Registrierung erfolgreich.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Registrierung fehlgeschlagen. " + response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
bibtalk/bib-talk/Business/User.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace bib_talk.Business
|
||||
{
|
||||
// User Klasse mit den Eigenschaften Id, Username, Password,
|
||||
// Email, Birthday, IsOnline und ProfileImagePath
|
||||
// um diese in der App zu Benutzen und in der Datenbank zu speichern
|
||||
public class User
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Birthday { get; set; }
|
||||
public string IsOnline { get; set; }
|
||||
public string ProfileImagePath { get; set; }
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
BIN
bibtalk/bib-talk/Icons/logo.png
Normal file
After Width: | Height: | Size: 26 KiB |
@@ -1,103 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk
|
||||
{
|
||||
public partial class Login : Window
|
||||
{
|
||||
// Field to store logged in user
|
||||
public static string loggedInUser;
|
||||
|
||||
public Login()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ButtonState == MouseButtonState.Pressed)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RegisterWindow register = new RegisterWindow();
|
||||
register.Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void WeiterButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (usernbox.Text != "" && passwordbox.Password != "")
|
||||
{
|
||||
LoginServer();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void passwordbox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (usernbox.Text != "" && passwordbox.Password != "")
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0"));
|
||||
weiterbutton.Foreground = Brushes.White;
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134"));
|
||||
weiterbutton.Foreground = Brushes.Gray;
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
}
|
||||
|
||||
private void Register_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RegisterWindow register = new RegisterWindow();
|
||||
register.Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public async Task LoginServer()
|
||||
{
|
||||
string username = usernbox.Text;
|
||||
string password = passwordbox.Password;
|
||||
var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = ""};
|
||||
string json = JsonConvert.SerializeObject(loginData);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/login", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent);
|
||||
string loggedInUsername = responseData.username;
|
||||
MainWindow mainWindow = new MainWindow(loggedInUsername);
|
||||
mainWindow.Show();
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
MessageBox.Show($"Login failed: {responseContent}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,233 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace bib_talk
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private DispatcherTimer _timer;
|
||||
public string loggedinUser;
|
||||
private bool isFirstLoad = true;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeTimer();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
public MainWindow(string user)
|
||||
{
|
||||
loggedinUser = user;
|
||||
InitializeComponent();
|
||||
InitializeTimer();
|
||||
LoadData();
|
||||
LoadMessages();
|
||||
}
|
||||
|
||||
private void InitializeTimer()
|
||||
{
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(2)
|
||||
};
|
||||
_timer.Tick += (sender, e) => { LoadMessages(); LoadOnlineUsers(); };
|
||||
_timer.Start();
|
||||
}
|
||||
public void LoadData()
|
||||
{
|
||||
loggedinuser.Text = "Logged in as: " + loggedinUser;
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LogoutUser();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ButtonState == MouseButtonState.Pressed)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private async void LoadMessages()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var response = await client.GetAsync("http://daddypig.dns.navy:5114/api/messages/get");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var messages = JsonConvert.DeserializeObject<List<Message>>(responseContent);
|
||||
chatlistbox.ItemsSource = messages;
|
||||
if (chatlistbox.Items.Count > 0)
|
||||
{
|
||||
var lastItem = chatlistbox.Items[chatlistbox.Items.Count - 1];
|
||||
chatlistbox.ScrollIntoView(lastItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void LogoutUser()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var logoutData = new { Username = loggedinUser, Password = "", Email = "", Birthday = "", IsOnline = "" };
|
||||
var json = JsonConvert.SerializeObject(logoutData);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/logout", content);
|
||||
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
private async void LoadOnlineUsers()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var response = await client.GetAsync("http://daddypig.dns.navy:5114/api/users/online-users");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var onlineUsers = JsonConvert.DeserializeObject<List<User>>(responseContent);
|
||||
onlineUsersListBox.ItemsSource = onlineUsers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void messageBOX_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(messageBOX.Text))
|
||||
{
|
||||
var message = new MessageDto
|
||||
{
|
||||
Username = loggedinUser,
|
||||
Message = messageBOX.Text,
|
||||
Timestamp = DateTime.Now,
|
||||
};
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(message);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/messages/send", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
messageBOX.Clear();
|
||||
LoadMessages(); // Reload messages after sending
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void send_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(messageBOX.Text))
|
||||
{
|
||||
var message = new MessageDto
|
||||
{
|
||||
Username = loggedinUser,
|
||||
Message = messageBOX.Text,
|
||||
Timestamp = DateTime.Now,
|
||||
};
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(message);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/messages/send", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
messageBOX.Clear();
|
||||
LoadMessages(); // Reload messages after sending
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Message
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Text { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
|
||||
public class MessageDto
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Message { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
public class User
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Birthday { get; set; }
|
||||
public string IsOnline { get; set; }
|
||||
}
|
||||
|
||||
private void ChatFenster_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(popup.IsOpen = true)
|
||||
{
|
||||
popup.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
popup.IsOpen = true;
|
||||
}
|
||||
|
||||
}
|
||||
private void Button1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Button 1 wurde geklickt!");
|
||||
ClosePopup();
|
||||
}
|
||||
|
||||
private void Button2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Button 2 wurde geklickt!");
|
||||
ClosePopup();
|
||||
}
|
||||
|
||||
private void Button3_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Button 3 wurde geklickt!");
|
||||
ClosePopup();
|
||||
}
|
||||
|
||||
private void Popup_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
ClosePopup();
|
||||
}
|
||||
|
||||
private void ClosePopup()
|
||||
{
|
||||
popup.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
49
bibtalk/bib-talk/Repository/LoginDatabase.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk.Repository
|
||||
{
|
||||
public class LoginDatabase
|
||||
{
|
||||
Login loginWindow; // Login Window initialisieren
|
||||
|
||||
// Konstruker der LoginDatabase
|
||||
public LoginDatabase(Login loginWindow)
|
||||
{
|
||||
this.loginWindow = loginWindow; // Login Window deklarieren
|
||||
}
|
||||
|
||||
// Methode um den User einzuloggen via eines Server aufrufs
|
||||
public async Task LoginServer()
|
||||
{
|
||||
string username = loginWindow.usernbox.Text;
|
||||
string password = loginWindow.passwordbox.Password;
|
||||
var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = ""};
|
||||
string json = JsonConvert.SerializeObject(loginData);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/login", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent);
|
||||
string loggedInUsername = responseData.username;
|
||||
MainWindow mainWindow = new MainWindow(loggedInUsername);
|
||||
mainWindow.Show();
|
||||
loginWindow.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
MessageBox.Show($"Login failed: {responseContent}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
153
bibtalk/bib-talk/Repository/MainWindowDatabase.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using bib_talk.Business;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk.Repository
|
||||
{
|
||||
public class MainWindowDatabase
|
||||
{
|
||||
private MainWindow mainWindow; // MainWindow initialisieren
|
||||
private string loggedinUser; // Feld um eingeloggten User zu speichern
|
||||
|
||||
// Konstruktor für MainWindowDatabase mit MainWindow und User Referenz
|
||||
public MainWindowDatabase(MainWindow mainWindow, string user)
|
||||
{
|
||||
this.mainWindow = mainWindow;
|
||||
loggedinUser = user;
|
||||
}
|
||||
|
||||
// Methode zum Senden einer Nachricht via Datenbank
|
||||
public async void SendMessage()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(mainWindow.messageBox.Text))
|
||||
{
|
||||
var message = new MessageDto
|
||||
{
|
||||
Username = mainWindow.loggedinUser,
|
||||
Message = mainWindow.messageBox.Text,
|
||||
Timestamp = DateTime.Now,
|
||||
};
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(message);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/messages/send", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
mainWindow.messageBox.Clear();
|
||||
LoadMessages(); // Reload messages after sending
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Laden der Nachrichten via Datenbank
|
||||
public async void LoadMessages()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var response = await client.GetAsync("http://daddypig.dns.navy:5114/api/messages/get");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var messages = JsonConvert.DeserializeObject<List<Message>>(responseContent);
|
||||
mainWindow.chatlistbox.ItemsSource = messages;
|
||||
if (mainWindow.chatlistbox.Items.Count > 0)
|
||||
{
|
||||
var lastItem = mainWindow.chatlistbox.Items[mainWindow.chatlistbox.Items.Count - 1];
|
||||
mainWindow.chatlistbox.ScrollIntoView(lastItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Laden der Online Benutzer via Datenbank
|
||||
public async void LoadOnlineUsers()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var response = await client.GetAsync("http://daddypig.dns.navy:5114/api/users/online-users");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var onlineUsers = JsonConvert.DeserializeObject<List<User>>(responseContent);
|
||||
|
||||
|
||||
mainWindow.onlineUsersListBox.ItemsSource = onlineUsers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Löschen des Gesamten Chats via Datenbank
|
||||
public async void ClearMessages()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await client.DeleteAsync("http://daddypig.dns.navy:5114/api/messages/clear");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Alle Nachrichten wurden gelöscht");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"Fehler beim Löschen der Nachrichten. Status code: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ein Fehler ist aufgetreten: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Ausloggen des Users via Datenbank
|
||||
public async void LogoutUser()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var logoutData = new { Username = mainWindow.loggedinUser, Password = "", Email = "", Birthday = "", IsOnline = "" };
|
||||
var json = JsonConvert.SerializeObject(logoutData);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/logout", content);
|
||||
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
mainWindow.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode zum Hochladen eines Profilbildes via Datenbank
|
||||
public async Task UploadProfileImage(string filePath)
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var form = new MultipartFormDataContent();
|
||||
var stream = File.OpenRead(filePath);
|
||||
form.Add(new StreamContent(stream), "file", Path.GetFileName(filePath));
|
||||
|
||||
var response = await client.PostAsync($"http://daddypig.dns.navy:5114/api/users/upload-profile-image?username={loggedinUser}", form);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Profilbild erfolgreich hochgeladen");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Fehler beim Hochladen des Profilbilds");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
bibtalk/bib-talk/Repository/RegisterDatabase.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace bib_talk.Repository
|
||||
{
|
||||
public class RegisterDatabase
|
||||
{
|
||||
RegisterWindow registerWindow; // RegisterWindow initailisieren
|
||||
|
||||
// Konstruktor für die RegisterDatabase
|
||||
public RegisterDatabase(RegisterWindow registerWindow)
|
||||
{
|
||||
this.registerWindow = registerWindow;
|
||||
}
|
||||
|
||||
// Methode um einen Nutzer zu registrieren und die Daten
|
||||
// in die Datenbank zu schreiben
|
||||
public async Task RegisterServer()
|
||||
{
|
||||
string username = registerWindow.usernbox.Text;
|
||||
string password = registerWindow.passwordbox.Password;
|
||||
string email = registerWindow.emailbox.Text;
|
||||
string birthday = $"{registerWindow.bday1.Text}.{registerWindow.bday2.Text}.{registerWindow.bday3.Text}";
|
||||
var newUser = new { Username = username, Password = password, Email = email, Birthday = birthday, IsOnline = "" };
|
||||
string json = JsonConvert.SerializeObject(newUser);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/register", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Registrierung erfolgreich.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Registrierung fehlgeschlagen. " + response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -49,12 +49,20 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="HoverUnderlineTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="TextDecorations" Value="None"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Button}}" Value="True">
|
||||
<Setter Property="TextDecorations" Value="Underline"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border CornerRadius="15" BorderThickness="20" BorderBrush="#FF282828">
|
||||
<Grid Margin="-10,-10,-10,-10" Background="#FF282828">
|
||||
<!-- Draggable Area -->
|
||||
<Image HorizontalAlignment="Left" Height="450" Margin="237,-162,0,0" VerticalAlignment="Top" Width="591" Source="/logo.png"/>
|
||||
<Image HorizontalAlignment="Left" Height="450" Margin="237,-162,0,0" VerticalAlignment="Top" Width="591" Source="/Icons/logo.png"/>
|
||||
|
||||
<Grid VerticalAlignment="Top" Height="45" Background="Transparent" MouseLeftButtonDown="DraggableArea_MouseLeftButtonDown" Margin="0,-21,0,0">
|
||||
|
||||
@@ -93,7 +101,7 @@
|
||||
Margin="0,30,0,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="userNameBox_KeyDown"/>
|
||||
|
||||
<!-- Benutzername TextBox -->
|
||||
<TextBlock Text="Passwort"
|
||||
@@ -109,23 +117,23 @@
|
||||
Margin="0,30,0,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="passwordbox_KeyDown"/>
|
||||
<Button x:Name="weiterbutton" Content="Weiter" Foreground="Gray" Background="#FF323134" BorderThickness="0" Margin="0,30,0,0" Height="30" BorderBrush="{x:Null}" Click="WeiterButton_Click" Style="{StaticResource NoHoverButtonStyle}"/>
|
||||
<TextBlock Text="Noch keinen Account?"
|
||||
Foreground="White"
|
||||
FontSize="12"
|
||||
Width="136"
|
||||
Margin="20,20,0,0"/>
|
||||
<Button Style="{StaticResource InvisibleButtonStyle}" Click="Register_Click">
|
||||
<TextBlock Text="Registrieren"
|
||||
<Button x:Name="RegisterButton" Style="{StaticResource InvisibleButtonStyle}" Click="Register_Click">
|
||||
<TextBlock x:Name="RegisterTextBlock" Text="Registrieren"
|
||||
Foreground="#FF6332A0"
|
||||
FontSize="12"
|
||||
Width="66"
|
||||
Margin="8,5,0,0"/>
|
||||
|
||||
Margin="8,5,0,0"
|
||||
Style="{StaticResource HoverUnderlineTextBlockStyle}"/>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
110
bibtalk/bib-talk/UI/Login.xaml.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using bib_talk.Business;
|
||||
using System.Windows.Controls;
|
||||
using System.Threading;
|
||||
|
||||
namespace bib_talk
|
||||
{
|
||||
public partial class Login : Window
|
||||
{
|
||||
LoginManager loginManager;
|
||||
|
||||
public static string loggedInUser; // Feld um eingeloggten User zu speichern
|
||||
|
||||
// Konstruktor für das Login Fenster
|
||||
public Login()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
loginManager = new LoginManager(this);
|
||||
}
|
||||
|
||||
// Methode für Custom Draggable Area
|
||||
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ButtonState == MouseButtonState.Pressed)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um das Fenster zu schließen
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Methode um den User einzuloggen
|
||||
private async void WeiterButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (usernbox.Text != "" && passwordbox.Password != "")
|
||||
{
|
||||
loginManager.Login();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um den Weiter Button zu Aktivieren, wenn ein Nutzername und Passwort eingegeben ist
|
||||
private void passwordbox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (usernbox.Text != "" && passwordbox.Password != "")
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0"));
|
||||
weiterbutton.Foreground = Brushes.White;
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134"));
|
||||
weiterbutton.Foreground = Brushes.Gray;
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um das Registrierungs Fenster zu öffnen
|
||||
private void Register_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RegisterWindow register = new RegisterWindow();
|
||||
register.Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Methode um via der Enter Taste zum nächsten Feld zu springen
|
||||
private void userNameBox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
passwordbox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um via der Enter Taste den User einzuloggen
|
||||
private void passwordbox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (usernbox.Text != "" && passwordbox.Password != "")
|
||||
{
|
||||
loginManager.Login();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Debug Methode um 100 Bot User einzuloggen
|
||||
// Man fügt die Methode einem Button hinzu und ruft sie als Button Click Event auf
|
||||
|
||||
//private void LoginBotUser(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// for (int i = 1; i <= 100; i++)
|
||||
// {
|
||||
// string name = "Bot";
|
||||
// string password = "Bot123";
|
||||
// loginManager.LoginBots(name + i, password);
|
||||
// Thread.Sleep(1000);
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
@@ -12,6 +12,8 @@
|
||||
Background="Transparent"
|
||||
WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Window.Resources>
|
||||
|
||||
|
||||
<Style x:Key="InvisibleButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
@@ -53,32 +55,84 @@
|
||||
|
||||
<Border CornerRadius="15" BorderThickness="20" BorderBrush="#FF282828">
|
||||
<Grid Margin="-10,-10,-10,-10" Background="#FF282828">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="289*"/>
|
||||
<RowDefinition Height="392*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="632*"/>
|
||||
<ColumnDefinition Width="115*"/>
|
||||
<ColumnDefinition Width="118*"/>
|
||||
<ColumnDefinition Width="115*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- Draggable Area -->
|
||||
<Grid VerticalAlignment="Top" Height="45" Background="Transparent" MouseLeftButtonDown="DraggableArea_MouseLeftButtonDown" Margin="0,-21,0,0">
|
||||
<Grid VerticalAlignment="Top" Height="45" Background="Transparent" MouseLeftButtonDown="DraggableArea_MouseLeftButtonDown" Margin="0,-21,0,0" Grid.ColumnSpan="4">
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Close Button -->
|
||||
<Button Style="{StaticResource InvisibleButtonStyle}"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Width="21"
|
||||
Height="22"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,0,0"
|
||||
Click="CloseButton_Click">
|
||||
Click="CloseButton_Click" Grid.Column="3" RenderTransformOrigin="0.057,0.564" Margin="0,-5,0,0">
|
||||
<TextBlock Text="❌"
|
||||
FontSize="20"
|
||||
FontSize="15"
|
||||
Foreground="White"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
VerticalAlignment="Top"/>
|
||||
</Button>
|
||||
<TextBlock HorizontalAlignment="Left" x:Name="loggedinuser" Margin="32,11,0,0" TextWrapping="Wrap" Text="xxxx" VerticalAlignment="Top" Height="22" Width="146" Foreground="White"/>
|
||||
<ListBox x:Name="onlineUsersListBox" Margin="32,84,728,50" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}">
|
||||
<Grid Margin="298,17,0,176" Grid.ColumnSpan="4">
|
||||
<Rectangle Stroke="#FF6332A0" Fill="#FF6332A0" Width="682"/>
|
||||
<TextBlock Text="Global Chat" Margin="108,25,206,21" FontSize="40" Foreground="White" />
|
||||
<Image Source="/UI/logo - Copy.png" Stretch="Fill" Margin="-55,-118,499,0">
|
||||
|
||||
</Image>
|
||||
<Button x:Name="ChatSettings" Content="⚙️" Click="MenuButton_Click" HorizontalAlignment="Left" Margin="634,2,0,0" VerticalAlignment="Top" Height="37" Width="26" Background="Transparent" BorderBrush="Transparent">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu x:Name="contextMenu" IsOpen="False">
|
||||
<MenuItem x:Name="muteChatButton" Header="Chat muten" Click="muteChatButton_Click"/>
|
||||
<MenuItem x:Name="clearChatButton" Header="Clear chat" Click="clearChatButton_Click"/>
|
||||
<MenuItem x:Name="helpButton" Header="Help" Click="helpButton_Click"/>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid Margin="76,17,339,176">
|
||||
|
||||
<Rectangle Stroke="#FF282828" Fill="#FF282828"/>
|
||||
<TextBlock Text="Chats" Foreground="White" FontSize="22" Margin="10,18,134,39" />
|
||||
<TextBox
|
||||
FontSize="20"
|
||||
BorderBrush="Transparent"
|
||||
Margin="10,61,10,10"
|
||||
Background="#FF6332A0"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0" RenderTransformOrigin="0.5,0.5">
|
||||
<TextBox.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="-1" ScaleY="-1"/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform Angle="-180"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</TextBox.RenderTransform>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,17,561,0" Grid.RowSpan="2">
|
||||
<Rectangle Stroke="#FF323134" Fill="#FF323134"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<ListBox x:Name="onlineUsersListBox" Margin="76,112,339,0" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Grid.RowSpan="2">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Width="205" Height="60">
|
||||
<Ellipse Width="10" Height="10" Fill="Green" Margin="5"/>
|
||||
<Image Source="/PICA.jpg" Width="50" Height="50" Stretch="Fill">
|
||||
<Image Source="{Binding ProfileImagePath}" Width="50" Height="50" Stretch="Fill">
|
||||
<Image.Clip>
|
||||
<EllipseGeometry Center="25,25" RadiusX="25" RadiusY="25"/>
|
||||
</Image.Clip>
|
||||
@@ -88,14 +142,14 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<ListBox x:Name="chatlistbox" Margin="244,84,0,50" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}" Foreground="#FF6332A0" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
|
||||
<TextBlock HorizontalAlignment="Left" x:Name="loggedInUser" Margin="0,-3,0,0" TextWrapping="Wrap" Text="xxxx" VerticalAlignment="Top" Height="20" Width="184" Foreground="White" RenderTransformOrigin="0.6,0.591"/>
|
||||
<ListBox x:Name="chatlistbox" Margin="298,112,0,50" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}" Foreground="#FF6332A0" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Grid.ColumnSpan="4" Grid.RowSpan="2">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="{Binding Username}" FontWeight="Bold" FontSize="20"/>
|
||||
<TextBlock Text="{Binding Timestamp, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}" Foreground="Gray"/>
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding Text}" FontSize="16"/>
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding Text}" FontSize="16" Foreground="White"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
@@ -106,23 +160,17 @@
|
||||
</ListBox>
|
||||
|
||||
<TextBox
|
||||
x:Name="messageBOX"
|
||||
x:Name="messageBox"
|
||||
FontSize="20"
|
||||
BorderBrush="Transparent"
|
||||
Margin="244,642,154,10"
|
||||
Margin="298,346,76,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0" KeyDown="messageBOX_KeyDown"/>
|
||||
<Button x:Name="weiterbutton" Click="send_Click" Content="Weiter" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="831,643,44,11" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633"/>
|
||||
|
||||
<Button Content="⋮" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFFF8F8" Margin="847,22,109,602" FontSize="36" Click="ChatFenster_Click"/>
|
||||
<Popup x:Name="popup" Placement="Center" IsOpen="False" LostFocus="Popup_LostFocus">
|
||||
<StackPanel Background="White" Orientation="Vertical" Width="200" Height="150" Margin="10">
|
||||
<Button Content="Button 1" Click="Button1_Click" Margin="5"/>
|
||||
<Button Content="Button 2" Click="Button2_Click" Margin="5"/>
|
||||
<Button Content="Button 3" Click="Button3_Click" Margin="5"/>
|
||||
</StackPanel>
|
||||
</Popup>
|
||||
SelectionBrush="#FF6332A0" KeyDown="messageBox_KeyDown" Grid.ColumnSpan="4" Grid.Row="1"/>
|
||||
<Button x:Name="weiterbutton" Click="send_Click" Content="Weiter" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="44,346,10,0" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Column="3" Grid.Row="1"/>
|
||||
<Button x:Name="uplaodpb" Click="uploadpbclick" Content="Upload" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="10,351,574,5" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Row="1"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
118
bibtalk/bib-talk/UI/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using bib_talk.Business;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace bib_talk
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
MainWindowManager mwManager; // MainWindowManager initializeren
|
||||
|
||||
private DispatcherTimer _timer; // DispatcherTimer initialisieren
|
||||
public string loggedinUser; // Feld um eingeloggten User zu speichern
|
||||
private bool isFirstLoad = true;
|
||||
|
||||
// MainWindow Konstruktor mit einem User und LoadMessages Methode
|
||||
public MainWindow(string user)
|
||||
{
|
||||
loggedinUser = user;
|
||||
InitializeComponent();
|
||||
InitializeTimer();
|
||||
LoadData();
|
||||
|
||||
mwManager = new MainWindowManager(this, user);
|
||||
|
||||
mwManager.LoadMessages();
|
||||
}
|
||||
|
||||
// Der 3 Sekunden Timer für die Nachrichten und Online Benutzer
|
||||
private void InitializeTimer()
|
||||
{
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(2)
|
||||
};
|
||||
_timer.Tick += (sender, e) => { mwManager.LoadMessages(); mwManager.LoadOnlineUsers(); };
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
// Methode zum Usernamen in dem MainWindow anzeigen
|
||||
public void LoadData()
|
||||
{
|
||||
loggedInUser.Text = "Logged in as: " + loggedinUser;
|
||||
}
|
||||
|
||||
// Methode zum User ausloggen und App schließen
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
mwManager.LogoutUser();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Custom DraggableArea für das MainWindow
|
||||
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ButtonState == MouseButtonState.Pressed)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
// Hotkey (Enter) für das Senden einer Nachricht
|
||||
private async void messageBox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
mwManager.SendMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Senden Button für das Senden einer Nachricht
|
||||
private async void send_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
mwManager.SendMessage();
|
||||
}
|
||||
|
||||
// Methode zum Profilbilder hochladen
|
||||
private async void uploadpbclick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "Image files (*.jpg, *.jpeg, *.png, *.gif) | *.jpg; *.jpeg; *.png; *.gif";
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string filePath = openFileDialog.FileName;
|
||||
await mwManager.UploadProfileImage(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
// Logik für den Chat Clear Button
|
||||
private void clearChatButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//Rufe die Methode zum Löschen des Chats auf
|
||||
mwManager.DeleteMessages();
|
||||
}
|
||||
|
||||
#region Ohne Funktion
|
||||
// Chat Settings Logik
|
||||
private void MenuButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Öffnen Sie das Kontextmenü, wenn Sie auf den Drei-Punkte-Button klicken
|
||||
contextMenu.IsOpen = true;
|
||||
}
|
||||
|
||||
private void muteChatButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Logik zum Blockieren eines Benutzers
|
||||
}
|
||||
|
||||
private void helpButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Logik zum Entfernen eines Freundes
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -87,6 +87,14 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="HoverUnderlineTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="TextDecorations" Value="None"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Button}}" Value="True">
|
||||
<Setter Property="TextDecorations" Value="Underline"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border CornerRadius="15" BorderThickness="20" BorderBrush="#FF282828">
|
||||
@@ -131,7 +139,7 @@
|
||||
Margin="0,30,0,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="emailbox_KeyDown"/>
|
||||
|
||||
<!-- Benutzername TextBox -->
|
||||
<TextBlock Text="Benutzername"
|
||||
@@ -146,7 +154,7 @@
|
||||
Margin="0,30,0,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="usernbox_KeyDown"/>
|
||||
|
||||
<!-- Passwort PasswordBox -->
|
||||
<TextBlock Text="Passwort"
|
||||
@@ -161,7 +169,7 @@
|
||||
Margin="0,30,0,0"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="passwordbox_KeyDown"/>
|
||||
|
||||
<!-- Geburtsdatum Text -->
|
||||
<TextBlock Text="Geburtsdatum"
|
||||
@@ -176,7 +184,7 @@
|
||||
BorderBrush="Transparent"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="bday1_KeyDown"/>
|
||||
<TextBox Width="100"
|
||||
Height="30"
|
||||
FontSize="20"
|
||||
@@ -184,7 +192,7 @@
|
||||
BorderBrush="Transparent"
|
||||
Background="#FF323134"
|
||||
Foreground="White"
|
||||
SelectionBrush="#FF6332A0"/>
|
||||
SelectionBrush="#FF6332A0" KeyDown="bday2_KeyDown"/>
|
||||
<TextBox Width="100"
|
||||
Height="30"
|
||||
FontSize="20"
|
||||
@@ -196,25 +204,25 @@
|
||||
</StackPanel>
|
||||
|
||||
<!-- Checkbox -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,20,0,0" Height="29">
|
||||
<CheckBox x:Name="checkboxAGB" Style="{StaticResource CustomCheckBoxStyle}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked"/>
|
||||
<TextBlock FontSize="9" TextWrapping="Wrap" VerticalAlignment="Center" Height="24" Width="269">
|
||||
<Run Text="Ich habe die " Foreground="White"/>
|
||||
<Run Text="Nutzungsbedingungen" Foreground="#FF6332A0"/>
|
||||
<Run Text=" und die " Foreground="White"/>
|
||||
<Run Text="Datenschutzerklärung" Foreground="#FF6332A0"/>
|
||||
<Run Text=" von bib-talk gelesen und akzeptiert." Foreground="White"/>
|
||||
<Grid Margin="0,20,0,0" Height="30.1" Width="250">
|
||||
<CheckBox x:Name="checkboxAGB" Style="{StaticResource CustomCheckBoxStyle}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Margin="-21,0,240,0"/>
|
||||
<TextBlock FontSize="9" TextWrapping="Wrap" VerticalAlignment="Center" Height="24" Margin="15,0,-28,0">
|
||||
<Run Text="Ich habe die " Foreground="White"/>
|
||||
<Run x:Name="nutzungsbedingungenRun" Text="Nutzungsbedingungen" Foreground="#FF6332A0"/>
|
||||
<Run Text=" und die " Foreground="White"/>
|
||||
<Run x:Name="datenschutzRun" Text="Datenschutzerklärung" Foreground="#FF6332A0"/>
|
||||
<Run Text=" von bib-talk gelesen und akzeptiert." Foreground="White"/>
|
||||
</TextBlock>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Button x:Name="weiterbutton" Content="Weiter" Foreground="Gray" Background="#FF323134" BorderThickness="0" Margin="0,20,0,0" Height="30" BorderBrush="{x:Null}" Click="WeiterButton_Click" Style="{StaticResource NoHoverButtonStyle}"/>
|
||||
<Button Style="{StaticResource InvisibleButtonStyle}" Click="Login_Click">
|
||||
<TextBlock Text="Ich habe bereits einen Account"
|
||||
Foreground="#FF6332A0"
|
||||
FontSize="12"
|
||||
Width="167"
|
||||
Margin="-130,5,0,0"/>
|
||||
|
||||
Margin="-130,5,0,0"
|
||||
Style="{StaticResource HoverUnderlineTextBlockStyle}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
@@ -1,35 +1,35 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using bib_talk.Business;
|
||||
|
||||
namespace bib_talk
|
||||
{
|
||||
public partial class RegisterWindow : Window
|
||||
{
|
||||
RegisterManager registerManager; // RegisterManager Objekt initialisieren
|
||||
|
||||
// Konstruktor für das RegisterWindow
|
||||
public RegisterWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
registerManager = new RegisterManager(this); // RegisterManager Objekt erstellen
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
// Methode für das Schließen des Fensters
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Methode für die Custom Draggable Area
|
||||
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ButtonState == MouseButtonState.Pressed)
|
||||
@@ -38,6 +38,7 @@ namespace bib_talk
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um das Login Window aufzurufen
|
||||
private void Login_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Login login = new Login();
|
||||
@@ -45,13 +46,16 @@ namespace bib_talk
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void WeiterButton_Click(object sender, RoutedEventArgs e)
|
||||
// Methode um das Registrieren abzuschließen und das Login Window aufzurufen
|
||||
private async void WeiterButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (checkboxAGB.IsChecked == true)
|
||||
{
|
||||
if (ValidateRegistration())
|
||||
{
|
||||
RegisterServer();
|
||||
// Business Schicht Aufruf
|
||||
registerManager.RegisterServer();
|
||||
|
||||
Login login = new Login();
|
||||
login.Show();
|
||||
this.Close();
|
||||
@@ -63,6 +67,8 @@ namespace bib_talk
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um den Weiter Button zu aktivieren, wenn die "Nutzungsbedingungen"
|
||||
// akzeptiert wurden
|
||||
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0"));
|
||||
@@ -70,6 +76,8 @@ namespace bib_talk
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
|
||||
// Methode um den Weiter Button zu deaktivieren, wenn die "Nutzungsbedingungen"
|
||||
// abgelehnt wurden
|
||||
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134"));
|
||||
@@ -77,6 +85,7 @@ namespace bib_talk
|
||||
weiterbutton.Background = customBrush;
|
||||
}
|
||||
|
||||
// Methode um die Eingaben des Benutzers zu validieren
|
||||
private bool ValidateRegistration()
|
||||
{
|
||||
string username = usernbox.Text;
|
||||
@@ -118,29 +127,64 @@ namespace bib_talk
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task RegisterServer()
|
||||
// Methode um via den Enter Key zum nächsten Textfeld zu springen
|
||||
private void emailbox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
string username = usernbox.Text;
|
||||
string password = passwordbox.Password;
|
||||
string email = emailbox.Text;
|
||||
string birthday = $"{bday1.Text}.{bday2.Text}.{bday3.Text}";
|
||||
var newUser = new { Username = username, Password = password, Email = email, Birthday = birthday, IsOnline = "" };
|
||||
string json = JsonConvert.SerializeObject(newUser);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/register", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Registrierung erfolgreich.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Registrierung fehlgeschlagen. " + response);
|
||||
}
|
||||
usernbox.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um via den Enter Key zum nächsten Textfeld zu springen
|
||||
private void usernbox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
passwordbox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um via den Enter Key zum nächsten Textfeld zu springen
|
||||
private void passwordbox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
bday1.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um via den Enter Key zum nächsten Textfeld zu springen
|
||||
private void bday1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
bday2.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Methode um via den Enter Key zum nächsten Textfeld zu springen
|
||||
private void bday2_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
bday3.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Benutzt um 100 User accounts zu erstellen
|
||||
//private void RegisterNewBots(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// for (int i = 10; i <= 100; i++)
|
||||
// {
|
||||
// string name = "Bot";
|
||||
// string password = "Bot123";
|
||||
// string email = "bot@edu.bib.de";
|
||||
// string birthday = "12.12.2000";
|
||||
// registerManager.RegisterBots(name + i, password, i + email, birthday);
|
||||
// Thread.Sleep(1000);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
@@ -19,13 +19,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Icons\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="logo.png" />
|
||||
<Resource Include="Logo_bib-Talk.png" />
|
||||
<Resource Include="PICA.jpg" />
|
||||
<Resource Include="Icons\logo.png" />
|
||||
<Resource Include="Icons\Logo_bib-Talk.png" />
|
||||
<Resource Include="Icons\PICA.jpg" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -1 +0,0 @@
|
||||
erik stinkt
|