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

Integrate Reporting Services with Silverlight and RIA Services

, 28 Jul 2010
Integrate Reporting Services with your Silverlight Line-of-Business applications.
ReportingServicesDemo.zip
ReportingServicesDemo
ReportingServicesDemo
Assets
Resources
Bin
Controls
Generated_Code
Models
Shared
Helpers
Libs
System.Windows.Controls.Data.DataForm.Toolkit.dll
Models
Properties
DataSources
ReportingServicesDemo.Web.ADWLTDomainContext.datasource
ReportingServicesDemo.Web.UserRegistrationContext.datasource
ReportingServicesDemo.csproj.user
Views
Login
Web
Resources
ReportingServicesDemo.Web
ADWLTModel.edmx
App_Data
bin
ClientBin
ReportingServicesDemo.xap
DemoReport.rdlc
Models
Shared
Properties
ReportingServicesDemo.Web.csproj.user
Resources
Services
namespace ReportingServicesDemo.LoginUI
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ServiceModel.DomainServices.Client;
    using System.ServiceModel.DomainServices.Client.ApplicationServices;
    using System.Windows;
    using System.Windows.Controls;

    /// <summary>
    /// <see cref="ChildWindow"/> class that controls the registration process.
    /// </summary>
    public partial class LoginRegistrationWindow : ChildWindow
    {
        private IList<OperationBase> possiblyPendingOperations = new List<OperationBase>();

        /// <summary>
        /// Creates a new <see cref="LoginRegistrationWindow"/> instance.
        /// </summary>
        public LoginRegistrationWindow()
        {
            InitializeComponent();

            this.registrationForm.SetParentWindow(this);
            this.loginForm.SetParentWindow(this);

            this.LayoutUpdated += this.GoToInitialState;
            this.LayoutUpdated += this.UpdateTitle;
        }

        /// <summary>
        /// Initializes the <see cref="VisualStateManager"/> for this component
        /// by putting it into the "AtLogin" state
        /// </summary>
        private void GoToInitialState(object sender, EventArgs eventArgs)
        {
            VisualStateManager.GoToState(this, "AtLogin", false);
            this.LayoutUpdated -= this.GoToInitialState;
        }

        /// <summary>
        /// Updates the window title according to which panel
        /// (registration / login) is currently being displayed
        /// </summary>
        private void UpdateTitle(object sender, EventArgs eventArgs)
        {
            this.Title = (this.registrationForm.Visibility == Visibility.Visible) ?
                ApplicationStrings.RegistrationWindowTitle :
                ApplicationStrings.LoginWindowTitle;
        }

        /// <summary>
        /// Notifies the <see cref="LoginRegistrationWindow"/> window that it can only close
        /// if <paramref name="operation"/> is finished or can be cancelled
        /// </summary>
        /// <param name="operation">The pending operation to monitor</param>
        public void AddPendingOperation(OperationBase operation)
        {
            this.possiblyPendingOperations.Add(operation);
        }

        /// <summary>
        /// Causes the <see cref="VisualStateManager"/> to change to the "AtLogin" state.
        /// </summary>
        public virtual void NavigateToLogin()
        {
            VisualStateManager.GoToState(this, "AtLogin", true);
        }

        /// <summary>
        /// Causes the <see cref="VisualStateManager"/> to change to the "AtRegistration" state.
        /// </summary>
        public virtual void NavigateToRegistration()
        {
            VisualStateManager.GoToState(this, "AtRegistration", true);
        }

        /// <summary>
        /// Prevents the window from closing while there are operations in progress
        /// </summary>
        private void LoginWindow_Closing(object sender, CancelEventArgs eventArgs)
        {
            foreach (OperationBase operation in this.possiblyPendingOperations)
            {
                if (!operation.IsComplete)
                {
                    if (operation.CanCancel)
                    {
                        operation.Cancel();
                    }
                    else
                    {
                        eventArgs.Cancel = true;
                    }
                }
            }
        }
    }
}

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)

Share

About the Author

Ernesto Herrera
Web Developer Sigo S.A.
Venezuela Venezuela
Ernesto Herrera is a Senior Developer, Architect with more than 12 years experience, actually working with Silverlight Line-of-Bussiness Applications, he holds a MCTS Web Application 2.0 Certification, and have a wide experience with sql server since the 6.5 version, on his free time he likes to play tennis with his wife,kids and friends, also enjoy playing Wii with his sons, he works at Sigo S.A., a retail business located at Margarita Island, Venezuela.
Follow on   Twitter

| Advertise | Privacy | Mobile
Web02 | 2.8.140922.1 | Last Updated 28 Jul 2010
Article Copyright 2010 by Ernesto Herrera
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid