| Status | ID | Priority | Type |
| Closed | 33961 | Major | Question |
| Profile | Reply |
|
gabossolo
Client
|
Hi ! Could you please to help me on how to refresh listView after executed a ManagedOperation ? Thank you! |
| User | Description | Posted On |
|
MariyaVoytovich
Agent
|
Hello gabossolo! Can I get more information? Regards, |
|
|
gabossolo
Client
|
Hi Mariya, For example if I excuted a ManagedOperation from a SimpleAction Excute method. Code: private void ManifestActionOnExecute(object sender, SimpleActionExecuteEventArgs e) |
|
|
MariyaVoytovich
Agent
|
Hello gabossolo! Sorry for the delay with the answer. To refresh the list view after executing ManagedOperation, you need to subscribe to the Finalized event of the Managed Operation. Regards, |
|
|
gabossolo
Client
|
Hi Mariya -- I tried but nothing happened. My listView has not been updated. Here is my code: --- Controller private void ExecuteManifestActionOnExecute(object sender, SimpleActionExecuteEventArgs e) var managedOperation = new ManagedOperation(Application) private void ManagedOperationOnFinalized(object sender, EventArgs e) --- ManagedOp public class ManifestExecutionOperation public ManifestExecutionOperation(ArrayList selectedObjects) public void Execute(IManagedOperation operation) |
|
|
MariyaVoytovich
Agent
|
I looked at your code. By default, Managed Operations are performed in the background thread. --- Controller
private void ExecuteManifestActionOnExecute(object sender, SimpleActionExecuteEventArgs e) { var selectedObjects = new ArrayList(e.SelectedObjects); var operation = new ManifestExecutionOperation(selectedObjects);var managedOperation = new ManagedOperation(Application) { Name = CargoAirModuleLocalizer.Active.GetLocalizedString( CargoAirModuleItemsStringId.ManifestExecutionOperation), ProcessCode = operation.Execute, ZoneType = ManagedOperationZoneTypes.Local, TotalStep = selectedObjects.Count, TraceLevel = TraceLevel.Verbose }; managedOperation.Start(); managedOperation.Finalized += ManagedOperationOnFinalized; SyncManagedOperationHelper.CreateHelper(managedOperation) .InitShowViewParametersProgress(e.ShowViewParameters, true); }private void ManagedOperationOnFinalized(object sender, EventArgs e) { this.View.ObjectSpace.CommitChanges(); this.View.Refresh(); } }--- ManagedOp public class ManifestExecutionOperation { private readonly ArrayList _selectedObjects; public ManifestExecutionOperation(ArrayList selectedObjects) public void Execute(IManagedOperation operation) foreach (Manifest manifest in _selectedObjects) The same operations can be performed in the main thread. private void ExecuteManifestActionOnExecute(object sender, SimpleActionExecuteEventArgs e)
{ var selectedObjects = new ArrayList(e.SelectedObjects); var operation = new ManifestExecutionOperation(selectedObjects);var managedOperation = new ManagedOperation(Application, Guid.NewGuid(), false) { Name = CargoAirModuleLocalizer.Active.GetLocalizedString( CargoAirModuleItemsStringId.ManifestExecutionOperation), ProcessCode = operation.Execute, ZoneType = ManagedOperationZoneTypes.Local, TotalStep = selectedObjects.Count, TraceLevel = TraceLevel.Verbose, }; SyncManagedOperationHelper.CreateHelper(managedOperation) To change operation then it is not necessary. Regards, |
|
|
gabossolo
Client
|
Still not working.... |
|
|
MariyaVoytovich
Agent
|
Can you send me a small demo project, reproducing the problem. Regards, |
|
|
gabossolo
Client
|
Hi Mariya -- Please find attached a demo project. Thanks for your support. Regards, |
|
|
gabossolo
Client
|
Hi Mariya -- Please find attached a demo project. Thanks for your support. Regards, Attached files: |
|
|
MariyaVoytovich
Agent
|
Hello gabossolo! Sorry for the delay with the answer. I check your project and made changes to it. Regards, Attached files: |
|
|
gabossolo
Client
|
Working fine now!!! Thank you very much. |
Write US