資源簡介
C#寫的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.ServiceModel;
namespace?Jillzhang.Event.Client
{
????public?partial?class?Form1?:?Form?Core.ICallback
????{
????????Core.IServer?server;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????public?void?StatusChanged(Core.Job?job)
????????{
????????????foreach?(ListViewItem?item?in?listView1.Items)
????????????{
????????????????if?(item.Text?==?job.Name)
????????????????{
????????????????????item.SubItems[1].Text?=?job.Status;
????????????????????item.SubItems[2].Text?=?job.LastRunTime.ToString();
????????????????????item.SubItems[3].Text?=?job.LastRunResult;
????????????????????if?(job.LastRunResult?==?“失敗“)
????????????????????{
????????????????????????item.ImageIndex?=?2;
????????????????????}
????????????????????else
????????????????????{
????????????????????????if?(job.Status?==?“Running“)
????????????????????????{
????????????????????????????item.ImageIndex?=?1;
????????????????????????}
????????????????????????else
????????????????????????{
????????????????????????????item.ImageIndex?=?0;
????????????????????????}
????????????????????}
????????????????}
????????????}
????????}
????????ListViewItem?CreateItem(Core.Job?job)
????????{
????????????ListViewItem?item?=?new?ListViewItem(new?string[]?{?job.Name?job.Status?job.LastRunTime.ToString()?job.LastRunResult?});
????????????item.ImageIndex?=?0;
????????????item.Tag?=?job;
????????????return?item;
????????}
????????public?void?OnAdd(Core.Job?job)
????????{
????????????ListViewItem?item?=?CreateItem(job);
????????????listView1.Items.Add(item);
????????}
????????private?System.ComponentModel.BackgroundWorker?backgroundWorker1;
????????private?void?InitializeBackgoundWorker()
????????{
????????????backgroundWorker1?=?new?BackgroundWorker();
????????????backgroundWorker1.DoWork?+=?new?DoWorkEventHandler(backgroundWorker1_DoWork);????????????
????????????backgroundWorker1.RunWorkerCompleted?+=?new?RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
????????}
????????void?backgroundWorker1_RunWorkerCompleted(object?sender?RunWorkerCompletedEventArgs?e)
????????{
????????????toolStripStatusLabel1.Text?=?“獲取任務列表完畢“;
????????????menuStrip1.Enabled?=?true;
????????}
????????List?jobs;
????????void?backgroundWorker1_DoWork(object?sender?DoWorkEventArgs?e)
????????{
????????????jobs?=?server.GetJobs();
????????????if?(listView1.InvokeRequired)
????????????{??????????????
????????????????listView1.Invoke(new?MethodInvoker(UpdateListView));
????????????}
????????????else
????????????{
????????????????UpdateListView();
????????????}
????????}
????????void?LoadJobs()
????????{
????????????menuStrip1.Enabled?=?false;
????????????toolStripStatusLabel1.Text?=?“正
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3030??2008-02-24?08:03??Jillzhang.Event\Jillzhang.Event.sln
????..A..H.?????59392??2008-02-24?11:56??Jillzhang.Event\Jillzhang.Event.suo
?????文件???????1476??2008-02-22?18:29??Jillzhang.Event\Jillzhang.Event.Core\Properties\AssemblyInfo.cs
?????文件???????1151??2008-02-23?22:48??Jillzhang.Event\Jillzhang.Event.Core\IServer.cs
?????文件???????2854??2008-02-22?22:42??Jillzhang.Event\Jillzhang.Event.Core\Jillzhang.Event.Core.csproj
?????文件???????5632??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Core\bin\Debug\Jillzhang.Event.Core.dll
?????文件??????11776??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Core\bin\Debug\Jillzhang.Event.Core.pdb
?????文件???????4096??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Core\obj\Debug\Refactor\Jillzhang.Event.Core.dll
?????文件??????11776??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Core\obj\Debug\Jillzhang.Event.Core.pdb
?????文件???????5632??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Core\obj\Debug\Jillzhang.Event.Core.dll
?????文件????????421??2008-02-24?08:07??Jillzhang.Event\Jillzhang.Event.Core\obj\Debug\Jillzhang.Event.Core.csproj.FileListAbsolute.txt
?????文件????????763??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Core\ICallback.cs
?????文件???????1027??2008-02-22?23:55??Jillzhang.Event\Jillzhang.Event.Core\Job.cs
?????文件???????1482??2008-02-22?18:56??Jillzhang.Event\Jillzhang.Event.Service\Properties\AssemblyInfo.cs
?????文件???????5059??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Service\Server.cs
?????文件???????2897??2008-02-22?22:45??Jillzhang.Event\Jillzhang.Event.Service\Jillzhang.Event.Service.csproj
?????文件???????5632??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Service\bin\Debug\Jillzhang.Event.Core.dll
?????文件??????11776??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Service\bin\Debug\Jillzhang.Event.Core.pdb
?????文件???????7680??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Service\bin\Debug\Jillzhang.Event.Service.dll
?????文件??????17920??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Service\bin\Debug\Jillzhang.Event.Service.pdb
?????文件???????3890??2008-02-24?10:53??Jillzhang.Event\Jillzhang.Event.Service\obj\Debug\ResolveAssemblyReference.cache
?????文件??????17920??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Service\obj\Debug\Jillzhang.Event.Service.pdb
?????文件???????7680??2008-02-24?11:44??Jillzhang.Event\Jillzhang.Event.Service\obj\Debug\Jillzhang.Event.Service.dll
?????文件????????620??2008-02-24?08:07??Jillzhang.Event\Jillzhang.Event.Service\obj\Debug\Jillzhang.Event.Service.csproj.FileListAbsolute.txt
?????文件???????4608??2008-02-24?07:46??Jillzhang.Event\Jillzhang.Event.Service\obj\Debug\Refactor\Jillzhang.Event.Service.dll
?????文件???????1476??2008-02-22?22:51??Jillzhang.Event\Jillzhang.Event.Host\Properties\AssemblyInfo.cs
?????文件???????3180??2008-02-23?09:26??Jillzhang.Event\Jillzhang.Event.Host\Jillzhang.Event.Host.csproj
?????文件??????14328??2008-02-24?10:54??Jillzhang.Event\Jillzhang.Event.Host\bin\Debug\Jillzhang.Event.Host.vshost.exe
?????文件????????895??2008-02-23?14:18??Jillzhang.Event\Jillzhang.Event.Host\bin\Debug\Jillzhang.Event.Host.vshost.exe.config
?????文件????????490??2007-07-21?01:33??Jillzhang.Event\Jillzhang.Event.Host\bin\Debug\Jillzhang.Event.Host.vshost.exe.manifest
............此處省略133個文件信息
- 上一篇:winform 很好用的分頁控件帶SQL數據庫
- 下一篇:C#畫多條二維曲線圖
評論
共有 條評論