Status | ID | Priority | Type |
Closed | 33961 | Major | Question |
Profile | Reply |
gabossoloClient | Hi ! Could you please to help me on how to refresh listView after executed a ManagedOperation ? Thank you! |
User | Description | Posted On |
MariyaVoytovichAgent | Hello gabossolo! Can I get more information? Regards, | |
gabossoloClient | Hi Mariya, For example if I excuted a ManagedOperation from a SimpleAction Excute method. Code: private void ManifestActionOnExecute(object sender, SimpleActionExecuteEventArgs e) | |
MariyaVoytovichAgent | 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, | |
gabossoloClient | 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) | |
MariyaVoytovichAgent | 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, | |
gabossoloClient | Still not working.... | |
MariyaVoytovichAgent | Can you send me a small demo project, reproducing the problem. Regards, | |
gabossoloClient | Hi Mariya -- Please find attached a demo project. Thanks for your support. Regards, | |
gabossoloClient | Hi Mariya -- Please find attached a demo project. Thanks for your support. Regards, Attached files: | |
MariyaVoytovichAgent | Hello gabossolo! Sorry for the delay with the answer. I check your project and made changes to it. Regards, Attached files: | |
gabossoloClient | Working fine now!!! Thank you very much. |