用户头像显示

This commit is contained in:
Kaniu Tayou
2018-12-25 22:45:58 +08:00
parent 8ec162c5df
commit 96c128b295
13 changed files with 137 additions and 102 deletions
+19 -2
View File
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Interact;
using System.Drawing;
using System.Windows;
using System.IO;
namespace StormChatWPF
{
@@ -17,7 +18,8 @@ namespace StormChatWPF
{
StormClient.OnLoginDone += OnHaveLogin;
StormClient.OnGetUserListDone += OnGetContactsList;
StormClient.OnMessage +=OnMessage;
StormClient.OnMessage +=OnMessage;//事件挂接
User.DefaultPhoto = new MemoryStream(File.ReadAllBytes(@"../../UI/Resources/默认头像.png"));
}
internal static User CurrentContact { get; set; }//设置当前联系人对象
/// <summary>
@@ -38,7 +40,7 @@ namespace StormChatWPF
mainWindow.Show();
LogWindow.Instence.Close();
});
}
}//获取联系人列表完成
private void OnHaveLogin(ResultHead head, User user)
{
if (head.Error == "")
@@ -48,6 +50,11 @@ namespace StormChatWPF
}
else
{
App.Current.Dispatcher.Invoke(
(Action)delegate ()
{
LogWindow.Instence.Login_button.IsEnabled = true;
});
MessageBox.Show("请核对账号密码!");
}
}//登录完成
@@ -74,11 +81,21 @@ namespace StormChatWPF
{
if (!StormClient.QueueLogin(user, password))
{
App.Current.Dispatcher.Invoke(
(Action)delegate ()
{
LogWindow.Instence.Login_button.IsEnabled = true;
});
MessageBox.Show("登录失败");
}
}
else
{
App.Current.Dispatcher.Invoke(
(Action)delegate ()
{
LogWindow.Instence.Login_button.IsEnabled = true;
});
MessageBox.Show("连接服务器失败!");
}
}//登录