WPF userwindow and logwindow

This commit is contained in:
Kaniu Tayou
2018-12-15 22:51:48 +08:00
parent 55a82b5a4f
commit e97b49667e
8 changed files with 144 additions and 41 deletions
+33 -1
View File
@@ -1,4 +1,5 @@
using System;
using Interact;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -23,6 +24,37 @@ namespace StormChatWPF
public MainWindow()
{
InitializeComponent();
StormClient.OnLoginDone += HaveLogin;
}
private void Login_button_Click(object sender, RoutedEventArgs e)
{
if (StormClient.Initialize())
{
StormClient.QueueLogin(AccountBox.Text, passwordBox.Password, null);
}
else
{
MessageBox.Show("连接服务器失败!");
}
}
private void HaveLogin(ResultHead head, User user)
{
App.Current.Dispatcher.Invoke((Action)delegate ()
{
if (head.Error == "")
{
User.Me = user;
UserWindow userWindow = new UserWindow();
userWindow.Show();
this.Close();
}
else
{
MessageBox.Show("登录失败!");
}
});
}
}
}