//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30128.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 4.0.50222.0
// 
namespace SilverTunes.MediaLibrary {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="Album", Namespace="http://tempuri.org/")]
    public partial class Album : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string CoverField;
        
        private string TitleField;
        
        private string ArtistField;
        
        private System.Collections.Generic.List<SilverTunes.MediaLibrary.Song> SongsField;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string Cover {
            get {
                return this.CoverField;
            }
            set {
                if ((object.ReferenceEquals(this.CoverField, value) != true)) {
                    this.CoverField = value;
                    this.RaisePropertyChanged("Cover");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string Title {
            get {
                return this.TitleField;
            }
            set {
                if ((object.ReferenceEquals(this.TitleField, value) != true)) {
                    this.TitleField = value;
                    this.RaisePropertyChanged("Title");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public string Artist {
            get {
                return this.ArtistField;
            }
            set {
                if ((object.ReferenceEquals(this.ArtistField, value) != true)) {
                    this.ArtistField = value;
                    this.RaisePropertyChanged("Artist");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=3)]
        public System.Collections.Generic.List<SilverTunes.MediaLibrary.Song> Songs {
            get {
                return this.SongsField;
            }
            set {
                if ((object.ReferenceEquals(this.SongsField, value) != true)) {
                    this.SongsField = value;
                    this.RaisePropertyChanged("Songs");
                }
            }
        }
        
        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="Song", Namespace="http://tempuri.org/")]
    public partial class Song : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string TitleField;
        
        private string PathField;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string Title {
            get {
                return this.TitleField;
            }
            set {
                if ((object.ReferenceEquals(this.TitleField, value) != true)) {
                    this.TitleField = value;
                    this.RaisePropertyChanged("Title");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string Path {
            get {
                return this.PathField;
            }
            set {
                if ((object.ReferenceEquals(this.PathField, value) != true)) {
                    this.PathField = value;
                    this.RaisePropertyChanged("Path");
                }
            }
        }
        
        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.CollectionDataContractAttribute(Name="ArrayOfString", Namespace="http://tempuri.org/", ItemName="string")]
    public class ArrayOfString : System.Collections.Generic.List<string> {
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="MediaLibrary.MediaLibrarySoap")]
    public interface MediaLibrarySoap {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/GetLibrary", ReplyAction="*")]
        System.IAsyncResult BeginGetLibrary(SilverTunes.MediaLibrary.GetLibraryRequest request, System.AsyncCallback callback, object asyncState);
        
        SilverTunes.MediaLibrary.GetLibraryResponse EndGetLibrary(System.IAsyncResult result);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/Dir", ReplyAction="*")]
        System.IAsyncResult BeginDir(SilverTunes.MediaLibrary.DirRequest request, System.AsyncCallback callback, object asyncState);
        
        SilverTunes.MediaLibrary.DirResponse EndDir(System.IAsyncResult result);
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class GetLibraryRequest {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="GetLibrary", Namespace="http://tempuri.org/", Order=0)]
        public SilverTunes.MediaLibrary.GetLibraryRequestBody Body;
        
        public GetLibraryRequest() {
        }
        
        public GetLibraryRequest(SilverTunes.MediaLibrary.GetLibraryRequestBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class GetLibraryRequestBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string mediapath;
        
        public GetLibraryRequestBody() {
        }
        
        public GetLibraryRequestBody(string mediapath) {
            this.mediapath = mediapath;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class GetLibraryResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="GetLibraryResponse", Namespace="http://tempuri.org/", Order=0)]
        public SilverTunes.MediaLibrary.GetLibraryResponseBody Body;
        
        public GetLibraryResponse() {
        }
        
        public GetLibraryResponse(SilverTunes.MediaLibrary.GetLibraryResponseBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class GetLibraryResponseBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public System.Collections.Generic.List<SilverTunes.MediaLibrary.Album> GetLibraryResult;
        
        public GetLibraryResponseBody() {
        }
        
        public GetLibraryResponseBody(System.Collections.Generic.List<SilverTunes.MediaLibrary.Album> GetLibraryResult) {
            this.GetLibraryResult = GetLibraryResult;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class DirRequest {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="Dir", Namespace="http://tempuri.org/", Order=0)]
        public SilverTunes.MediaLibrary.DirRequestBody Body;
        
        public DirRequest() {
        }
        
        public DirRequest(SilverTunes.MediaLibrary.DirRequestBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class DirRequestBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string path;
        
        public DirRequestBody() {
        }
        
        public DirRequestBody(string path) {
            this.path = path;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class DirResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="DirResponse", Namespace="http://tempuri.org/", Order=0)]
        public SilverTunes.MediaLibrary.DirResponseBody Body;
        
        public DirResponse() {
        }
        
        public DirResponse(SilverTunes.MediaLibrary.DirResponseBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class DirResponseBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public SilverTunes.MediaLibrary.ArrayOfString DirResult;
        
        public DirResponseBody() {
        }
        
        public DirResponseBody(SilverTunes.MediaLibrary.ArrayOfString DirResult) {
            this.DirResult = DirResult;
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface MediaLibrarySoapChannel : SilverTunes.MediaLibrary.MediaLibrarySoap, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetLibraryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetLibraryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.Generic.List<SilverTunes.MediaLibrary.Album> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.Generic.List<SilverTunes.MediaLibrary.Album>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class DirCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public DirCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public SilverTunes.MediaLibrary.ArrayOfString Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((SilverTunes.MediaLibrary.ArrayOfString)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class MediaLibrarySoapClient : System.ServiceModel.ClientBase<SilverTunes.MediaLibrary.MediaLibrarySoap>, SilverTunes.MediaLibrary.MediaLibrarySoap {
        
        private BeginOperationDelegate onBeginGetLibraryDelegate;
        
        private EndOperationDelegate onEndGetLibraryDelegate;
        
        private System.Threading.SendOrPostCallback onGetLibraryCompletedDelegate;
        
        private BeginOperationDelegate onBeginDirDelegate;
        
        private EndOperationDelegate onEndDirDelegate;
        
        private System.Threading.SendOrPostCallback onDirCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public MediaLibrarySoapClient() {
        }
        
        public MediaLibrarySoapClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public MediaLibrarySoapClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MediaLibrarySoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MediaLibrarySoapClient(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<GetLibraryCompletedEventArgs> GetLibraryCompleted;
        
        public event System.EventHandler<DirCompletedEventArgs> DirCompleted;
        
        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 SilverTunes.MediaLibrary.MediaLibrarySoap.BeginGetLibrary(SilverTunes.MediaLibrary.GetLibraryRequest request, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetLibrary(request, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.IAsyncResult BeginGetLibrary(string mediapath, System.AsyncCallback callback, object asyncState) {
            SilverTunes.MediaLibrary.GetLibraryRequest inValue = new SilverTunes.MediaLibrary.GetLibraryRequest();
            inValue.Body = new SilverTunes.MediaLibrary.GetLibraryRequestBody();
            inValue.Body.mediapath = mediapath;
            return ((SilverTunes.MediaLibrary.MediaLibrarySoap)(this)).BeginGetLibrary(inValue, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        SilverTunes.MediaLibrary.GetLibraryResponse SilverTunes.MediaLibrary.MediaLibrarySoap.EndGetLibrary(System.IAsyncResult result) {
            return base.Channel.EndGetLibrary(result);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.Collections.Generic.List<SilverTunes.MediaLibrary.Album> EndGetLibrary(System.IAsyncResult result) {
            SilverTunes.MediaLibrary.GetLibraryResponse retVal = ((SilverTunes.MediaLibrary.MediaLibrarySoap)(this)).EndGetLibrary(result);
            return retVal.Body.GetLibraryResult;
        }
        
        private System.IAsyncResult OnBeginGetLibrary(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string mediapath = ((string)(inValues[0]));
            return this.BeginGetLibrary(mediapath, callback, asyncState);
        }
        
        private object[] OnEndGetLibrary(System.IAsyncResult result) {
            System.Collections.Generic.List<SilverTunes.MediaLibrary.Album> retVal = this.EndGetLibrary(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetLibraryCompleted(object state) {
            if ((this.GetLibraryCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetLibraryCompleted(this, new GetLibraryCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetLibraryAsync(string mediapath) {
            this.GetLibraryAsync(mediapath, null);
        }
        
        public void GetLibraryAsync(string mediapath, object userState) {
            if ((this.onBeginGetLibraryDelegate == null)) {
                this.onBeginGetLibraryDelegate = new BeginOperationDelegate(this.OnBeginGetLibrary);
            }
            if ((this.onEndGetLibraryDelegate == null)) {
                this.onEndGetLibraryDelegate = new EndOperationDelegate(this.OnEndGetLibrary);
            }
            if ((this.onGetLibraryCompletedDelegate == null)) {
                this.onGetLibraryCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetLibraryCompleted);
            }
            base.InvokeAsync(this.onBeginGetLibraryDelegate, new object[] {
                        mediapath}, this.onEndGetLibraryDelegate, this.onGetLibraryCompletedDelegate, userState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult SilverTunes.MediaLibrary.MediaLibrarySoap.BeginDir(SilverTunes.MediaLibrary.DirRequest request, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginDir(request, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.IAsyncResult BeginDir(string path, System.AsyncCallback callback, object asyncState) {
            SilverTunes.MediaLibrary.DirRequest inValue = new SilverTunes.MediaLibrary.DirRequest();
            inValue.Body = new SilverTunes.MediaLibrary.DirRequestBody();
            inValue.Body.path = path;
            return ((SilverTunes.MediaLibrary.MediaLibrarySoap)(this)).BeginDir(inValue, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        SilverTunes.MediaLibrary.DirResponse SilverTunes.MediaLibrary.MediaLibrarySoap.EndDir(System.IAsyncResult result) {
            return base.Channel.EndDir(result);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private SilverTunes.MediaLibrary.ArrayOfString EndDir(System.IAsyncResult result) {
            SilverTunes.MediaLibrary.DirResponse retVal = ((SilverTunes.MediaLibrary.MediaLibrarySoap)(this)).EndDir(result);
            return retVal.Body.DirResult;
        }
        
        private System.IAsyncResult OnBeginDir(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string path = ((string)(inValues[0]));
            return this.BeginDir(path, callback, asyncState);
        }
        
        private object[] OnEndDir(System.IAsyncResult result) {
            SilverTunes.MediaLibrary.ArrayOfString retVal = this.EndDir(result);
            return new object[] {
                    retVal};
        }
        
        private void OnDirCompleted(object state) {
            if ((this.DirCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.DirCompleted(this, new DirCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void DirAsync(string path) {
            this.DirAsync(path, null);
        }
        
        public void DirAsync(string path, object userState) {
            if ((this.onBeginDirDelegate == null)) {
                this.onBeginDirDelegate = new BeginOperationDelegate(this.OnBeginDir);
            }
            if ((this.onEndDirDelegate == null)) {
                this.onEndDirDelegate = new EndOperationDelegate(this.OnEndDir);
            }
            if ((this.onDirCompletedDelegate == null)) {
                this.onDirCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnDirCompleted);
            }
            base.InvokeAsync(this.onBeginDirDelegate, new object[] {
                        path}, this.onEndDirDelegate, this.onDirCompletedDelegate, 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 SilverTunes.MediaLibrary.MediaLibrarySoap CreateChannel() {
            return new MediaLibrarySoapClientChannel(this);
        }
        
        private class MediaLibrarySoapClientChannel : ChannelBase<SilverTunes.MediaLibrary.MediaLibrarySoap>, SilverTunes.MediaLibrary.MediaLibrarySoap {
            
            public MediaLibrarySoapClientChannel(System.ServiceModel.ClientBase<SilverTunes.MediaLibrary.MediaLibrarySoap> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetLibrary(SilverTunes.MediaLibrary.GetLibraryRequest request, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = request;
                System.IAsyncResult _result = base.BeginInvoke("GetLibrary", _args, callback, asyncState);
                return _result;
            }
            
            public SilverTunes.MediaLibrary.GetLibraryResponse EndGetLibrary(System.IAsyncResult result) {
                object[] _args = new object[0];
                SilverTunes.MediaLibrary.GetLibraryResponse _result = ((SilverTunes.MediaLibrary.GetLibraryResponse)(base.EndInvoke("GetLibrary", _args, result)));
                return _result;
            }
            
            public System.IAsyncResult BeginDir(SilverTunes.MediaLibrary.DirRequest request, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = request;
                System.IAsyncResult _result = base.BeginInvoke("Dir", _args, callback, asyncState);
                return _result;
            }
            
            public SilverTunes.MediaLibrary.DirResponse EndDir(System.IAsyncResult result) {
                object[] _args = new object[0];
                SilverTunes.MediaLibrary.DirResponse _result = ((SilverTunes.MediaLibrary.DirResponse)(base.EndInvoke("Dir", _args, result)));
                return _result;
            }
        }
    }
}
