Esempio n. 1
0
#pragma warning restore 649

        /// <summary>
        /// Initializes a new instance of the <see cref="ModuleTracker"/> class.
        /// </summary>
        public ModuleTracker()
        {
            // These states are defined specifically for the desktop version of the quickstart.
            this.loginRegionTrackingState = new ModuleTrackingState
            {
                ModuleName = ModuleNames.Login,
                ExpectedDiscoveryMethod    = DiscoveryMethod.DirectorySweep,
                ExpectedInitializationMode = InitializationMode.OnDemand,
                ExpectedDownloadTiming     = DownloadTiming.InBackground
            };

            this.asideRegionTrackingState = new ModuleTrackingState
            {
                ModuleName = ModuleNames.Aside,
                ExpectedDiscoveryMethod    = DiscoveryMethod.DirectorySweep,
                ExpectedInitializationMode = InitializationMode.OnDemand,
                ExpectedDownloadTiming     = DownloadTiming.InBackground,
            };
            this.footerRegionTrackingState = new ModuleTrackingState
            {
                ModuleName = ModuleNames.Footer,
                ExpectedDiscoveryMethod    = DiscoveryMethod.ApplicationReference,
                ExpectedInitializationMode = InitializationMode.OnDemand,
                ExpectedDownloadTiming     = DownloadTiming.InBackground,
            };
            this.headerRegionTrackingState = new ModuleTrackingState
            {
                ModuleName = ModuleNames.Header,
                ExpectedDiscoveryMethod    = DiscoveryMethod.DirectorySweep,
                ExpectedInitializationMode = InitializationMode.OnDemand,
                ExpectedDownloadTiming     = DownloadTiming.InBackground,
            };
        }
Esempio n. 2
0
        /// <summary>
        /// Records the module has been initialized.
        /// </summary>
        /// <param name="moduleName">The <see cref="WellKnownModuleNames">well-known name</see> of the module.</param>
        public void RecordModuleInitialized(string moduleName)
        {
            ModuleTrackingState moduleTrackingState = this.GetModuleTrackingState(moduleName);

            if (moduleTrackingState != null)
            {
                moduleTrackingState.ModuleInitializationStatus = ModuleInitializationStatus.Initialized;
            }

            this.logger.Log(string.Format("{0} module initialized.", moduleName), Category.Debug, Priority.Low);
        }
Esempio n. 3
0
        private void OnDataContextChanged()
        {
            if (this.moduleTrackingState != null)
            {
                this.moduleTrackingState.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(this.ModuleTrackingState_PropertyChanged);
            }

            this.moduleTrackingState = this.DataContext as ModuleTrackingState;

            if (this.moduleTrackingState != null)
            {
                this.moduleTrackingState.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.ModuleTrackingState_PropertyChanged);
            }

            this.UpdateClickToLoadTextBlockVisibility();
            this.UpdateLoadProgressTextBlockVisibility();
        }
Esempio n. 4
0
        /// <summary>
        /// Records the module is loading.
        /// </summary>
        /// <param name="moduleName">The <see cref="WellKnownModuleNames">well-known name</see> of the module.</param>
        /// <param name="bytesReceived">The number of bytes downloaded.</param>
        /// <param name="totalBytesToReceive">The total number of bytes expected.</param>
        public void RecordModuleDownloading(string moduleName, long bytesReceived, long totalBytesToReceive)
        {
            ModuleTrackingState moduleTrackingState = this.GetModuleTrackingState(moduleName);

            if (moduleTrackingState != null)
            {
                moduleTrackingState.BytesReceived       = bytesReceived;
                moduleTrackingState.TotalBytesToReceive = totalBytesToReceive;

                if (bytesReceived < totalBytesToReceive)
                {
                    moduleTrackingState.ModuleInitializationStatus = ModuleInitializationStatus.Downloading;
                }
                else
                {
                    moduleTrackingState.ModuleInitializationStatus = ModuleInitializationStatus.Downloaded;
                }
            }

            this.logger.Log(
                string.Format("'{0}' module is loading {1}/{2} bytes.", moduleName, bytesReceived, totalBytesToReceive),
                Category.Debug,
                Priority.Low);
        }