IsolatedAppClickThroughUI.cs :  » Installers-Generators » WiX » Microsoft » Tools » WindowsInstallerXml » Extensions » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Installers Generators » WiX 
WiX » Microsoft » Tools » WindowsInstallerXml » Extensions » IsolatedAppClickThroughUI.cs
//-------------------------------------------------------------------------------------------------
// <copyright file="IsolatedAppClickThroughUI.cs" company="Microsoft">
//    Copyright (c) Microsoft Corporation.  All rights reserved.
//    
//    The use and distribution terms for this software are covered by the
//    Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
//    which can be found in the file CPL.TXT at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//    
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
// Isolated application ClickThrough UI extension.
// </summary>
//-------------------------------------------------------------------------------------------------

namespace Microsoft.Tools.WindowsInstallerXml.Extensions{
    using System;
    using System.ComponentModel;
    using System.Windows.Forms;

    using Microsoft.Tools.WindowsInstallerXml.Extensions.IsolatedApp;

    /// <summary>
    /// Creates a new isolated app ClickThrough UI extension.
    /// </summary>
    public sealed class IsolatedAppClickThroughUI : ClickThroughUIExtension
    {
        private IsolatedAppFabricator fabricator;
        private ClickThrough.BrowsePathStep step1;
        private ClickThrough.PickEntryStep step2;
        private ClickThrough.PackageInfoStep step3;
        private ClickThrough.FeedStep step4;
        private ClickThrough.UpdateInfoStep step5;
        private ClickThrough.BuildStep step6;
        private Control[] controls;

        /// <summary>
        /// Creates a new IsolatedAppClickThroughConsole.
        /// </summary>
        public IsolatedAppClickThroughUI()
        {
            this.fabricator = new IsolatedAppFabricator();
            this.fabricator.Changed += this.FabricatorProperty_Changed;
            this.fabricator.Opened += this.FabricatorProperty_Opened;
        }

        /// <summary>
        /// Gets the fabrictor for this extension.
        /// </summary>
        /// <value>Fabricator for IsolatedApp Add-in.</value>
        public override Fabricator Fabricator
        {
            get { return this.fabricator; }
        }

        /// <summary>
        /// Gets the UI Controls for this fabricator.
        /// </summary>
        /// <returns>Array of controls that make up the steps to feed the fabricator data.</returns>
        public override Control[] GetControls()
        {
            if (null == this.controls)
            {
                this.step1 = new ClickThrough.BrowsePathStep();
                this.step1.Fabricator = this.fabricator;
                this.step1.Changed += this.StepProperty_Changed;

                this.step2 = new ClickThrough.PickEntryStep();
                this.step2.Fabricator = this.fabricator;
                this.step2.Changed += this.StepProperty_Changed;

                this.step3 = new ClickThrough.PackageInfoStep();
                this.step3.Fabricator = this.fabricator;
                this.step3.Changed += this.StepProperty_Changed;

                this.step4 = new ClickThrough.FeedStep();
                this.step4.Fabricator = this.fabricator;
                this.step4.Changed += this.StepProperty_Changed;

                this.step5 = new ClickThrough.UpdateInfoStep();
                this.step5.Fabricator = this.fabricator;
                this.step5.Changed += this.StepProperty_Changed;

                this.step6 = new ClickThrough.BuildStep();
                this.step6.Fabricator = this.fabricator;

                this.controls = new Control[] { this.step1, this.step2, this.step3, this.step4, this.step5, this.step6 };
            }

            return this.controls;
        }

        /// <summary>
        /// Event handler for when the fabricator's property ("model" for this "controller") changes.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void FabricatorProperty_Changed(object sender, PropertyChangedEventArgs e)
        {
            if (sender == this.fabricator)
            {
                switch (e.PropertyName)
                {
                    case "Source":
                        this.step1.Source = this.fabricator.Source;
                        this.step2.Source = this.fabricator.Source;
                        break;

                    case "EntryPoint":
                        this.step2.EntryPoint = this.fabricator.EntryPoint;

                        this.step3.Description = this.fabricator.Description;
                        this.step3.Manufacturer = this.fabricator.Manufacturer;
                        this.step3.ApplicationName = this.fabricator.Name;
                        this.step3.Version = this.fabricator.ApplicationVersion;
                        break;
                    case "Description":
                        this.step3.Description = this.fabricator.Description;
                        break;
                    case "Manufacturer":
                        this.step3.Manufacturer = this.fabricator.Manufacturer;
                        break;
                    case "Name":
                        this.step3.ApplicationName = this.fabricator.Name;
                        break;
                    case "ApplicationVersion":
                        this.step3.Version = this.fabricator.ApplicationVersion;
                        break;
                    case "UpdateUrl":
                        this.step4.UpdateUri = this.fabricator.UpdateUrl.AbsoluteUri;
                        this.step5.UpdateUri = this.fabricator.UpdateUrl.AbsoluteUri;
                        this.step6.UpdateUri = this.fabricator.UpdateUrl;
                        break;
                    case "UpdateRate":
                        this.step4.UpdateRate = this.fabricator.UpdateRate;
                        break;
                }
            }
        }

        /// <summary>
        /// Event handler for when the fabricator ("model" for this "controller") is opened.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void FabricatorProperty_Opened(object sender, EventArgs e)
        {
            if (sender == this.fabricator)
            {
                this.step1.Source = this.fabricator.Source;

                this.step2.EntryPoint = this.fabricator.EntryPoint;
                this.step2.Source = this.fabricator.Source;

                this.step3.Description = this.fabricator.Description;
                this.step3.Manufacturer = this.fabricator.Manufacturer;
                this.step3.ApplicationName = this.fabricator.Name;
                this.step3.Version = this.fabricator.ApplicationVersion;

                this.step4.UpdateUri = this.fabricator.UpdateUrl.AbsoluteUri;
                this.step4.UpdateRate = this.fabricator.UpdateRate;

                this.step5.UpdateUri = this.fabricator.UpdateUrl.AbsoluteUri;
                this.step5.PreviousFeedUri = this.fabricator.PreviousFeedUrl;

                this.step6.UpdateUri = this.fabricator.UpdateUrl;
            }
        }

        /// <summary>
        /// Event handler for when any step's property ("view" for this "controller") changes.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void StepProperty_Changed(object sender, PropertyChangedEventArgs e)
        {
            if (this.step1 == sender)
            {
                this.fabricator.Source = step1.Source;
            }
            else if (this.step2 == sender)
            {
                this.fabricator.EntryPoint = this.step2.EntryPoint;
            }
            else if (this.step3 == sender)
            {
                switch (e.PropertyName)
                {
                    case "Description":
                        this.fabricator.Description = this.step3.Description;
                        break;
                    case "Manufacturer":
                        this.fabricator.Manufacturer = this.step3.Manufacturer;
                        break;
                    case "ApplicationName":
                        this.fabricator.Name = this.step3.ApplicationName;
                        break;
                    case "Version":
                        this.fabricator.ApplicationVersion = this.step3.Version;
                        break;
                }
            }
            else if (this.step4 == sender)
            {
                switch (e.PropertyName)
                {
                    case "UpdateUri":
                        if (null != this.step4.UpdateUri)
                        {
                            this.fabricator.UpdateUrl = new Uri(this.step4.UpdateUri);
                        }
                        break;
                    case "UpdateRate":
                        this.fabricator.UpdateRate = this.step4.UpdateRate;
                        break;
                }
            }
            else if (this.step5 == sender)
            {
                switch (e.PropertyName)
                {
                    case "PreviousFeedUri":
                        this.fabricator.PreviousFeedUrl = this.step5.PreviousFeedUri;
                        break;
                }
            }
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.