//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3074
//
//     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 2.0.5.0
// 
namespace TrailerPlayer.MovieSearchServiceReference {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="Movie", Namespace="http://schemas.datacontract.org/2004/07/TrailerPlayer.Web")]
    public partial class Movie : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string CastField;
        
        private string DescriptionField;
        
        private string DirectorField;
        
        private string PictureField;
        
        private string SourceField;
        
        private string ThumbField;
        
        private string TitleField;
        
        private string TypeField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Cast {
            get {
                return this.CastField;
            }
            set {
                if ((object.ReferenceEquals(this.CastField, value) != true)) {
                    this.CastField = value;
                    this.RaisePropertyChanged("Cast");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Description {
            get {
                return this.DescriptionField;
            }
            set {
                if ((object.ReferenceEquals(this.DescriptionField, value) != true)) {
                    this.DescriptionField = value;
                    this.RaisePropertyChanged("Description");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Director {
            get {
                return this.DirectorField;
            }
            set {
                if ((object.ReferenceEquals(this.DirectorField, value) != true)) {
                    this.DirectorField = value;
                    this.RaisePropertyChanged("Director");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Picture {
            get {
                return this.PictureField;
            }
            set {
                if ((object.ReferenceEquals(this.PictureField, value) != true)) {
                    this.PictureField = value;
                    this.RaisePropertyChanged("Picture");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Source {
            get {
                return this.SourceField;
            }
            set {
                if ((object.ReferenceEquals(this.SourceField, value) != true)) {
                    this.SourceField = value;
                    this.RaisePropertyChanged("Source");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Thumb {
            get {
                return this.ThumbField;
            }
            set {
                if ((object.ReferenceEquals(this.ThumbField, value) != true)) {
                    this.ThumbField = value;
                    this.RaisePropertyChanged("Thumb");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        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()]
        public string Type {
            get {
                return this.TypeField;
            }
            set {
                if ((object.ReferenceEquals(this.TypeField, value) != true)) {
                    this.TypeField = value;
                    this.RaisePropertyChanged("Type");
                }
            }
        }
        
        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", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="", ConfigurationName="MovieSearchServiceReference.MovieSearchService")]
    public interface MovieSearchService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:MovieSearchService/Search", ReplyAction="urn:MovieSearchService/SearchResponse")]
        System.IAsyncResult BeginSearch(string key, System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> EndSearch(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface MovieSearchServiceChannel : TrailerPlayer.MovieSearchServiceReference.MovieSearchService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class SearchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public SearchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class MovieSearchServiceClient : System.ServiceModel.ClientBase<TrailerPlayer.MovieSearchServiceReference.MovieSearchService>, TrailerPlayer.MovieSearchServiceReference.MovieSearchService {
        
        private BeginOperationDelegate onBeginSearchDelegate;
        
        private EndOperationDelegate onEndSearchDelegate;
        
        private System.Threading.SendOrPostCallback onSearchCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public MovieSearchServiceClient() {
        }
        
        public MovieSearchServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public MovieSearchServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MovieSearchServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MovieSearchServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public event System.EventHandler<SearchCompletedEventArgs> SearchCompleted;
        
        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 TrailerPlayer.MovieSearchServiceReference.MovieSearchService.BeginSearch(string key, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginSearch(key, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> TrailerPlayer.MovieSearchServiceReference.MovieSearchService.EndSearch(System.IAsyncResult result) {
            return base.Channel.EndSearch(result);
        }
        
        private System.IAsyncResult OnBeginSearch(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string key = ((string)(inValues[0]));
            return ((TrailerPlayer.MovieSearchServiceReference.MovieSearchService)(this)).BeginSearch(key, callback, asyncState);
        }
        
        private object[] OnEndSearch(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> retVal = ((TrailerPlayer.MovieSearchServiceReference.MovieSearchService)(this)).EndSearch(result);
            return new object[] {
                    retVal};
        }
        
        private void OnSearchCompleted(object state) {
            if ((this.SearchCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.SearchCompleted(this, new SearchCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void SearchAsync(string key) {
            this.SearchAsync(key, null);
        }
        
        public void SearchAsync(string key, object userState) {
            if ((this.onBeginSearchDelegate == null)) {
                this.onBeginSearchDelegate = new BeginOperationDelegate(this.OnBeginSearch);
            }
            if ((this.onEndSearchDelegate == null)) {
                this.onEndSearchDelegate = new EndOperationDelegate(this.OnEndSearch);
            }
            if ((this.onSearchCompletedDelegate == null)) {
                this.onSearchCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnSearchCompleted);
            }
            base.InvokeAsync(this.onBeginSearchDelegate, new object[] {
                        key}, this.onEndSearchDelegate, this.onSearchCompletedDelegate, 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 TrailerPlayer.MovieSearchServiceReference.MovieSearchService CreateChannel() {
            return new MovieSearchServiceClientChannel(this);
        }
        
        private class MovieSearchServiceClientChannel : ChannelBase<TrailerPlayer.MovieSearchServiceReference.MovieSearchService>, TrailerPlayer.MovieSearchServiceReference.MovieSearchService {
            
            public MovieSearchServiceClientChannel(System.ServiceModel.ClientBase<TrailerPlayer.MovieSearchServiceReference.MovieSearchService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginSearch(string key, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = key;
                System.IAsyncResult _result = base.BeginInvoke("Search", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> EndSearch(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie> _result = ((System.Collections.ObjectModel.ObservableCollection<TrailerPlayer.MovieSearchServiceReference.Movie>)(base.EndInvoke("Search", _args, result)));
                return _result;
            }
        }
    }
}
