一些客户端方法框架的搭建
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Interact;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -11,50 +10,30 @@ 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;
|
||||
|
||||
namespace StormChatWPF
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// UserWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
StormClient.OnLoginDone += HaveLogin;
|
||||
}
|
||||
private void AddUserList()
|
||||
{
|
||||
if (Chat.userlist.Any())
|
||||
{
|
||||
foreach (var user in Chat.userlist)
|
||||
{
|
||||
UsersList.Items.Add(user);
|
||||
}
|
||||
}
|
||||
}//向联系人列表listview中添加元素
|
||||
|
||||
|
||||
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("登录失败!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user