Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Silverlight Database Deep Zoom

, 26 Mar 2009
The article describes how to create a Deep Zoom image and store the tiles in a database, and how to read the image from the database and display it in the browser.
DatabaseDeepZoom.zip
DatabaseDeepZoom.root
DatabaseDeepZoom
DatabaseDeepZoom.csproj.user
Properties
Settings.settings
Search Image.ico
DbDzComposer
Properties
scopeDbDz.csproj.user
DeepZoomSilverlightProject
DeepZoomSilverlightProject.csproj.user
fullscreen_hover.png
fullscreen_pressed.png
fullscreen_rest.png
home_hover.png
home_pressed.png
home_rest.png
Properties
Service References
ImageListClient
configuration.svcinfo
configuration91.svcinfo
DeepZoomSilverlightProject.ImageListClient.ImageInfo.datasource
ImageListService.disco
ImageListService.wsdl
ImageListService1.wsdl
Reference.svcmap
ServiceReferences.ClientConfig
zoomin_hover.png
zoomin_pressed.png
zoomin_rest.png
zoomout_hover.png
zoomout_pressed.png
zoomout_rest.png
DeepZoomSilverlightWeb
App_Data
DeepZoom.mdb
bin
de
es
fr
it
ja
ko
zh-Hans
zh-Hant
ClientBin
DeepZoomSilverlightProject.xap
DeepZoomSilverlightWeb.csproj.user
ImageListService.svc
Properties
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     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 DeepZoomSilverlightProject.ImageListClient {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="ImageInfo", Namespace="http://schemas.datacontract.org/2004/07/DbDzComposer")]
    public partial class ImageInfo : object, System.ComponentModel.INotifyPropertyChanged {
        
        private int HeightField;
        
        private int ImageIdField;
        
        private string ImageNameField;
        
        private string MimeTypeField;
        
        private int OverlapField;
        
        private string ThumbnailUrlField;
        
        private int TileSizeField;
        
        private int WidthField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int Height {
            get {
                return this.HeightField;
            }
            set {
                if ((this.HeightField.Equals(value) != true)) {
                    this.HeightField = value;
                    this.RaisePropertyChanged("Height");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int ImageId {
            get {
                return this.ImageIdField;
            }
            set {
                if ((this.ImageIdField.Equals(value) != true)) {
                    this.ImageIdField = value;
                    this.RaisePropertyChanged("ImageId");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string ImageName {
            get {
                return this.ImageNameField;
            }
            set {
                if ((object.ReferenceEquals(this.ImageNameField, value) != true)) {
                    this.ImageNameField = value;
                    this.RaisePropertyChanged("ImageName");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string MimeType {
            get {
                return this.MimeTypeField;
            }
            set {
                if ((object.ReferenceEquals(this.MimeTypeField, value) != true)) {
                    this.MimeTypeField = value;
                    this.RaisePropertyChanged("MimeType");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int Overlap {
            get {
                return this.OverlapField;
            }
            set {
                if ((this.OverlapField.Equals(value) != true)) {
                    this.OverlapField = value;
                    this.RaisePropertyChanged("Overlap");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string ThumbnailUrl {
            get {
                return this.ThumbnailUrlField;
            }
            set {
                if ((object.ReferenceEquals(this.ThumbnailUrlField, value) != true)) {
                    this.ThumbnailUrlField = value;
                    this.RaisePropertyChanged("ThumbnailUrl");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int TileSize {
            get {
                return this.TileSizeField;
            }
            set {
                if ((this.TileSizeField.Equals(value) != true)) {
                    this.TileSizeField = value;
                    this.RaisePropertyChanged("TileSize");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public int Width {
            get {
                return this.WidthField;
            }
            set {
                if ((this.WidthField.Equals(value) != true)) {
                    this.WidthField = value;
                    this.RaisePropertyChanged("Width");
                }
            }
        }
        
        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="ImageListClient.ImageListService")]
    public interface ImageListService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:ImageListService/GetImageList", ReplyAction="urn:ImageListService/GetImageListResponse")]
        System.IAsyncResult BeginGetImageList(System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> EndGetImageList(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface ImageListServiceChannel : DeepZoomSilverlightProject.ImageListClient.ImageListService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetImageListCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetImageListCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class ImageListServiceClient : System.ServiceModel.ClientBase<DeepZoomSilverlightProject.ImageListClient.ImageListService>, DeepZoomSilverlightProject.ImageListClient.ImageListService {
        
        private BeginOperationDelegate onBeginGetImageListDelegate;
        
        private EndOperationDelegate onEndGetImageListDelegate;
        
        private System.Threading.SendOrPostCallback onGetImageListCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public ImageListServiceClient() {
        }
        
        public ImageListServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public ImageListServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ImageListServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ImageListServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public event System.EventHandler<GetImageListCompletedEventArgs> GetImageListCompleted;
        
        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 DeepZoomSilverlightProject.ImageListClient.ImageListService.BeginGetImageList(System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetImageList(callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> DeepZoomSilverlightProject.ImageListClient.ImageListService.EndGetImageList(System.IAsyncResult result) {
            return base.Channel.EndGetImageList(result);
        }
        
        private System.IAsyncResult OnBeginGetImageList(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((DeepZoomSilverlightProject.ImageListClient.ImageListService)(this)).BeginGetImageList(callback, asyncState);
        }
        
        private object[] OnEndGetImageList(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> retVal = ((DeepZoomSilverlightProject.ImageListClient.ImageListService)(this)).EndGetImageList(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetImageListCompleted(object state) {
            if ((this.GetImageListCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetImageListCompleted(this, new GetImageListCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetImageListAsync() {
            this.GetImageListAsync(null);
        }
        
        public void GetImageListAsync(object userState) {
            if ((this.onBeginGetImageListDelegate == null)) {
                this.onBeginGetImageListDelegate = new BeginOperationDelegate(this.OnBeginGetImageList);
            }
            if ((this.onEndGetImageListDelegate == null)) {
                this.onEndGetImageListDelegate = new EndOperationDelegate(this.OnEndGetImageList);
            }
            if ((this.onGetImageListCompletedDelegate == null)) {
                this.onGetImageListCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetImageListCompleted);
            }
            base.InvokeAsync(this.onBeginGetImageListDelegate, null, this.onEndGetImageListDelegate, this.onGetImageListCompletedDelegate, 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 DeepZoomSilverlightProject.ImageListClient.ImageListService CreateChannel() {
            return new ImageListServiceClientChannel(this);
        }
        
        private class ImageListServiceClientChannel : ChannelBase<DeepZoomSilverlightProject.ImageListClient.ImageListService>, DeepZoomSilverlightProject.ImageListClient.ImageListService {
            
            public ImageListServiceClientChannel(System.ServiceModel.ClientBase<DeepZoomSilverlightProject.ImageListClient.ImageListService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetImageList(System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[0];
                System.IAsyncResult _result = base.BeginInvoke("GetImageList", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> EndGetImageList(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo> _result = ((System.Collections.ObjectModel.ObservableCollection<DeepZoomSilverlightProject.ImageListClient.ImageInfo>)(base.EndInvoke("GetImageList", _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)

About the Author

Joerg Lang
CEO
Switzerland Switzerland
I have my own software company called Evelix (www.evelix.ch). The company is located in Liestal, Switzerland. I develop software for the web and the desktop. Every now and then I give computer classes in a learning institution.
 
I was born in 1966, am married and have one kid. Hobbies are Fasnacht (www.bmg.bs), skiing and of course computers.
 
Actually I studied mechanical engineering and have a bachelors degree in it, but computers interested me since I had a Commodore C128. In the meantime my mobile has a thousand times more memory than my computers back then. First I started programming in Basic. After that I did use Pascal for a while, but the real (commercial) programming started with VB3. Now I do programming in C# and sometimes still in VB6 when I have to support an older application.
 
Currently I'm working towards my Microsoft Certified Trainer status.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 26 Mar 2009
Article Copyright 2009 by Joerg Lang
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid