//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     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 TreeViewSelfReferenceWCFService.ServiceReference1 {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="MyDataTable", Namespace="http://schemas.datacontract.org/2004/07/TreeViewSelfReferenceWCFService.Web")]
    public partial class MyDataTable : object, System.ComponentModel.INotifyPropertyChanged {
        
        private int IDField;
        
        private string TextField;

		private int ParentIDField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int ID {
            get {
                return this.IDField;
            }
            set {
                if ((object.ReferenceEquals(this.IDField, value) != true)) {
                    this.IDField = value;
                    this.RaisePropertyChanged("ID");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Text {
            get {
                return this.TextField;
            }
            set {
                if ((object.ReferenceEquals(this.TextField, value) != true)) {
                    this.TextField = value;
                    this.RaisePropertyChanged("Text");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(Order=2)]
        public int ParentID {
            get {
                return this.ParentIDField;
            }
            set {
                if ((object.ReferenceEquals(this.ParentIDField, value) != true)) {
                    this.ParentIDField = value;
                    this.RaisePropertyChanged("ParentID");
                }
            }
        }
        
        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(ConfigurationName="ServiceReference1.IMyService")]
    public interface IMyService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IMyService/GetMyData", ReplyAction="http://tempuri.org/IMyService/GetMyDataResponse")]
        System.IAsyncResult BeginGetMyData(System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> EndGetMyData(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IMyServiceChannel : TreeViewSelfReferenceWCFService.ServiceReference1.IMyService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetMyDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetMyDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class MyServiceClient : System.ServiceModel.ClientBase<TreeViewSelfReferenceWCFService.ServiceReference1.IMyService>, TreeViewSelfReferenceWCFService.ServiceReference1.IMyService {
        
        private BeginOperationDelegate onBeginGetMyDataDelegate;
        
        private EndOperationDelegate onEndGetMyDataDelegate;
        
        private System.Threading.SendOrPostCallback onGetMyDataCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public MyServiceClient() {
        }
        
        public MyServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public MyServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MyServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public MyServiceClient(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<GetMyDataCompletedEventArgs> GetMyDataCompleted;
        
        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 TreeViewSelfReferenceWCFService.ServiceReference1.IMyService.BeginGetMyData(System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetMyData(callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> TreeViewSelfReferenceWCFService.ServiceReference1.IMyService.EndGetMyData(System.IAsyncResult result) {
            return base.Channel.EndGetMyData(result);
        }
        
        private System.IAsyncResult OnBeginGetMyData(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((TreeViewSelfReferenceWCFService.ServiceReference1.IMyService)(this)).BeginGetMyData(callback, asyncState);
        }
        
        private object[] OnEndGetMyData(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> retVal = ((TreeViewSelfReferenceWCFService.ServiceReference1.IMyService)(this)).EndGetMyData(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetMyDataCompleted(object state) {
            if ((this.GetMyDataCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetMyDataCompleted(this, new GetMyDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetMyDataAsync() {
            this.GetMyDataAsync(null);
        }
        
        public void GetMyDataAsync(object userState) {
            if ((this.onBeginGetMyDataDelegate == null)) {
                this.onBeginGetMyDataDelegate = new BeginOperationDelegate(this.OnBeginGetMyData);
            }
            if ((this.onEndGetMyDataDelegate == null)) {
                this.onEndGetMyDataDelegate = new EndOperationDelegate(this.OnEndGetMyData);
            }
            if ((this.onGetMyDataCompletedDelegate == null)) {
                this.onGetMyDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetMyDataCompleted);
            }
            base.InvokeAsync(this.onBeginGetMyDataDelegate, null, this.onEndGetMyDataDelegate, this.onGetMyDataCompletedDelegate, 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 TreeViewSelfReferenceWCFService.ServiceReference1.IMyService CreateChannel() {
            return new MyServiceClientChannel(this);
        }
        
        private class MyServiceClientChannel : ChannelBase<TreeViewSelfReferenceWCFService.ServiceReference1.IMyService>, TreeViewSelfReferenceWCFService.ServiceReference1.IMyService {
            
            public MyServiceClientChannel(System.ServiceModel.ClientBase<TreeViewSelfReferenceWCFService.ServiceReference1.IMyService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetMyData(System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[0];
                System.IAsyncResult _result = base.BeginInvoke("GetMyData", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> EndGetMyData(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable> _result = ((System.Collections.ObjectModel.ObservableCollection<TreeViewSelfReferenceWCFService.ServiceReference1.MyDataTable>)(base.EndInvoke("GetMyData", _args, result)));
                return _result;
            }
        }
    }
}
