Browse Source

socket

ZhangXueYang
zhangxueyang 3 years ago
parent
commit
1e65ea760c

+ 4
- 1
XHZB.DAL/Class1.cs View File

41
                         Message = "无法访问文件服务器,请检查网络或文件服务器地址。";
41
                         Message = "无法访问文件服务器,请检查网络或文件服务器地址。";
42
                         return false;
42
                         return false;
43
                     }
43
                     }
44
+                    //string retString = "";
45
+                    //JObject.Parse(retString);
46
+                    //string str = jo["c"].ToString();
44
                     //Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString());
47
                     //Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString());
45
                     //APP.ResourceAddTwo = new Model_ResourceAddTwo();
48
                     //APP.ResourceAddTwo = new Model_ResourceAddTwo();
46
                     ////0成功,1失败
49
                     ////0成功,1失败
47
                     //if (resultObj.code == 0 && resultObj.obj != null)
50
                     //if (resultObj.code == 0 && resultObj.obj != null)
48
                     //{
51
                     //{
49
                     //    APP.ResourceAddTwo = resultObj.obj;
52
                     //    APP.ResourceAddTwo = resultObj.obj;
50
-                        
53
+
51
                     //    return true;
54
                     //    return true;
52
                     //}
55
                     //}
53
                     //else
56
                     //else

+ 3
- 1
XHZB.Desktop/ToolbarWindow.xaml.cs View File

44
         /// 是否已打开课堂工具二级列表
44
         /// 是否已打开课堂工具二级列表
45
         /// </summary>
45
         /// </summary>
46
         private bool heibanshow = false;
46
         private bool heibanshow = false;
47
+        private bool isTool = true;
47
         #endregion
48
         #endregion
48
 
49
 
49
         #region 初始化
50
         #region 初始化
146
             {
147
             {
147
                 //HideLevel2();
148
                 //HideLevel2();
148
                 pageData.tongping = !pageData.tongping;
149
                 pageData.tongping = !pageData.tongping;
149
-                if (pageData.tongping)
150
+                if (pageData.tongping&& isTool)
150
                 {
151
                 {
152
+                    isTool = false;
151
                     //tongpingBegin();
153
                     //tongpingBegin();
152
                     if (StartLive(out string ErrMessage))
154
                     if (StartLive(out string ErrMessage))
153
                     {
155
                     {

+ 34
- 0
XHZB.Desktop/WebSocket/WSocketClient.cs View File

1
 using Common.system;
1
 using Common.system;
2
+using Newtonsoft.Json.Linq;
2
 using SuperSocket.ClientEngine;
3
 using SuperSocket.ClientEngine;
3
 using System;
4
 using System;
4
 using System.Collections.Generic;
5
 using System.Collections.Generic;
117
             MessageReceived?.Invoke(e.Message);
118
             MessageReceived?.Invoke(e.Message);
118
 
119
 
119
             Console.WriteLine("WS:消息收到:" + e.Message);
120
             Console.WriteLine("WS:消息收到:" + e.Message);
121
+            //string str = e.Message;
122
+            //  JObject.Parse(str);
123
+            //string str = jo["c"].ToString();
120
 
124
 
121
 
125
 
122
             SocketModel msgBean = JsonHelper.JsonToObj<SocketModel>(e.Message);
126
             SocketModel msgBean = JsonHelper.JsonToObj<SocketModel>(e.Message);
123
 
127
 
128
+           //if(isMsg)
129
+           // {
130
+           //     GetOnlineStudentsModel msgBean = JsonHelper.JsonToObj<GetOnlineStudentsModel>(e.Message);
131
+           //     if (msgBean.c == 1040)
132
+           //     {
133
+
134
+           //     }
135
+           // }
136
+
124
             if (msgBean != null && msgBean.b != null)
137
             if (msgBean != null && msgBean.b != null)
125
             {
138
             {
139
+                if(msgBean.c==1040)
140
+                {
141
+                    GetOnlineStudentsModel msgOnline= JsonHelper.JsonToObj<GetOnlineStudentsModel>(e.Message);
142
+
143
+                    foreach(StudentModel getOnline in msgOnline.b.stulst)
144
+                    {
145
+                        OnlineUserModel item = new OnlineUserModel
146
+                        {
147
+                            usertype = 2001,
148
+                            userid = getOnline.userid,
149
+                            username = getOnline.username,
150
+                            userpic = getOnline.headportrait
151
+                        };
152
+                        APP.OnlineUserList.Add(item);
153
+                    }
154
+
155
+                    //GetOnlineStudentsModel get = new GetOnlineStudentsModel();
156
+                    //get.b = new StulstModel();
157
+                   
158
+                    //Console.WriteLine("WS:消息收到1111:" + get);
159
+                }
126
                 if (msgBean.c != 0&& msgBean.u == 2)
160
                 if (msgBean.c != 0&& msgBean.u == 2)
127
                 {
161
                 {
128
                     if (msgBean.c == 2001)//上线
162
                     if (msgBean.c == 2001)//上线

+ 18
- 0
XHZB.Model/GetOnlineStudentsModel.cs View File

1
+
2
+using System.Collections.Generic;
3
+
4
+namespace XHZB.Model
5
+{
6
+    public class GetOnlineStudentsModel
7
+    {
8
+        public int c { get; set; }
9
+        public string d { get; set; }
10
+        public int f { get; set; }
11
+        public int rid { get; set; }
12
+        public int s { get; set; }
13
+        public List<int> t { set; get; }
14
+        public int u { get; set; }
15
+
16
+        public StulstModel b { get; set; } 
17
+    }
18
+}

+ 18
- 0
XHZB.Model/StudentModel.cs View File

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class StudentModel
10
+    {
11
+        /// <summary>
12
+        /// 头像
13
+        /// </summary>
14
+        public string headportrait { get; set; }
15
+        public int userid { get; set; }
16
+        public string username { get; set; }
17
+    }
18
+}

+ 15
- 0
XHZB.Model/StulstModel.cs View File

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class StulstModel
10
+    {
11
+
12
+        public List<StudentModel> stulst { get; set; }
13
+   
14
+    }
15
+}

+ 3
- 0
XHZB.Model/XHZB.Model.csproj View File

49
     <Compile Include="ClassStudentListModel.cs" />
49
     <Compile Include="ClassStudentListModel.cs" />
50
     <Compile Include="ComboBoxBeanModel.cs" />
50
     <Compile Include="ComboBoxBeanModel.cs" />
51
     <Compile Include="DirectorListModel.cs" />
51
     <Compile Include="DirectorListModel.cs" />
52
+    <Compile Include="GetOnlineStudentsModel.cs" />
52
     <Compile Include="LoginModel.cs" />
53
     <Compile Include="LoginModel.cs" />
53
     <Compile Include="NotifyModel.cs" />
54
     <Compile Include="NotifyModel.cs" />
54
     <Compile Include="OnlineUserModel.cs" />
55
     <Compile Include="OnlineUserModel.cs" />
59
     <Compile Include="RollCallModel.cs" />
60
     <Compile Include="RollCallModel.cs" />
60
     <Compile Include="SavefileModel.cs" />
61
     <Compile Include="SavefileModel.cs" />
61
     <Compile Include="SocketModel.cs" />
62
     <Compile Include="SocketModel.cs" />
63
+    <Compile Include="StudentModel.cs" />
64
+    <Compile Include="StulstModel.cs" />
62
     <Compile Include="TsubjectbookListModel.cs" />
65
     <Compile Include="TsubjectbookListModel.cs" />
63
     <Compile Include="ZBMenuModel.cs" />
66
     <Compile Include="ZBMenuModel.cs" />
64
     <Compile Include="ZBPageModel.cs" />
67
     <Compile Include="ZBPageModel.cs" />

Loading…
Cancel
Save