diff --git a/StormChatWPF/App.xaml b/StormChatWPF/App.xaml index 3292a54..1fc1979 100644 --- a/StormChatWPF/App.xaml +++ b/StormChatWPF/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:StormChatWPF" - StartupUri="MainWindow.xaml"> + StartupUri="LogWindow.xaml"> diff --git a/StormChatWPF/Chat.cs b/StormChatWPF/Chat.cs new file mode 100644 index 0000000..6377be9 --- /dev/null +++ b/StormChatWPF/Chat.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Interact; +using System.Drawing; +using System.Windows; + +namespace StormChatWPF +{ + class Chat + { + public static List userlist = new List();//联系人集合 + + + internal static void GetUsers(ResultHandler head, User user) + { + + }//获取联系人对象 + internal static void GetUserList(ResultHead head, User[] users) + { + if (head.Error != "") + { + MessageBox.Show("无法获取联系人列表"); + } + else + return; + }//获取用户列表 + internal static void GetUserPhoto(ResultHead head, Image image) + { + if (head.Error != "") + { + MessageBox.Show("无法读取用户图片"); + } + }//对用户头像进行赋值 + internal void Log(string user,string password) + { + if (StormClient.Initialize()) + { + StormClient.QueueLogin(user,password); + } + else + { + MessageBox.Show("连接服务器失败!"); + } + }//登录 + internal static void HaveLogin(ResultHead head, User user) + { + App.Current.Dispatcher.Invoke( + (Action)delegate () + { + if (head.Error == "") + { + User.Me = user; + MainWindow userWindow = new MainWindow(); + userWindow.Show(); + LogWindow.a.Close(); + } + else + { + MessageBox.Show("登录失败!"); + } + }); + }//登录完成 + + + } +} diff --git a/StormChatWPF/LogWindow.xaml b/StormChatWPF/LogWindow.xaml new file mode 100644 index 0000000..0e46e9f --- /dev/null +++ b/StormChatWPF/LogWindow.xaml @@ -0,0 +1,17 @@ + + + +