91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 201KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-11-25
  • 語言: 其他
  • 標簽: WCF??聊天??

資源簡介

利用Wcf實現(xiàn)聊天程序,WCF很好的學習資料

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Runtime.InteropServices;
using?System.ServiceModel;

namespace?WCFChatClient
{
????public?partial?class?ChatForm?:?Form?IChatServiceCallback
????{
????????///?
????????///?該函數(shù)將指定的消息發(fā)送到一個或多個窗口。此函數(shù)為指定的窗口調用窗口程序,直到窗口程序處理完消息再返回。 
????????///?

????????///?其窗口程序將接收消息的窗口的句柄
????????///?指定被發(fā)送的消息
????????///?指定附加的消息指定信息
????????///?指定附加的消息指定信息
????????[DllImport(“user32.dll“)]
????????private?static?extern?int?SendMessage(IntPtr?hWnd?int?msg?int?wParam?IntPtr?lParam);
????????//當一個窗口標準垂直滾動條產生一個滾動事件時發(fā)送此消息給那個窗口,也發(fā)送給擁有它的控件
????????private?const?int?WM_VSCROLL?=?0x115;
????????private?const?int?SB_BOTTOM?=?7;
????????private?int?lastSelectedIndex?=?-1;

????????private?ChatServiceClient?proxy;
????????private?string?userName;

????????private?WaitForm?wfDlg?=?new?WaitForm();
????????private?delegate?void?HandleDelegate(string[]?list);
????????private?delegate?void?HandleErrorDelegate();

????????public?ChatForm()
????????{
????????????InitializeComponent();
????????????ShowInterChatMenuItem(true);
????????}

????????///?
????????///?連接服務器
????????///?

????????private?void?InterChatMenuItem_Click(object?sender?EventArgs?e)
????????{
????????????lbOnlineUsers.Items.Clear();
????????????LoginForm?loginDlg?=?new?LoginForm();
????????????if?(loginDlg.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????userName?=?loginDlg.txtUserName.Text;
????????????????loginDlg.Close();
????????????}

????????????txtChatContent.Focus();
????????????Application.DoEvents();
????????????InstanceContext?site?=?new?InstanceContext(this);//為實現(xiàn)服務實例的對象進行初始化
????????????proxy?=?new?ChatServiceClient(site);
????????????IAsyncResult?iar?=?proxy.BeginJoin(userName?new?AsyncCallback(OnEndJoin)?null);
????????????wfDlg.ShowDialog();
????????}

????????private?void?OnEndJoin(IAsyncResult?iar)
????????{
????????????try
????????????{
????????????????string[]?list?=?proxy.EndJoin(iar);
????????????????HandleEndJoin(list);

????????????}
????????????catch?(Exception?e)
????????????{
????????????????HandleEndJoinError();
????????????}

????????}
????????///?
????????///?錯誤提示
????????///?

????????private?void?HandleEndJoinError()
????????{
????????????if?(wfDlg.InvokeRequired)
????????????????wfDlg.Invoke(new?HandleErrorDelegate(HandleEndJoinError));
????????????else
????????????{
????????????????wfDlg.ShowError(“無法連接聊天室!“);
????????????????ExitChatSession();
????????????}
????????}
????????///?
????????///?登錄結束后的處理
????????///?

????????///?
????????private?void?HandleEndJoin(string[]?li

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1425??2009-08-31?14:13??WCFChat\WCFChat.sln

????..A..H.?????47616??2009-09-04?13:33??WCFChat\WCFChat.suo

?????文件????????930??2009-09-02?23:02??WCFChat\WCFChatClient\App.config

?????文件??????61440??2009-09-04?13:02??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.exe

?????文件????????936??2009-09-03?15:11??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.exe.config

?????文件??????44544??2009-09-04?13:02??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.pdb

?????文件??????14328??2009-09-04?19:51??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.vshost.exe

?????文件????????936??2009-09-03?15:11??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.vshost.exe.config

?????文件????????490??2007-07-21?01:33??WCFChat\WCFChatClient\bin\Debug\WCFChatClient.vshost.exe.manifest

?????文件??????31290??2009-09-03?15:11??WCFChat\WCFChatClient\bin\Debug.rar

?????文件???????9698??2009-09-03?15:01??WCFChat\WCFChatClient\ChatForm.cs

?????文件???????9222??2009-09-03?14:57??WCFChat\WCFChatClient\ChatForm.Designer.cs

?????文件??????25497??2009-09-03?14:57??WCFChat\WCFChatClient\ChatForm.resx

?????文件???????4572??2009-09-01?23:29??WCFChat\WCFChatClient\ChatProxy.cs

?????文件????????545??2009-09-04?13:02??WCFChat\WCFChatClient\LoginForm.cs

?????文件???????3768??2009-09-04?13:02??WCFChat\WCFChatClient\LoginForm.Designer.cs

?????文件??????25299??2009-09-04?13:02??WCFChat\WCFChatClient\LoginForm.resx

?????文件??????13562??2009-09-03?14:57??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.ChatForm.resources

?????文件???????1571??2009-09-04?19:51??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.csproj.FileListAbsolute.txt

?????文件???????1031??2009-09-04?13:02??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.csproj.GenerateResource.Cache

?????文件??????61440??2009-09-04?13:02??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.exe

?????文件??????13562??2009-09-04?13:02??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.LoginForm.resources

?????文件??????44544??2009-09-04?13:02??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.pdb

?????文件????????180??2009-09-01?22:55??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.Properties.Resources.resources

?????文件??????13562??2009-09-01?22:55??WCFChat\WCFChatClient\obj\Debug\WCFChatClient.WaitForm.resources

?????文件????????497??2009-08-31?14:27??WCFChat\WCFChatClient\Program.cs

?????文件???????1358??2009-08-31?14:05??WCFChat\WCFChatClient\Properties\AssemblyInfo.cs

?????文件???????2876??2009-08-31?14:05??WCFChat\WCFChatClient\Properties\Resources.Designer.cs

?????文件???????5612??2009-08-31?14:05??WCFChat\WCFChatClient\Properties\Resources.resx

?????文件???????1098??2009-08-31?14:05??WCFChat\WCFChatClient\Properties\Settings.Designer.cs

............此處省略82個文件信息

評論

共有 條評論