/// <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> /// Related actions with the Execute Apply Previous event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void ProcessExecuteApplyPrevious(object sender, TriggerEventArgs e) { if (ApplyPreviousTrigger != null && ApplyPreviousTrigger.Enabled && ApplyPreviousTrigger.Visible) { // Execute the service. if (!ExecuteService(true)) { return; } // Refresh the current instance. RefreshRequiredInstancesEventArgs arguments = new RefreshRequiredInstancesEventArgs(Context.ExchangeInformation.SelectedOids, Context.ExchangeInformation); OnRefreshRequired(arguments); // Move to the previous intance. Execute_GoNextPrevious(false); } }
/// <summary> /// Related actions with the Execute Apply event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void ProcessExecuteApply(object sender, TriggerEventArgs e) { if (ApplyTrigger != null && ApplyTrigger.Enabled && ApplyTrigger.Visible) { // Execute the service. if (!ExecuteService(true)) { return; } // Refresh the current instance. RefreshRequiredInstancesEventArgs arguments = new RefreshRequiredInstancesEventArgs(Context.ExchangeInformation.SelectedOids, Context.ExchangeInformation); OnRefreshRequired(arguments); // Disable the Apply and Ok buttons. ApplyTrigger.Enabled = false; OkTrigger.Enabled = false; } }