📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel.Description;
using System.ServiceModel;
namespace wxwinter.wf.testWinFormClient
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
ServiceEndpoint httpEndpoint;
wxwinter.wf.WCFCommunication.ItestControl wcfobj;
private void button1_Click(object sender, EventArgs e)
{
string path =this.txWCFServerURL.Text + this.txWCFServerName.Text;
httpEndpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(wxwinter.wf.WCFCommunication.ItestControl)), new BasicHttpBinding(), new EndpointAddress(path));
ChannelFactory<wxwinter.wf.WCFCommunication.ItestControl> factory;
factory = new ChannelFactory<wxwinter.wf.WCFCommunication.ItestControl>(httpEndpoint);
wcfobj = factory.CreateChannel();
this.button1.Enabled = false;
this.button2.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
if (wcfobj != null)
{
string s = wcfobj.CreateTask("默认模板");
this.listBox1.Items.Add(s);
}
else
{
MessageBox.Show("服务器没有连接");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -