📄 form1.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -