Click here to Skip to main content
15,896,402 members
Articles / Programming Languages / C#

An Introduction to the Silverlight samples in the All-In-One Framework

Rate me:
Please Sign up or sign in to vote.
5.00/5 (26 votes)
12 Dec 2009Ms-PL5 min read 55.5K   2.2K   56  
This article introduces several Silverlight samples in the All-In-One Framework.
//------------------------------------------------------------------------------
// <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 3.0.40624.0
// 
namespace CSSL3DeepZoom.DeepZoomServiceReference {
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="http://code.fx/", ConfigurationName="DeepZoomServiceReference.IGenerateDeepZoomService")]
    public interface IGenerateDeepZoomService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://code.fx/IGenerateDeepZoomService/PrepareDeepZoom", ReplyAction="http://code.fx/IGenerateDeepZoomService/PrepareDeepZoomResponse")]
        System.IAsyncResult BeginPrepareDeepZoom(bool forceGenerateDeepZoom, System.AsyncCallback callback, object asyncState);
        
        bool EndPrepareDeepZoom(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IGenerateDeepZoomServiceChannel : CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class PrepareDeepZoomCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public PrepareDeepZoomCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public bool Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((bool)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GenerateDeepZoomServiceClient : System.ServiceModel.ClientBase<CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService>, CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService {
        
        private BeginOperationDelegate onBeginPrepareDeepZoomDelegate;
        
        private EndOperationDelegate onEndPrepareDeepZoomDelegate;
        
        private System.Threading.SendOrPostCallback onPrepareDeepZoomCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public GenerateDeepZoomServiceClient() {
        }
        
        public GenerateDeepZoomServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public GenerateDeepZoomServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public GenerateDeepZoomServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public GenerateDeepZoomServiceClient(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<PrepareDeepZoomCompletedEventArgs> PrepareDeepZoomCompleted;
        
        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 CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService.BeginPrepareDeepZoom(bool forceGenerateDeepZoom, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginPrepareDeepZoom(forceGenerateDeepZoom, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        bool CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService.EndPrepareDeepZoom(System.IAsyncResult result) {
            return base.Channel.EndPrepareDeepZoom(result);
        }
        
        private System.IAsyncResult OnBeginPrepareDeepZoom(object[] inValues, System.AsyncCallback callback, object asyncState) {
            bool forceGenerateDeepZoom = ((bool)(inValues[0]));
            return ((CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService)(this)).BeginPrepareDeepZoom(forceGenerateDeepZoom, callback, asyncState);
        }
        
        private object[] OnEndPrepareDeepZoom(System.IAsyncResult result) {
            bool retVal = ((CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService)(this)).EndPrepareDeepZoom(result);
            return new object[] {
                    retVal};
        }
        
        private void OnPrepareDeepZoomCompleted(object state) {
            if ((this.PrepareDeepZoomCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.PrepareDeepZoomCompleted(this, new PrepareDeepZoomCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void PrepareDeepZoomAsync(bool forceGenerateDeepZoom) {
            this.PrepareDeepZoomAsync(forceGenerateDeepZoom, null);
        }
        
        public void PrepareDeepZoomAsync(bool forceGenerateDeepZoom, object userState) {
            if ((this.onBeginPrepareDeepZoomDelegate == null)) {
                this.onBeginPrepareDeepZoomDelegate = new BeginOperationDelegate(this.OnBeginPrepareDeepZoom);
            }
            if ((this.onEndPrepareDeepZoomDelegate == null)) {
                this.onEndPrepareDeepZoomDelegate = new EndOperationDelegate(this.OnEndPrepareDeepZoom);
            }
            if ((this.onPrepareDeepZoomCompletedDelegate == null)) {
                this.onPrepareDeepZoomCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnPrepareDeepZoomCompleted);
            }
            base.InvokeAsync(this.onBeginPrepareDeepZoomDelegate, new object[] {
                        forceGenerateDeepZoom}, this.onEndPrepareDeepZoomDelegate, this.onPrepareDeepZoomCompletedDelegate, 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 CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService CreateChannel() {
            return new GenerateDeepZoomServiceClientChannel(this);
        }
        
        private class GenerateDeepZoomServiceClientChannel : ChannelBase<CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService>, CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService {
            
            public GenerateDeepZoomServiceClientChannel(System.ServiceModel.ClientBase<CSSL3DeepZoom.DeepZoomServiceReference.IGenerateDeepZoomService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginPrepareDeepZoom(bool forceGenerateDeepZoom, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = forceGenerateDeepZoom;
                System.IAsyncResult _result = base.BeginInvoke("PrepareDeepZoom", _args, callback, asyncState);
                return _result;
            }
            
            public bool EndPrepareDeepZoom(System.IAsyncResult result) {
                object[] _args = new object[0];
                bool _result = ((bool)(base.EndInvoke("PrepareDeepZoom", _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 Microsoft Public License (Ms-PL)


Written By
China China
Microsoft All-In-One Code Framework delineates the framework and skeleton of Microsoft development techniques through typical sample codes in three popular programming languages (Visual C#, VB.NET, Visual C++). Each sample is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used coding scenario based on our support experience in MSDN newsgroups and forums. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer's question coincides with what we collected.
http://cfx.codeplex.com/

Comments and Discussions