/// <summary>
        /// Raises the RefreshMasterRequired event.
        /// </summary>
        /// <param name="eventArgs"></param>
        protected void OnRefreshMasterRequired(RefreshRequiredMasterEventArgs eventArgs)
        {
            EventHandler <RefreshRequiredMasterEventArgs> handler = RefreshMasterRequired;

            if (handler != null)
            {
                handler(this, eventArgs);
            }
        }
        /// <summary>
        /// This method refreshes the parent controller after the succesfull execution of a service.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">ServiceResultEventArgs</param>
        private void HandleServiceResponse(object sender, ServiceResultEventArgs e)
        {
            // If the service has been executed succesfully, refresh the Parent controller.
            if (e.Success)
            {
                // Refresh the Master.
                if (RefreshMaster)
                {
                    RefreshRequiredMasterEventArgs eventArgsRefreshMaster = new RefreshRequiredMasterEventArgs(e.ExchangeInfoReceived);
                    // Main scenario must be closed or not
                    eventArgsRefreshMaster.CloseScenario = CloseScenario;
                    OnRefreshRequired(eventArgsRefreshMaster);
                    // If Master has been refreshed, do nothing.
                    if (eventArgsRefreshMaster.RefreshDone)
                    {
                        return;
                    }
                }
                // Refresh mode. Depending on the local flag, the number of intances, the service type and its definition class:
                //  If the service type is not Creation and its definition class is the same as the selected instances class,
                //  then refresh only the selected instances. The number of selected instances has to be lesser or equals than 5.
                //  Other case, refresh complete population.
                RefreshRequiredEventArgs eventArgs = new RefreshRequiredEventArgs(e.ExchangeInfoReceived);

                if (RefreshByRow &&
                    e.ExchangeInfoReceived != null &&
                    ActionItemType != ActionItemType.Creation &&
                    e.ExchangeInfoReceived.SelectedOids != null &&
                    e.ExchangeInfoReceived.SelectedOids.Count > 0 &&
                    e.ExchangeInfoReceived.SelectedOids.Count < 5)
                {
                    string lInstancesClass = e.ExchangeInfoReceived.SelectedOids[0].ClassName;
                    if (lInstancesClass.Equals(this.ClassIUName, StringComparison.OrdinalIgnoreCase))
                    {
                        eventArgs = new RefreshRequiredInstancesEventArgs(e.ExchangeInfoReceived.SelectedOids, e.ExchangeInfoReceived);
                    }
                }

                // Main scenario must be closed or not
                eventArgs.CloseScenario = CloseScenario;

                // Raise the event.
                OnRefreshRequired(eventArgs);
            }
        }
 /// <summary>
 /// Handles the RefeshMasterRequired from one detail
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleDetailRefreshMasterRequired(object sender, RefreshRequiredMasterEventArgs e)
 {
     if (RefreshMasterRequired != null)
     {
         RefreshRequiredMasterEventArgs args = new RefreshRequiredMasterEventArgs(Master.ExchangeInformation);
         OnRefreshMasterRequired(args);
         if (args.RefreshDone)
         {
             e.RefreshDone = true;
             return;
         }
     }
     // Refresh the Master
     if (Master.Context.SelectedOids != null && Master.Context.SelectedOids.Count > 0)
     {
         bool lRefreshSuccess = Master.RefreshOidList(Master.Context.SelectedOids);
         if (Master.Context.RelatedOids != null &&
             Master.Context.RelatedOids.Count == 1)
         {
             Master.OnRefreshRequired(new RefreshRequiredInstancesEventArgs(Master.Context.RelatedOids, null));
         }
         e.RefreshDone = lRefreshSuccess;
     }
 }
        /// <summary>
        /// This method refreshes the parent controller after the succesfull execution of a service.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">ServiceResultEventArgs</param>
        private void HandleServiceResponse(object sender, ServiceResultEventArgs e)
        {
            // If the service has been executed succesfully, refresh the Parent controller.
            if (e.Success)
            {
                // Refresh the Master.
                if (RefreshMaster)
                {
                    RefreshRequiredMasterEventArgs eventArgsRefreshMaster = new RefreshRequiredMasterEventArgs(e.ExchangeInfoReceived);
                    // Main scenario must be closed or not
                    eventArgsRefreshMaster.CloseScenario = CloseScenario;
                    OnRefreshRequired(eventArgsRefreshMaster);
                    // If Master has been refreshed, do nothing.
                    if (eventArgsRefreshMaster.RefreshDone)
                    {
                        return;
                    }
                }
                // Refresh mode. Depending on the local flag, the number of intances, the service type and its definition class:
                //  If the service type is not Creation and its definition class is the same as the selected instances class,
                //  then refresh only the selected instances. The number of selected instances has to be lesser or equals than 5.
                //  Other case, refresh complete population.
                RefreshRequiredEventArgs eventArgs = new RefreshRequiredEventArgs(e.ExchangeInfoReceived);

                if (RefreshByRow &&
                    e.ExchangeInfoReceived != null &&
                    ActionItemType != ActionItemType.Creation &&
                    e.ExchangeInfoReceived.SelectedOids != null &&
                    e.ExchangeInfoReceived.SelectedOids.Count > 0 &&
                    e.ExchangeInfoReceived.SelectedOids.Count < 5)
                {
                    string lInstancesClass = e.ExchangeInfoReceived.SelectedOids[0].ClassName;
                    if (lInstancesClass.Equals(this.ClassIUName, StringComparison.OrdinalIgnoreCase))
                    {
                        eventArgs = new RefreshRequiredInstancesEventArgs(e.ExchangeInfoReceived.SelectedOids, e.ExchangeInfoReceived);
                    }
                }

                // Main scenario must be closed or not
                eventArgs.CloseScenario = CloseScenario;

                // Raise the event.
                OnRefreshRequired(eventArgs);
            }
        }
 /// <summary>
 /// Handles the RefreshMasterRequired event from its Master
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleMasterRefreshMasterRequired(object sender, RefreshRequiredMasterEventArgs e)
 {
     // Propagate the Event
     OnRefreshMasterRequired(e);
 }
 /// <summary>
 /// Handles the RefreshMasterRequired event from its Master
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleMasterRefreshMasterRequired(object sender, RefreshRequiredMasterEventArgs e)
 {
     // Propagate the Event
     OnRefreshMasterRequired(e);
 }
 /// <summary>
 /// Handles the RefeshMasterRequired from one detail
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleDetailRefreshMasterRequired(object sender, RefreshRequiredMasterEventArgs e)
 {
     if (RefreshMasterRequired != null)
     {
         RefreshRequiredMasterEventArgs args = new RefreshRequiredMasterEventArgs(Master.ExchangeInformation);
         OnRefreshMasterRequired(args);
         if (args.RefreshDone)
         {
             e.RefreshDone = true;
             return;
         }
     }
     // Refresh the Master
     if (Master.Context.SelectedOids != null && Master.Context.SelectedOids.Count > 0)
     {
         bool lRefreshSuccess = Master.RefreshOidList(Master.Context.SelectedOids);
         if (Master.Context.RelatedOids != null &&
             Master.Context.RelatedOids.Count == 1)
         {
             Master.OnRefreshRequired(new RefreshRequiredInstancesEventArgs(Master.Context.RelatedOids, null));
         }
         e.RefreshDone = lRefreshSuccess;
     }
 }
        /// <summary>
        /// Raises the RefreshMasterRequired event.
        /// </summary>
        /// <param name="eventArgs"></param>
        protected void OnRefreshMasterRequired(RefreshRequiredMasterEventArgs eventArgs)
        {
            EventHandler<RefreshRequiredMasterEventArgs> handler = RefreshMasterRequired;

            if (handler != null)
            {
                handler(this, eventArgs);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Process the refresh required from navigation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ProcessNavigationRefreshRequired(object sender, RefreshRequiredEventArgs e)
        {
            // Refresh Master
            RefreshRequiredMasterEventArgs lArgs = new RefreshRequiredMasterEventArgs(Context.ExchangeInformation);
            OnRefreshMasterRequired(lArgs);
            // If refresh has been done, do nothing
            if (lArgs.RefreshDone)
                return;

            // Default refresh
            ProcessActionRefreshRequired(sender, e);
        }