form1.cs
来自「Microsoft Mobile Development Handbook的代码」· CS 代码 · 共 57 行
CS
57 行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WSCompressionSample
{
public partial class Form1 : Form
{
// TODO: Change targetURL to correct URL where the Web service is installed
private readonly string targetURL = "http://myServer/CompressionService/CustomersService.asmx";
public Form1()
{
InitializeComponent();
System.Diagnostics.Debug.Assert(targetURL.IndexOf("myServer") == -1,
"Before running this sample, you must change the targetURL field to the correct URL for the CompressionWebService on your own server.");
}
private void buttonGetCustomers_Click(object sender, EventArgs e)
{
textBox1.Text = "";
this.Invalidate();
Cursor.Current = Cursors.WaitCursor;
try
{
CompressionService.CustomersService svc = new WSCompressionSample.CompressionService.CustomersService();
svc.Url = targetURL;
CompressionService.CustomersDataSet ds = null;
int startTime = Environment.TickCount;
if (checkBoxCompressed.Checked)
{
ds = svc.GetCompressedCustomers();
}
else
{
ds = svc.GetCustomers();
}
MessageBox.Show(Convert.ToString(Environment.TickCount - startTime) + "ms");
textBox1.Text = ds.GetXml();
}
finally
{
Cursor.Current = Cursors.Default;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?