Click here to Skip to main content
15,892,298 members
Articles / Database Development / SQL Server / SQL Server 2008

Event-Driven Architecture in the Clouds with Windows Azure

,
Rate me:
Please Sign up or sign in to vote.
4.95/5 (23 votes)
5 Feb 2010CPOL14 min read 71.1K   577   58  
To demonstrate Azure and EDA, this article will show you how to build a flight delay management system for all US airports in clouds with Windows Azure.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.21006.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 3.0.40818.0
// 
namespace AirportMapDelays.AirportDelayService {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="AirportInfo", Namespace="http://schemas.datacontract.org/2004/07/FlightUpdates.Entities")]
    public partial class AirportInfo : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string AirportCodeField;
        
        private string AirportNameField;
        
        private int DelayTimeField;
        
        private int GMTOffsetField;
        
        private double LatitudeDegreeField;
        
        private int LatitudeMinuteField;
        
        private char LatitudeNpeerSField;
        
        private int LatitudeSecondField;
        
        private double LongitudeDegreeField;
        
        private char LongitudeEperWField;
        
        private int LongitudeMinuteField;
        
        private int LongitudeSecondField;
        
        private long RunwayElevationFeetField;
        
        private long RunwayLengthFeetField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string AirportCode {
            get {
                return this.AirportCodeField;
            }
            set {
                if ((object.ReferenceEquals(this.AirportCodeField, value) != true)) {
                    this.AirportCodeField = value;
                    this.RaisePropertyChanged("AirportCode");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string AirportName {
            get {
                return this.AirportNameField;
            }
            set {
                if ((object.ReferenceEquals(this.AirportNameField, value) != true)) {
                    this.AirportNameField = value;
                    this.RaisePropertyChanged("AirportName");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int DelayTime {
            get {
                return this.DelayTimeField;
            }
            set {
                if ((this.DelayTimeField.Equals(value) != true)) {
                    this.DelayTimeField = value;
                    this.RaisePropertyChanged("DelayTime");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int GMTOffset {
            get {
                return this.GMTOffsetField;
            }
            set {
                if ((this.GMTOffsetField.Equals(value) != true)) {
                    this.GMTOffsetField = value;
                    this.RaisePropertyChanged("GMTOffset");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double LatitudeDegree {
            get {
                return this.LatitudeDegreeField;
            }
            set {
                if ((this.LatitudeDegreeField.Equals(value) != true)) {
                    this.LatitudeDegreeField = value;
                    this.RaisePropertyChanged("LatitudeDegree");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int LatitudeMinute {
            get {
                return this.LatitudeMinuteField;
            }
            set {
                if ((this.LatitudeMinuteField.Equals(value) != true)) {
                    this.LatitudeMinuteField = value;
                    this.RaisePropertyChanged("LatitudeMinute");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public char LatitudeNpeerS {
            get {
                return this.LatitudeNpeerSField;
            }
            set {
                if ((this.LatitudeNpeerSField.Equals(value) != true)) {
                    this.LatitudeNpeerSField = value;
                    this.RaisePropertyChanged("LatitudeNpeerS");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int LatitudeSecond {
            get {
                return this.LatitudeSecondField;
            }
            set {
                if ((this.LatitudeSecondField.Equals(value) != true)) {
                    this.LatitudeSecondField = value;
                    this.RaisePropertyChanged("LatitudeSecond");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double LongitudeDegree {
            get {
                return this.LongitudeDegreeField;
            }
            set {
                if ((this.LongitudeDegreeField.Equals(value) != true)) {
                    this.LongitudeDegreeField = value;
                    this.RaisePropertyChanged("LongitudeDegree");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public char LongitudeEperW {
            get {
                return this.LongitudeEperWField;
            }
            set {
                if ((this.LongitudeEperWField.Equals(value) != true)) {
                    this.LongitudeEperWField = value;
                    this.RaisePropertyChanged("LongitudeEperW");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int LongitudeMinute {
            get {
                return this.LongitudeMinuteField;
            }
            set {
                if ((this.LongitudeMinuteField.Equals(value) != true)) {
                    this.LongitudeMinuteField = value;
                    this.RaisePropertyChanged("LongitudeMinute");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int LongitudeSecond {
            get {
                return this.LongitudeSecondField;
            }
            set {
                if ((this.LongitudeSecondField.Equals(value) != true)) {
                    this.LongitudeSecondField = value;
                    this.RaisePropertyChanged("LongitudeSecond");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public long RunwayElevationFeet {
            get {
                return this.RunwayElevationFeetField;
            }
            set {
                if ((this.RunwayElevationFeetField.Equals(value) != true)) {
                    this.RunwayElevationFeetField = value;
                    this.RaisePropertyChanged("RunwayElevationFeet");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public long RunwayLengthFeet {
            get {
                return this.RunwayLengthFeetField;
            }
            set {
                if ((this.RunwayLengthFeetField.Equals(value) != true)) {
                    this.RunwayLengthFeetField = value;
                    this.RaisePropertyChanged("RunwayLengthFeet");
                }
            }
        }
        
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        
        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="FlightDelayFeed", Namespace="http://schemas.datacontract.org/2004/07/FlightUpdates.Entities")]
    public partial class FlightDelayFeed : object, System.ComponentModel.INotifyPropertyChanged {
        
        private System.DateTime DelayExpirationField;
        
        private int DelayTimeField;
        
        private string FlightCityField;
        
        private string FlightNumberField;
        
        private System.DateTime LastUpdateTimeField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public System.DateTime DelayExpiration {
            get {
                return this.DelayExpirationField;
            }
            set {
                if ((this.DelayExpirationField.Equals(value) != true)) {
                    this.DelayExpirationField = value;
                    this.RaisePropertyChanged("DelayExpiration");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int DelayTime {
            get {
                return this.DelayTimeField;
            }
            set {
                if ((this.DelayTimeField.Equals(value) != true)) {
                    this.DelayTimeField = value;
                    this.RaisePropertyChanged("DelayTime");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string FlightCity {
            get {
                return this.FlightCityField;
            }
            set {
                if ((object.ReferenceEquals(this.FlightCityField, value) != true)) {
                    this.FlightCityField = value;
                    this.RaisePropertyChanged("FlightCity");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string FlightNumber {
            get {
                return this.FlightNumberField;
            }
            set {
                if ((object.ReferenceEquals(this.FlightNumberField, value) != true)) {
                    this.FlightNumberField = value;
                    this.RaisePropertyChanged("FlightNumber");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public System.DateTime LastUpdateTime {
            get {
                return this.LastUpdateTimeField;
            }
            set {
                if ((this.LastUpdateTimeField.Equals(value) != true)) {
                    this.LastUpdateTimeField = value;
                    this.RaisePropertyChanged("LastUpdateTime");
                }
            }
        }
        
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        
        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="AirportDelayService.IAirportCodeService")]
    public interface IAirportCodeService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IAirportCodeService/GetAirports", ReplyAction="http://tempuri.org/IAirportCodeService/GetAirportsResponse")]
        System.IAsyncResult BeginGetAirports(System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> EndGetAirports(System.IAsyncResult result);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IAirportCodeService/GetFlightDelayFeed", ReplyAction="http://tempuri.org/IAirportCodeService/GetFlightDelayFeedResponse")]
        System.IAsyncResult BeginGetFlightDelayFeed(string Airport, System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> EndGetFlightDelayFeed(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface IAirportCodeServiceChannel : AirportMapDelays.AirportDelayService.IAirportCodeService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetAirportsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetAirportsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetFlightDelayFeedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetFlightDelayFeedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class AirportCodeServiceClient : System.ServiceModel.ClientBase<AirportMapDelays.AirportDelayService.IAirportCodeService>, AirportMapDelays.AirportDelayService.IAirportCodeService {
        
        private BeginOperationDelegate onBeginGetAirportsDelegate;
        
        private EndOperationDelegate onEndGetAirportsDelegate;
        
        private System.Threading.SendOrPostCallback onGetAirportsCompletedDelegate;
        
        private BeginOperationDelegate onBeginGetFlightDelayFeedDelegate;
        
        private EndOperationDelegate onEndGetFlightDelayFeedDelegate;
        
        private System.Threading.SendOrPostCallback onGetFlightDelayFeedCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public AirportCodeServiceClient() {
        }
        
        public AirportCodeServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public AirportCodeServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public AirportCodeServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public AirportCodeServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public System.Net.CookieContainer CookieContainer {
            get {
                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
                if ((httpCookieContainerManager != null)) {
                    return httpCookieContainerManager.CookieContainer;
                }
                else {
                    return null;
                }
            }
            set {
                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
                if ((httpCookieContainerManager != null)) {
                    httpCookieContainerManager.CookieContainer = value;
                }
                else {
                    throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
                            "ookieContainerBindingElement.");
                }
            }
        }
        
        public event System.EventHandler<GetAirportsCompletedEventArgs> GetAirportsCompleted;
        
        public event System.EventHandler<GetFlightDelayFeedCompletedEventArgs> GetFlightDelayFeedCompleted;
        
        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
        
        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult AirportMapDelays.AirportDelayService.IAirportCodeService.BeginGetAirports(System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetAirports(callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> AirportMapDelays.AirportDelayService.IAirportCodeService.EndGetAirports(System.IAsyncResult result) {
            return base.Channel.EndGetAirports(result);
        }
        
        private System.IAsyncResult OnBeginGetAirports(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((AirportMapDelays.AirportDelayService.IAirportCodeService)(this)).BeginGetAirports(callback, asyncState);
        }
        
        private object[] OnEndGetAirports(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> retVal = ((AirportMapDelays.AirportDelayService.IAirportCodeService)(this)).EndGetAirports(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetAirportsCompleted(object state) {
            if ((this.GetAirportsCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetAirportsCompleted(this, new GetAirportsCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetAirportsAsync() {
            this.GetAirportsAsync(null);
        }
        
        public void GetAirportsAsync(object userState) {
            if ((this.onBeginGetAirportsDelegate == null)) {
                this.onBeginGetAirportsDelegate = new BeginOperationDelegate(this.OnBeginGetAirports);
            }
            if ((this.onEndGetAirportsDelegate == null)) {
                this.onEndGetAirportsDelegate = new EndOperationDelegate(this.OnEndGetAirports);
            }
            if ((this.onGetAirportsCompletedDelegate == null)) {
                this.onGetAirportsCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetAirportsCompleted);
            }
            base.InvokeAsync(this.onBeginGetAirportsDelegate, null, this.onEndGetAirportsDelegate, this.onGetAirportsCompletedDelegate, userState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult AirportMapDelays.AirportDelayService.IAirportCodeService.BeginGetFlightDelayFeed(string Airport, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetFlightDelayFeed(Airport, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> AirportMapDelays.AirportDelayService.IAirportCodeService.EndGetFlightDelayFeed(System.IAsyncResult result) {
            return base.Channel.EndGetFlightDelayFeed(result);
        }
        
        private System.IAsyncResult OnBeginGetFlightDelayFeed(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string Airport = ((string)(inValues[0]));
            return ((AirportMapDelays.AirportDelayService.IAirportCodeService)(this)).BeginGetFlightDelayFeed(Airport, callback, asyncState);
        }
        
        private object[] OnEndGetFlightDelayFeed(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> retVal = ((AirportMapDelays.AirportDelayService.IAirportCodeService)(this)).EndGetFlightDelayFeed(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetFlightDelayFeedCompleted(object state) {
            if ((this.GetFlightDelayFeedCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetFlightDelayFeedCompleted(this, new GetFlightDelayFeedCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetFlightDelayFeedAsync(string Airport) {
            this.GetFlightDelayFeedAsync(Airport, null);
        }
        
        public void GetFlightDelayFeedAsync(string Airport, object userState) {
            if ((this.onBeginGetFlightDelayFeedDelegate == null)) {
                this.onBeginGetFlightDelayFeedDelegate = new BeginOperationDelegate(this.OnBeginGetFlightDelayFeed);
            }
            if ((this.onEndGetFlightDelayFeedDelegate == null)) {
                this.onEndGetFlightDelayFeedDelegate = new EndOperationDelegate(this.OnEndGetFlightDelayFeed);
            }
            if ((this.onGetFlightDelayFeedCompletedDelegate == null)) {
                this.onGetFlightDelayFeedCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetFlightDelayFeedCompleted);
            }
            base.InvokeAsync(this.onBeginGetFlightDelayFeedDelegate, new object[] {
                        Airport}, this.onEndGetFlightDelayFeedDelegate, this.onGetFlightDelayFeedCompletedDelegate, userState);
        }
        
        private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
        }
        
        private object[] OnEndOpen(System.IAsyncResult result) {
            ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
            return null;
        }
        
        private void OnOpenCompleted(object state) {
            if ((this.OpenCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void OpenAsync() {
            this.OpenAsync(null);
        }
        
        public void OpenAsync(object userState) {
            if ((this.onBeginOpenDelegate == null)) {
                this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
            }
            if ((this.onEndOpenDelegate == null)) {
                this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
            }
            if ((this.onOpenCompletedDelegate == null)) {
                this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
            }
            base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
        }
        
        private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
        }
        
        private object[] OnEndClose(System.IAsyncResult result) {
            ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
            return null;
        }
        
        private void OnCloseCompleted(object state) {
            if ((this.CloseCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void CloseAsync() {
            this.CloseAsync(null);
        }
        
        public void CloseAsync(object userState) {
            if ((this.onBeginCloseDelegate == null)) {
                this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
            }
            if ((this.onEndCloseDelegate == null)) {
                this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
            }
            if ((this.onCloseCompletedDelegate == null)) {
                this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
            }
            base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
        }
        
        protected override AirportMapDelays.AirportDelayService.IAirportCodeService CreateChannel() {
            return new AirportCodeServiceClientChannel(this);
        }
        
        private class AirportCodeServiceClientChannel : ChannelBase<AirportMapDelays.AirportDelayService.IAirportCodeService>, AirportMapDelays.AirportDelayService.IAirportCodeService {
            
            public AirportCodeServiceClientChannel(System.ServiceModel.ClientBase<AirportMapDelays.AirportDelayService.IAirportCodeService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetAirports(System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[0];
                System.IAsyncResult _result = base.BeginInvoke("GetAirports", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> EndGetAirports(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo> _result = ((System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.AirportInfo>)(base.EndInvoke("GetAirports", _args, result)));
                return _result;
            }
            
            public System.IAsyncResult BeginGetFlightDelayFeed(string Airport, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = Airport;
                System.IAsyncResult _result = base.BeginInvoke("GetFlightDelayFeed", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> EndGetFlightDelayFeed(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed> _result = ((System.Collections.ObjectModel.ObservableCollection<AirportMapDelays.AirportDelayService.FlightDelayFeed>)(base.EndInvoke("GetFlightDelayFeed", _args, result)));
                return _result;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions