Serverseitige Profilbilder u. Datenverwaltung auf dem Serve
-4 stunden meines lebens
This commit is contained in:
parent
891f3f9e87
commit
28460e3312
BIN
bibtalk/bib-talk/Icons/logo - Copy.png
Normal file
BIN
bibtalk/bib-talk/Icons/logo - Copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -23,7 +23,7 @@ namespace bib_talk.Repository
|
||||
{
|
||||
string username = loginWindow.usernbox.Text;
|
||||
string password = loginWindow.passwordbox.Password;
|
||||
var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = "" };
|
||||
var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = ""};
|
||||
string json = JsonConvert.SerializeObject(loginData);
|
||||
|
||||
using (var client = new HttpClient())
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
@ -71,12 +72,18 @@ namespace bib_talk.Repository
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var onlineUsers = JsonConvert.DeserializeObject<List<User>>(responseContent);
|
||||
|
||||
|
||||
mainWindow.onlineUsersListBox.ItemsSource = onlineUsers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async void LogoutUser()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
|
@ -62,7 +62,7 @@
|
||||
<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="/UI/logo.png"/>
|
||||
|
||||
<Grid VerticalAlignment="Top" Height="45" Background="Transparent" MouseLeftButtonDown="DraggableArea_MouseLeftButtonDown" Margin="0,-21,0,0">
|
||||
|
||||
|
BIN
bibtalk/bib-talk/UI/Logo_bib-Talk.png
Normal file
BIN
bibtalk/bib-talk/UI/Logo_bib-Talk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -99,11 +99,9 @@
|
||||
|
||||
|
||||
<Rectangle Stroke="#FF6332A0" Fill="#FF6332A0" Width="682"/>
|
||||
<TextBlock Text="Name" Margin="108,18,134,18" FontSize="40" Foreground="White" />
|
||||
<Image Source="/Icons/PICA.jpg" Width="80" Height="80" Stretch="Fill" Margin="10,8,592,7">
|
||||
<Image.Clip>
|
||||
<EllipseGeometry Center="40,40" RadiusX="40" RadiusY="40"/>
|
||||
</Image.Clip>
|
||||
<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 Content="⋮" HorizontalAlignment="Left" Margin="638,8,0,0" VerticalAlignment="Top" Width="19" Height="70" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" FontSize="58" Click="ChatFenster_Click"/>
|
||||
</Grid>
|
||||
@ -139,7 +137,7 @@
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Width="205" Height="60">
|
||||
<Ellipse Width="10" Height="10" Fill="Green" Margin="5"/>
|
||||
<Image Source="/Icons/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>
|
||||
@ -149,7 +147,7 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<TextBlock HorizontalAlignment="Left" x:Name="loggedinuser" Margin="247,113,0,0" TextWrapping="Wrap" Text="xxxx" VerticalAlignment="Top" Height="84" Width="46" Foreground="White" RenderTransformOrigin="0.6,0.591"/>
|
||||
<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>
|
||||
@ -175,6 +173,7 @@
|
||||
Foreground="White"
|
||||
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,10" 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"/>
|
||||
|
||||
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
using bib_talk.Repository;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -130,7 +132,40 @@ namespace bib_talk
|
||||
{
|
||||
|
||||
}
|
||||
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 UploadProfileImage(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
private 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class Message
|
||||
{
|
||||
@ -153,5 +188,6 @@ namespace bib_talk
|
||||
public string Email { get; set; }
|
||||
public string Birthday { get; set; }
|
||||
public string IsOnline { get; set; }
|
||||
public string ProfileImagePath { get; set; }
|
||||
}
|
||||
}
|
||||
|
BIN
bibtalk/bib-talk/UI/logo - Copy.png
Normal file
BIN
bibtalk/bib-talk/UI/logo - Copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
bibtalk/bib-talk/UI/logo.png
Normal file
BIN
bibtalk/bib-talk/UI/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -12,6 +12,9 @@
|
||||
<None Remove="logo.png" />
|
||||
<None Remove="Logo_bib-Talk.png" />
|
||||
<None Remove="PICA.jpg" />
|
||||
<None Remove="UI\logo - Copy.png" />
|
||||
<None Remove="UI\logo.png" />
|
||||
<None Remove="UI\Logo_bib-Talk.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -22,6 +25,9 @@
|
||||
<Resource Include="Icons\logo.png" />
|
||||
<Resource Include="Icons\Logo_bib-Talk.png" />
|
||||
<Resource Include="Icons\PICA.jpg" />
|
||||
<Resource Include="UI\logo - Copy.png" />
|
||||
<Resource Include="UI\logo.png" />
|
||||
<Resource Include="UI\Logo_bib-Talk.png" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user