⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reference.cs

📁 在手机操作系统上Mobile上开发的一个查看天气预报的程序。很好的一个实例。
💻 CS
字号:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.832
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.CompactFramework.Design.Data, Version 2.0.50727.832.
// 
namespace PPC_Weather.webService {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    using System.Data;
using System.Drawing;
    
    
    /// <remarks/>
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="WeatherWebServiceSoap", Namespace="http://WebXml.com.cn/")]
    public partial class WeatherWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        /// <remarks/>
        public WeatherWebService() {
            this.Url = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx";
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://WebXml.com.cn/getSupportCity", RequestNamespace="http://WebXml.com.cn/", ResponseNamespace="http://WebXml.com.cn/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] getSupportCity(string byProvinceName) {
            object[] results = this.Invoke("getSupportCity", new object[] {
                        byProvinceName});
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetSupportCity(string byProvinceName, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getSupportCity", new object[] {
                        byProvinceName}, callback, asyncState);
        }
        
        /// <remarks/>
        public string[] EndgetSupportCity(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://WebXml.com.cn/getSupportProvince", RequestNamespace="http://WebXml.com.cn/", ResponseNamespace="http://WebXml.com.cn/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] getSupportProvince() {
            object[] results = this.Invoke("getSupportProvince", new object[0]);
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetSupportProvince(System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getSupportProvince", new object[0], callback, asyncState);
        }
        
        /// <remarks/>
        public string[] EndgetSupportProvince(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://WebXml.com.cn/getSupportDataSet", RequestNamespace="http://WebXml.com.cn/", ResponseNamespace="http://WebXml.com.cn/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public System.Data.DataSet getSupportDataSet() {
            object[] results = this.Invoke("getSupportDataSet", new object[0]);
            return ((System.Data.DataSet)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetSupportDataSet(System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getSupportDataSet", new object[0], callback, asyncState);
        }
        
        /// <remarks/>
        public System.Data.DataSet EndgetSupportDataSet(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((System.Data.DataSet)(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://WebXml.com.cn/getWeatherbyCityName", RequestNamespace="http://WebXml.com.cn/", ResponseNamespace="http://WebXml.com.cn/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] getWeatherbyCityName(string theCityName) {
            object[] results = this.Invoke("getWeatherbyCityName", new object[] {
                        theCityName});
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetWeatherbyCityName(string theCityName, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getWeatherbyCityName", new object[] {
                        theCityName}, callback, asyncState);
        }
        
        /// <remarks/>
        public string[] EndgetWeatherbyCityName(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://WebXml.com.cn/getWeatherbyCityNamePro", RequestNamespace="http://WebXml.com.cn/", ResponseNamespace="http://WebXml.com.cn/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] getWeatherbyCityNamePro(string theCityName, string theUserID) {
            object[] results = this.Invoke("getWeatherbyCityNamePro", new object[] {
                        theCityName,
                        theUserID});
            return ((string[])(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetWeatherbyCityNamePro(string theCityName, string theUserID, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getWeatherbyCityNamePro", new object[] {
                        theCityName,
                        theUserID}, callback, asyncState);
        }
        
        /// <remarks/>
        public string[] EndgetWeatherbyCityNamePro(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }


        /// <summary>
        /// 根据城市获取天气信息
        /// </summary>
        /// <param name="pCityName"></param>
        /// <returns></returns>
        public Weather getWeatherbyCity(string pCityName) {
            Weather weather = new Weather();
            string[] strs = this.getWeatherbyCityName(pCityName);
            if (strs.Length > 0) {
                weather.Province=strs[0];
                weather.City = strs[1];
                weather.PublishDate = strs[4];
                weather.Remark = strs[11];
                weather.Introduction=strs[22];

                weather.Date_today = SplitStr(strs[6], 0) ;
                weather.Temp_today = strs[5];
                weather.Weather_today = SplitStr(strs[6], 1);
                weather.Wind_today = strs[7];
                weather.Pic1_today = strs[8];
                weather.Pic2_today = strs[9];

                weather.Date_tomorrow = SplitStr(strs[13], 0);
                weather.Temp_tomorrow = strs[12];
                weather.Weather_tomorrow = SplitStr(strs[13], 1);
                weather.Wind_tomorrow = strs[14];
                weather.Pic1_tomorrow = "b_" + strs[15];
                weather.Pic2_tomorrow = "b_" + strs[16];

                weather.Date_dayofTMR = SplitStr(strs[18], 0);
                weather.Temp_dayofTMR = strs[17];
                weather.Weather_dayofTMR = SplitStr(strs[18], 1);
                weather.Wind_dayofTMR = strs[19];
                weather.Pic1_dayofTMR = "b_" + strs[20];
                weather.Pic2_dayofTMR = "b_" + strs[21];

            }
            return weather;
        }

        private string SplitStr(string str,int i) {
            return str.Split(' ')[i];
        }

        //获取当前图片
        private Image GetImage(string strFile)
        {
            if (strFile.Length == 0) return null;

            string strPath = App.GetAppPath() + "\\pic\\" + strFile;
            if (System.IO.File.Exists(strPath))
            {
                return new Bitmap(strPath);
            }
            else
            {
                return null;
            }
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -