krimskrams
This commit is contained in:
parent
4f849171c9
commit
7b8355972b
@ -113,6 +113,8 @@
|
||||
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"/>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
@ -139,6 +139,31 @@ namespace bib_talk
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
|
@ -52,6 +52,9 @@ namespace bib_talk
|
||||
if (ValidateRegistration())
|
||||
{
|
||||
RegisterServer();
|
||||
Login login = new Login();
|
||||
login.Show();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user