|
|
|
<%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Service" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
}

private double GetMinInternal(params double[] d)
{
double min = double.MaxValue;
for (int i = 0; i < d.Length; i++) {
if (d[i] < min) {
min = d[i];
}
}
return min;
}
[WebMethod]
public double GetMin(double[] d)
{
return GetMinInternal(d);
}
[WebMethod]
public double GetMin3(double d1, double d2, double d3)
{
return GetMinInternal(d1, d2, d3);
}
[WebMethod]
public List<string> SplitBySpace(string s)
{
string[] words = s.Split(' ');
List<string> wordsList = new List<string>(words);
return wordsList;
}


[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SplitBySpace",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] SplitBySpace(string s) {
object[] results = this.Invoke("SplitBySpace", new object[] {s});
return ((string[])(results[0]));
}
/// <remarks/>
public void SplitBySpaceAsync(string s) {
this.SplitBySpaceAsync(s, null);
}
/// <remarks/>
public void SplitBySpaceAsync(string s, object userState) {
if ((this.SplitBySpaceOperationCompleted == null)) {
this.SplitBySpaceOperationCompleted = new System.Threading.SendOrPostCallback(
this.OnSplitBySpaceOperationCompleted);
}
this.InvokeAsync("SplitBySpace", new object[] {
s}, this.SplitBySpaceOperationCompleted, userState);
}
private void OnSplitBySpaceOperationCompleted(object arg) {
if ((this.SplitBySpaceCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SplitBySpaceCompleted(this, new SplitBySpaceCompletedEventArgs(
InvokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
MyFirstWebService.Service myWebService = new MyFirstWebService.Service();
resultTextBox.Lines = myWebService.SplitBySpace(
"Lorem ipsum dolor sit amet consectetuer vel dolor Quisque hendrerit nibh");

barcode.BarcodeSvc service = new barcode.BarcodeSvc();
byte[] buffer = service.CreateBarcode(10, 10, 10, 10,
"Super Title", 10, true,
textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text,
24, 8, true, "gif");
MemoryStream stream = new MemoryStream(buffer);
Bitmap bmp = new Bitmap(stream);
pictureBox.Width = bmp.Width;
pictureBox.Height = bmp.Height;
pictureBox.Image = bmp;
private void callButton_Click(object sender, EventArgs e)
{
barcode.BarcodeSvc service = new barcode.BarcodeSvc();
service.CreateBarcodeCompleted += new barcode.CreateBarcodeCompletedEventHandler(BarcodeCompleted);
service.CreateBarcodeAsync(10, 10, 10, 10,
"Super Title", 10, true,
textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text,
24, 8, true, "gif");
}
void BarcodeCompleted(object sender, barcode.CreateBarcodeCompletedEventArgs e)
{
byte[] buffer = e.Result;
MemoryStream stream = new MemoryStream(buffer);
Bitmap bmp = new Bitmap(stream);
pictureBox.Width = bmp.Width;
pictureBox.Height = bmp.Height;
pictureBox.Image = bmp;
}