From b918b132a767f97e8b53c9d5076d405679b263cd Mon Sep 17 00:00:00 2001 From: Kaniu Tayou <1056879522@qq.com> Date: Mon, 17 Dec 2018 17:17:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=A1=86=E6=9E=B6=E7=9A=84=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StormChatWPF/App.xaml | 2 +- StormChatWPF/Chat.cs | 69 +++++++++ StormChatWPF/LogWindow.xaml | 17 +++ StormChatWPF/LogWindow.xaml.cs | 40 ++++++ StormChatWPF/MainWindow.xaml | 18 ++- StormChatWPF/MainWindow.xaml.cs | 47 ++----- StormChatWPF/StormChatWPF.csproj | 235 ++++++++++++++++--------------- StormChatWPF/UserWindow.xaml | 14 -- StormChatWPF/UserWindow.xaml.cs | 27 ---- 9 files changed, 269 insertions(+), 200 deletions(-) create mode 100644 StormChatWPF/Chat.cs create mode 100644 StormChatWPF/LogWindow.xaml create mode 100644 StormChatWPF/LogWindow.xaml.cs delete mode 100644 StormChatWPF/UserWindow.xaml delete mode 100644 StormChatWPF/UserWindow.xaml.cs 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 @@ + + + +