/// <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>
        /// 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>
        /// Actions related with the Service response event from the associated service.
        /// Refresh the instance and reload the service context
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void ProcessAssociatedServiceControllerServiceResponse(object sender, ServiceResultEventArgs e)
        {
            if (!e.Success)
            {
                return;
            }

            // Refresh the shown instance
            Refresh();

            // Reload the service controller
            SetInstanceToAssociatedService(DisplaySet.Values);
        }
        /// <summary>
        /// Raises the ServiceResponse event
        /// </summary>
        /// <param name="eventArgs"></param>
        protected virtual void OnServiceResponse(ServiceResultEventArgs eventArgs)
        {
            EventHandler<ServiceResultEventArgs> handler = ServiceResponse;

            if (handler != null)
            {
                handler(this, eventArgs);
            }
        }
        /// <summary>
        /// Actions related with the Service response event from the associated service.
        /// Refresh the instance and reload the service context
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void ProcessAssociatedServiceControllerServiceResponse(object sender, ServiceResultEventArgs e)
        {
            if (!e.Success)
            {
                return;
            }

            // Refresh the shown instance
            Refresh();

            // Reload the service controller
            SetInstanceToAssociatedService(DisplaySet.Values);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Handles the ServiceResponse event from the associated service
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleAssociatedServiceControllerServiceResponse(object sender, ServiceResultEventArgs e)
 {
     ProcessAssociatedServiceControllerServiceResponse(sender, e);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Actions related with the Service Response event from the associated service
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ProcessAssociatedServiceControllerServiceResponse(object sender, ServiceResultEventArgs e)
        {
            // if no success
            if (e.Success)
            {
                // Refresh the Query controller, the received instances
                RefreshOidList(e.ExchangeInfoReceived.SelectedOids);

                // Refresh the DataGrid.
                Refresh();

                // Clear and disable the associated service.
                if (AssociatedServiceController != null && Logic.Agent.IsActiveFacet(AssociatedServiceController.Agents))
                {
                    EnableAssociatedService(false);
                }
            }
        }