form1.cs

来自「博客园WxWinter写的WF工作流入门学习资料及示例代码」· CS 代码 · 共 48 行

CS
48
字号
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 + =
减小字号Ctrl + -
显示快捷键?