diff --git a/Interact/AttrNames.cs b/stormchat-client-csharp/Interact/AttrNames.cs similarity index 100% rename from Interact/AttrNames.cs rename to stormchat-client-csharp/Interact/AttrNames.cs diff --git a/Interact/Client-Fields.cs b/stormchat-client-csharp/Interact/Client-Fields.cs similarity index 100% rename from Interact/Client-Fields.cs rename to stormchat-client-csharp/Interact/Client-Fields.cs diff --git a/Interact/Client-Handle.cs b/stormchat-client-csharp/Interact/Client-Handle.cs similarity index 100% rename from Interact/Client-Handle.cs rename to stormchat-client-csharp/Interact/Client-Handle.cs diff --git a/Interact/Client-Read.cs b/stormchat-client-csharp/Interact/Client-Read.cs similarity index 100% rename from Interact/Client-Read.cs rename to stormchat-client-csharp/Interact/Client-Read.cs diff --git a/Interact/Client-Send.cs b/stormchat-client-csharp/Interact/Client-Send.cs similarity index 100% rename from Interact/Client-Send.cs rename to stormchat-client-csharp/Interact/Client-Send.cs diff --git a/Interact/Client.cs b/stormchat-client-csharp/Interact/Client.cs similarity index 100% rename from Interact/Client.cs rename to stormchat-client-csharp/Interact/Client.cs diff --git a/Interact/Exception.cs b/stormchat-client-csharp/Interact/Exception.cs similarity index 100% rename from Interact/Exception.cs rename to stormchat-client-csharp/Interact/Exception.cs diff --git a/Interact/Interact.csproj b/stormchat-client-csharp/Interact/Interact.csproj similarity index 100% rename from Interact/Interact.csproj rename to stormchat-client-csharp/Interact/Interact.csproj diff --git a/Interact/Message.cs b/stormchat-client-csharp/Interact/Message.cs similarity index 100% rename from Interact/Message.cs rename to stormchat-client-csharp/Interact/Message.cs diff --git a/Interact/Newtonsoft.Json.dll b/stormchat-client-csharp/Interact/Newtonsoft.Json.dll similarity index 100% rename from Interact/Newtonsoft.Json.dll rename to stormchat-client-csharp/Interact/Newtonsoft.Json.dll diff --git a/Interact/Properties/AssemblyInfo.cs b/stormchat-client-csharp/Interact/Properties/AssemblyInfo.cs similarity index 100% rename from Interact/Properties/AssemblyInfo.cs rename to stormchat-client-csharp/Interact/Properties/AssemblyInfo.cs diff --git a/Interact/Properties/Resources.Designer.cs b/stormchat-client-csharp/Interact/Properties/Resources.Designer.cs similarity index 100% rename from Interact/Properties/Resources.Designer.cs rename to stormchat-client-csharp/Interact/Properties/Resources.Designer.cs diff --git a/Interact/Properties/Resources.resx b/stormchat-client-csharp/Interact/Properties/Resources.resx similarity index 100% rename from Interact/Properties/Resources.resx rename to stormchat-client-csharp/Interact/Properties/Resources.resx diff --git a/Interact/User.cs b/stormchat-client-csharp/Interact/User.cs similarity index 100% rename from Interact/User.cs rename to stormchat-client-csharp/Interact/User.cs diff --git a/Interact/JsonObject.cs b/stormchat-client-csharp/Interact/jsonObject.cs similarity index 100% rename from Interact/JsonObject.cs rename to stormchat-client-csharp/Interact/jsonObject.cs diff --git a/StormChat.sln b/stormchat-client-csharp/StormChat.sln similarity index 100% rename from StormChat.sln rename to stormchat-client-csharp/StormChat.sln diff --git a/StormChatWPF/App.config b/stormchat-client-csharp/StormChatWPF/App.config similarity index 100% rename from StormChatWPF/App.config rename to stormchat-client-csharp/StormChatWPF/App.config diff --git a/StormChatWPF/App.xaml b/stormchat-client-csharp/StormChatWPF/App.xaml similarity index 100% rename from StormChatWPF/App.xaml rename to stormchat-client-csharp/StormChatWPF/App.xaml diff --git a/StormChatWPF/App.xaml.cs b/stormchat-client-csharp/StormChatWPF/App.xaml.cs similarity index 100% rename from StormChatWPF/App.xaml.cs rename to stormchat-client-csharp/StormChatWPF/App.xaml.cs diff --git a/StormChatWPF/Chat.cs b/stormchat-client-csharp/StormChatWPF/Chat.cs similarity index 97% rename from StormChatWPF/Chat.cs rename to stormchat-client-csharp/StormChatWPF/Chat.cs index 0e54842..743bdd4 100644 --- a/StormChatWPF/Chat.cs +++ b/stormchat-client-csharp/StormChatWPF/Chat.cs @@ -1,87 +1,87 @@ -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 ContactsList;//联系人集合 - public static Chat chat=new Chat(); - private Chat() - { - StormClient.OnLoginDone += OnHaveLogin; - StormClient.OnGetUserListDone += OnGetContactsList; - StormClient.OnMessage +=OnMessage; - } - internal static User CurrentContact { get; set; }//设置当前联系人对象 - /// - /// 获取联系人列表(完成后打开主窗体) - /// - private void OnGetContactsList(ResultHead head, User[] users) - { - if (head.Error != "") - { - MessageBox.Show("无法获取联系人列表"); - return; - } - App.Current.Dispatcher.Invoke( - (Action)delegate () - { - ContactsList = new List(users); - MainWindow mainWindow = new MainWindow(); - mainWindow.Show(); - LogWindow.Instence.Close(); - }); - } +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 ContactsList;//联系人集合 + public static Chat chat=new Chat(); + private Chat() + { + StormClient.OnLoginDone += OnHaveLogin; + StormClient.OnGetUserListDone += OnGetContactsList; + StormClient.OnMessage +=OnMessage; + } + internal static User CurrentContact { get; set; }//设置当前联系人对象 + /// + /// 获取联系人列表(完成后打开主窗体) + /// + private void OnGetContactsList(ResultHead head, User[] users) + { + if (head.Error != "") + { + MessageBox.Show("无法获取联系人列表"); + return; + } + App.Current.Dispatcher.Invoke( + (Action)delegate () + { + ContactsList = new List(users); + MainWindow mainWindow = new MainWindow(); + mainWindow.Show(); + LogWindow.Instence.Close(); + }); + } private void OnHaveLogin(ResultHead head, User user) - { - if (head.Error == "") - { - User.Me = user; - StormClient.QueueGetUserList(); - } - else - { - MessageBox.Show("请核对账号密码!"); - } - }//登录完成 - private void OnMessage(Message message) - { - if (MainWindow.Instence != null) - { - MainWindow.Instence.ShowMessage(message); - } - }//接受到新消息 - - internal void SendMessage(string text,User target) - { - Message msg = new Message(text,target); - Action f = delegate (ResultHead head) - { - MainWindow.Instence.ShowMessage(msg); - }; - StormClient.QueueSendMessage(msg,f); - }//发送消息 - internal static void Log(string user, string password) - { + { + if (head.Error == "") + { + User.Me = user; + StormClient.QueueGetUserList(); + } + else + { + MessageBox.Show("请核对账号密码!"); + } + }//登录完成 + private void OnMessage(Message message) + { + if (MainWindow.Instence != null) + { + MainWindow.Instence.ShowMessage(message); + } + }//接受到新消息 + + internal void SendMessage(string text,User target) + { + Message msg = new Message(text,target); + Action f = delegate (ResultHead head) + { + MainWindow.Instence.ShowMessage(msg); + }; + StormClient.QueueSendMessage(msg,f); + }//发送消息 + internal static void Log(string user, string password) + { if (StormClient.Initialize()) { - if (!StormClient.QueueLogin(user, password)) - { - MessageBox.Show("登录失败"); + if (!StormClient.QueueLogin(user, password)) + { + MessageBox.Show("登录失败"); } } else { MessageBox.Show("连接服务器失败!"); - } - }//登录 - - } -} + } + }//登录 + + } +} diff --git a/StormChatWPF/LogWindow.xaml b/stormchat-client-csharp/StormChatWPF/LogWindow.xaml similarity index 100% rename from StormChatWPF/LogWindow.xaml rename to stormchat-client-csharp/StormChatWPF/LogWindow.xaml diff --git a/StormChatWPF/LogWindow.xaml.cs b/stormchat-client-csharp/StormChatWPF/LogWindow.xaml.cs similarity index 95% rename from StormChatWPF/LogWindow.xaml.cs rename to stormchat-client-csharp/StormChatWPF/LogWindow.xaml.cs index be1d7ae..5b4b9d6 100644 --- a/StormChatWPF/LogWindow.xaml.cs +++ b/stormchat-client-csharp/StormChatWPF/LogWindow.xaml.cs @@ -1,37 +1,37 @@ -using Interact; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -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 -{ - /// - /// MainWindow.xaml 的交互逻辑 - /// - public partial class LogWindow : Window - { - public static LogWindow Instence; - public LogWindow() - { - InitializeComponent(); - Instence = this; - } - private void Login_button_Click(object sender, RoutedEventArgs e) - { - Chat.Log(AccountBox.Text,passwordBox.Password); - } - - - } -} +using Interact; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +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 +{ + /// + /// MainWindow.xaml 的交互逻辑 + /// + public partial class LogWindow : Window + { + public static LogWindow Instence; + public LogWindow() + { + InitializeComponent(); + Instence = this; + } + private void Login_button_Click(object sender, RoutedEventArgs e) + { + Chat.Log(AccountBox.Text,passwordBox.Password); + } + + + } +} diff --git a/StormChatWPF/MainWindow.xaml b/stormchat-client-csharp/StormChatWPF/MainWindow.xaml similarity index 100% rename from StormChatWPF/MainWindow.xaml rename to stormchat-client-csharp/StormChatWPF/MainWindow.xaml diff --git a/StormChatWPF/MainWindow.xaml.cs b/stormchat-client-csharp/StormChatWPF/MainWindow.xaml.cs similarity index 96% rename from StormChatWPF/MainWindow.xaml.cs rename to stormchat-client-csharp/StormChatWPF/MainWindow.xaml.cs index 427a16a..6c3ea7c 100644 --- a/StormChatWPF/MainWindow.xaml.cs +++ b/stormchat-client-csharp/StormChatWPF/MainWindow.xaml.cs @@ -1,83 +1,83 @@ -using Interact; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace StormChatWPF -{ - /// - /// UserWindow.xaml 的交互逻辑 - /// - public partial class MainWindow : Window - { - public static MainWindow Instence; - public MainWindow() - { - InitializeComponent(); - LoadContactsList(); - Instence = this; - } - private void LoadContactsList() - { - if (Chat.ContactsList.Any()) - { - foreach (var user in Chat.ContactsList) - { - UsersList.Items.Add(user.NickName); - } - } - }//向联系人列表listview中添加元素 - - private void UsersList_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (UsersList.SelectedItem != null) - { - Chat.CurrentContact = Chat.ContactsList[UsersList.SelectedIndex]; - } - } - - private void Button_Click(object sender, RoutedEventArgs e) - { - if (Chat.CurrentContact == null) - { - MessageBox.Show("请选择联系人!"); - return; - } - if (InputBox.Text!="") - { - Chat.chat.SendMessage(InputBox.Text, Chat.CurrentContact); - InputBox.Text = ""; - } - } - - internal void ShowMessage(Message message) - { - if (message.To == User.Me) - { - App.Current.Dispatcher.Invoke( - delegate () - { - OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left)); - }); - }//接受到的的消息 - else - { - App.Current.Dispatcher.Invoke( - delegate () - { - OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Right)); - }); - }//发送的的消息 - }//将消息展现于UI界面 - } -} +using Interact; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace StormChatWPF +{ + /// + /// UserWindow.xaml 的交互逻辑 + /// + public partial class MainWindow : Window + { + public static MainWindow Instence; + public MainWindow() + { + InitializeComponent(); + LoadContactsList(); + Instence = this; + } + private void LoadContactsList() + { + if (Chat.ContactsList.Any()) + { + foreach (var user in Chat.ContactsList) + { + UsersList.Items.Add(user.NickName); + } + } + }//向联系人列表listview中添加元素 + + private void UsersList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (UsersList.SelectedItem != null) + { + Chat.CurrentContact = Chat.ContactsList[UsersList.SelectedIndex]; + } + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + if (Chat.CurrentContact == null) + { + MessageBox.Show("请选择联系人!"); + return; + } + if (InputBox.Text!="") + { + Chat.chat.SendMessage(InputBox.Text, Chat.CurrentContact); + InputBox.Text = ""; + } + } + + internal void ShowMessage(Message message) + { + if (message.To == User.Me) + { + App.Current.Dispatcher.Invoke( + delegate () + { + OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left)); + }); + }//接受到的的消息 + else + { + App.Current.Dispatcher.Invoke( + delegate () + { + OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Right)); + }); + }//发送的的消息 + }//将消息展现于UI界面 + } +} diff --git a/StormChatWPF/Properties/AssemblyInfo.cs b/stormchat-client-csharp/StormChatWPF/Properties/AssemblyInfo.cs similarity index 100% rename from StormChatWPF/Properties/AssemblyInfo.cs rename to stormchat-client-csharp/StormChatWPF/Properties/AssemblyInfo.cs diff --git a/StormChatWPF/Properties/Resources.resx b/stormchat-client-csharp/StormChatWPF/Properties/Resources.resx similarity index 100% rename from StormChatWPF/Properties/Resources.resx rename to stormchat-client-csharp/StormChatWPF/Properties/Resources.resx diff --git a/StormChatWPF/Properties/Settings.Designer.cs b/stormchat-client-csharp/StormChatWPF/Properties/Settings.Designer.cs similarity index 100% rename from StormChatWPF/Properties/Settings.Designer.cs rename to stormchat-client-csharp/StormChatWPF/Properties/Settings.Designer.cs diff --git a/StormChatWPF/Properties/Settings.settings b/stormchat-client-csharp/StormChatWPF/Properties/Settings.settings similarity index 100% rename from StormChatWPF/Properties/Settings.settings rename to stormchat-client-csharp/StormChatWPF/Properties/Settings.settings diff --git a/StormChatWPF/Resources/LogFormBackground.jpg b/stormchat-client-csharp/StormChatWPF/Resources/LogFormBackground.jpg similarity index 100% rename from StormChatWPF/Resources/LogFormBackground.jpg rename to stormchat-client-csharp/StormChatWPF/Resources/LogFormBackground.jpg diff --git a/StormChatWPF/ScrollViewer.cs b/stormchat-client-csharp/StormChatWPF/ScrollViewer.cs similarity index 100% rename from StormChatWPF/ScrollViewer.cs rename to stormchat-client-csharp/StormChatWPF/ScrollViewer.cs diff --git a/StormChatWPF/StormChatWPF.csproj b/stormchat-client-csharp/StormChatWPF/StormChatWPF.csproj similarity index 97% rename from StormChatWPF/StormChatWPF.csproj rename to stormchat-client-csharp/StormChatWPF/StormChatWPF.csproj index 464c36e..c09f777 100644 --- a/StormChatWPF/StormChatWPF.csproj +++ b/stormchat-client-csharp/StormChatWPF/StormChatWPF.csproj @@ -1,124 +1,124 @@ - - - - - Debug - AnyCPU - {CF4D6BE0-A862-401F-A3A6-4FDAC32F5B70} - WinExe - StormChatWPF - StormChatWPF - v4.0 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - StormChatWPF.App - - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - - MainWindow.xaml - - - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - LogWindow.xaml - Code - - - Designer - MSBuild:Compile - - - - - Code - - - True - Settings.settings - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - {cef054af-95b7-4b88-934e-02705feea554} - Interact - - - - - - - - - - - - - - Designer - - - + + + + + Debug + AnyCPU + {CF4D6BE0-A862-401F-A3A6-4FDAC32F5B70} + WinExe + StormChatWPF + StormChatWPF + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + StormChatWPF.App + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + MainWindow.xaml + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + LogWindow.xaml + Code + + + Designer + MSBuild:Compile + + + + + Code + + + True + Settings.settings + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {cef054af-95b7-4b88-934e-02705feea554} + Interact + + + + + + + + + + + + + + Designer + + + \ No newline at end of file diff --git a/StormChatWPF/UI/ChatBubble.cs b/stormchat-client-csharp/StormChatWPF/UI/ChatBubble.cs similarity index 100% rename from StormChatWPF/UI/ChatBubble.cs rename to stormchat-client-csharp/StormChatWPF/UI/ChatBubble.cs diff --git a/StormChatWPF/UI/Resources/登录界面底.png b/stormchat-client-csharp/StormChatWPF/UI/Resources/登录界面底.png similarity index 100% rename from StormChatWPF/UI/Resources/登录界面底.png rename to stormchat-client-csharp/StormChatWPF/UI/Resources/登录界面底.png diff --git a/StormChatWPF/UI/Resources/聊天气泡.png b/stormchat-client-csharp/StormChatWPF/UI/Resources/聊天气泡.png similarity index 100% rename from StormChatWPF/UI/Resources/聊天气泡.png rename to stormchat-client-csharp/StormChatWPF/UI/Resources/聊天气泡.png diff --git a/StormChatWPF/UI/Resources/闪电.png b/stormchat-client-csharp/StormChatWPF/UI/Resources/闪电.png similarity index 100% rename from StormChatWPF/UI/Resources/闪电.png rename to stormchat-client-csharp/StormChatWPF/UI/Resources/闪电.png