Provides completion information after a module is loaded, or fails to load.
Inheritance: System.EventArgs
 private void RaiseLoadModuleCompleted(LoadModuleCompletedEventArgs e)
 {
     if (this.LoadModuleCompleted != null)
     {
         this.LoadModuleCompleted(this, e);
     }
 }
        /// <summary>
        /// Check for IServiceComponent modules being loaded, and when one is found, give it a child container and add it to the list
        /// </summary>
        /// <param name="e"></param>
        public void OnModuleLoaded(LoadModuleCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                try
                {
                    // get type for reflection only
                    Type moduleType = Type.GetType(e.ModuleInfo.ModuleType);

                    if (typeof(IServiceComponent).IsAssignableFrom(moduleType))
                    {
                        IServiceComponent serviceComponent = (IServiceComponent)Container.Resolve(moduleType);
                        if (e.ModuleInfo is ExtendedModuleInfo)
                            serviceComponent.ID = ((ExtendedModuleInfo)e.ModuleInfo).ModuleID;
                        Container.RegisterInstance<IServiceComponent>(e.ModuleInfo.ModuleName, serviceComponent, new ContainerControlledLifetimeManager());

                        // add to service component collection
                        ServiceComponents.Add(serviceComponent);

                        // create a child container for the component
                        serviceComponent.ComponentContainer = Container.CreateChildContainer();

                        // initialize the component
                        serviceComponent.InitializeComponent();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("Error handling module load in service component manager.", ex);
                }
            }
        }
Example #3
0
 private void OnModuleLoadComplete(LoadModuleCompletedEventArgs e)
 {
     try
      {
          regionManger.RequestNavigate(RegionNames.MainRegion, new Uri("Home",UriKind.Relative));
      }
      catch (NullReferenceException ex)
      {
          return;
      }
 }
 /// <summary>
 /// Handles the LoadModuleCompleted event of the ModuleManager control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Practices.Composite.Modularity.LoadModuleCompletedEventArgs"/> instance containing the event data.</param>
 private void ModuleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     if (this.Actions.ContainsKey(e.ModuleInfo.ModuleName))
     {
         System.Windows.Application.Current.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
         {
             this.Actions[e.ModuleInfo.ModuleName].BeginInvoke(null, null);
         }));
     }
     Debug.WriteLine(e.IsErrorHandled.ToString());
 }
Example #5
0
        private void IModuleTypeLoader_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if ((e.ModuleInfo.State != ModuleState.Initializing) && (e.ModuleInfo.State != ModuleState.Initialized))
                {
                    e.ModuleInfo.State = ModuleState.ReadyForInitialization;
                }

                // This callback may call back on the UI thread, but we are not guaranteeing it.
                // If you were to add a custom retriever that retrieved in the background, you
                // would need to consider dispatching to the UI thread.
                this.LoadModulesThatAreReadyForLoad();
            }
            else
            {
                this.RaiseLoadModuleCompleted(e);

                // If the error is not handled then I log it and raise an exception.
                if (!e.IsErrorHandled)
                {
                    this.HandleModuleTypeLoadingError(e.ModuleInfo, e.Error);
                }
            }
        }
Example #6
0
 void WindowLoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     _moduleTracker.RecordModuleLoaded(e.ModuleInfo.ModuleName);
 }
Example #7
0
 /// <summary>
 /// Handles the LoadModuleCompleted event of the ModuleManager control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Practices.Composite.Modularity.LoadModuleCompletedEventArgs"/> instance containing the event data.</param>
 private void ModuleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     this.moduleTracker.RecordModuleLoaded(e.ModuleInfo.ModuleName);
 }        
Example #8
0
 private void OnModulesLoaded(object sender, LoadModuleCompletedEventArgs e)
 {
     var providers = Container.ResolveAll<IDataProvider>();
     var restServices = Container.ResolveAll<IRestService>();
 }
 /// <summary>
 /// Called when the load module is completed.
 /// </summary>
 /// <param name="e">The event argument.</param>
 private void OnLoadModuleCompleted(LoadModuleCompletedEventArgs e)
 {
     LoadModuleCompleted.SafeInvoke(this, e);
 }
        void ModuleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
        {
            if (e.ModuleInfo.ModuleName == "ContactsModule")
            {
                Uri contactsUri = new Uri("/ContactsView", UriKind.Relative);
                _regionManager.RequestNavigate("ModuleRegion", contactsUri);
            }
            else if (e.ModuleInfo.ModuleName == "CustomersModule")
            {
                Uri customersUri = new Uri("/FinanceView", UriKind.Relative);
                _regionManager.RequestNavigate("ModuleRegion", customersUri);

            }
            IsBusy = false;
        }
Example #11
0
 /// <summary>
 /// fire when a module get loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnLoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     _logger.Log(e.ModuleInfo.ModuleName + " loaded !", Category.Debug, Priority.Low);
 }
Example #12
0
 /// <summary>
 /// 每个模块加载完毕都会调用的方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void moduleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     if (this.ModuleCatalog.Modules.Count(t => t.State == ModuleState.Initialized) == this.ModuleCatalog.Modules.Count())
     {
         var eventAggregator = this.Container.Resolve<IEventAggregator>();
         eventAggregator.GetEvent<AllModulesLoadedEvent>().Publish(this);
     }            
 }
Example #13
0
 /// <summary>
 /// 应用模块加载完成后的操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void moduleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     this.IsFuncEnabled = true;
 }
Example #14
0
 /// <summary>
 /// Called when a module loading process is completed
 /// </summary>
 /// <param name="sender">The module type loade</param>
 /// <param name="loadModuleCompletedEventArgs">The event argument</param>
 private void ModuleManagerOnLoadModuleCompleted(object sender, LoadModuleCompletedEventArgs loadModuleCompletedEventArgs)
 {
     string moduleName = loadModuleCompletedEventArgs.ModuleInfo.ModuleName;
     ModuleTemplate moduleTemplate = Modules.FirstOrDefault(template => template.ModuleName == moduleName);
     if (moduleTemplate != null)
     {
         moduleTemplate.RaisePropertyChanged(() => moduleTemplate.Enabled);
         moduleTemplate.RaisePropertyChanged(() => moduleTemplate.State);
     }
   
     lock (_syncObj)
     {
         _modules.Remove(moduleName);
         if (_modules.Count == 0)
         {
             _isLoading = false;
             _pleaseWaitService.Hide();
         }
     }
 }
Example #15
0
 private void ModuleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     Messenger.Default.Send<LoadModuleCompletedEventArgs>(e);
 }
Example #16
0
 /// <summary>
 ///     应用模块加载完成后的操作
 /// </summary>
 private void moduleManager_LoadModuleCompleted(object sender, LoadModuleCompletedEventArgs e)
 {
     switch (e.ModuleInfo.ModuleName)
     {
         case "CommonServiceModule":
             var menuItemCommonService = Items.SingleOrDefault(m => m.Text == "文档库");
             if (menuItemCommonService != null)
                 menuItemCommonService.IsEnabled = true;
             break;
         case "BaseManagementModule":
             var menuItemBaseManagement = Items.SingleOrDefault(m => m.Text == "基础管理");
             if (menuItemBaseManagement != null)
                 menuItemBaseManagement.IsEnabled = true;
             break;
         case "PortalModule":
             var menuItemPortal = Items.SingleOrDefault(m => m.Text == "管理门户");
             if (menuItemPortal != null)
                 menuItemPortal.IsEnabled = true;
             OnHome(null);
             break;
         case "FleetPlanModule":
             var menuItemFleetPlan = Items.SingleOrDefault(m => m.Text == "运力规划");
             if (menuItemFleetPlan != null)
                 menuItemFleetPlan.IsEnabled = true;
             break;
         case "PurchaseModule":
             var menuItemPurchase = Items.SingleOrDefault(m => m.Text == "采购合同");
             if (menuItemPurchase != null)
                 menuItemPurchase.IsEnabled = true;
             break;
         case "PaymentModule":
             var menuItemPayment = Items.SingleOrDefault(m => m.Text == "应付款");
             if (menuItemPayment != null)
                 menuItemPayment.IsEnabled = true;
             break;
         case "ProjectModule":
             var menuItemProject = Items.SingleOrDefault(m => m.Text == "项目管理");
             if (menuItemProject != null)
                 menuItemProject.IsEnabled = true;
             break;
         case "AircraftConfigModule":
             var menuItemAircraftConfig = Items.SingleOrDefault(m => m.Text == "飞机构型");
             if (menuItemAircraftConfig != null)
                 menuItemAircraftConfig.IsEnabled = true;
             break;
         case "PartModule":
             var menuItemPart = Items.SingleOrDefault(m => m.Text == "附件管理");
             if (menuItemPart != null)
                 menuItemPart.IsEnabled = true;
             var menuItemEngine = Items.SingleOrDefault(m => m.Text == "发动机管理");
             if (menuItemEngine != null)
                 menuItemEngine.IsEnabled = true;
             var menuItemAirworthiness = Items.SingleOrDefault(m => m.Text == "适航管理");
             if (menuItemAirworthiness != null)
                 menuItemAirworthiness.IsEnabled = true;
             break;
         default:
             throw new ArgumentException("没有匹配的模块名称!");
     }
 }