summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@protonmail.com>2017-10-10 11:21:01 +0200
committermarcinzelent <zelent.marcin@protonmail.com>2017-10-10 11:21:01 +0200
commita7b4fc7be6dac8c4ff9ae7924eb499d7e2ac1453 (patch)
treea9a560ccfa0fb990ed766d1a1d225115c16ffa55 /Client/MainWindow.cs
parent9ce162142924b6f3c8c977624ed2b2c1916f9be2 (diff)
Removed packages, added Client project properly.HEADmaster
Diffstat (limited to 'Client/MainWindow.cs')
-rw-r--r--Client/MainWindow.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Client/MainWindow.cs b/Client/MainWindow.cs
new file mode 100644
index 0000000..22564ac
--- /dev/null
+++ b/Client/MainWindow.cs
@@ -0,0 +1,35 @@
+using System;
+using Gtk;
+using Client;
+
+public partial class MainWindow : Gtk.Window
+{
+ TcpChatClient tcpChat;
+
+ public MainWindow() : base(Gtk.WindowType.Toplevel)
+ {
+ Build();
+ tcpChat = new TcpChatClient();
+ tcpChat.PropertyChanged += (sender, args) =>
+ outputTv.Buffer.Text = tcpChat.Log;
+ }
+
+ protected void OnDeleteEvent(object sender, DeleteEventArgs a)
+ {
+ Application.Quit();
+ a.RetVal = true;
+ }
+
+ protected async void Connect(object sender, EventArgs e)
+ {
+ await tcpChat.Connect(ipEntry.Text, Int32.Parse(portEntry.Text));
+ tcpChat.SendMessage($"{usernameEntry.Text} connected.");
+ }
+
+ protected void SendMessage(object sender, EventArgs e)
+ {
+ string message = $"{usernameEntry.Text}: {messageEntry.Text}";
+ tcpChat.SendMessage(message);
+ messageEntry.Text = "";
+ }
+}