Restart application required to update information

Viewed 96

I have a windows forms application in the mvc pattern, where I have a controller call to retrieve the information I need, which in this case is if the application movement was terminated.

The controller call is normally done like this:

_listMoviment = new MovimentController().GetRelationMoviment(UserLogged.companyCode);

which calls this method on the controller:

    public List<Moviment> GetRelationMoviment(short companyCode)
    {
        return RepositorioBase.GetRelationMoviment(companyCode);
    }

which by the way calls this method in the repository:

    public List<Moviment> GetRelationMoviment(short companyCode)
    {
        return EntityRepository.Include(x => x.Operator)
                                  .Where(x => x.CompanyCode == companyCode &&
                                              x.CompanyCodeMoviment == null)
                                  .ToList();

    }

and this flow is working normally, but it only updates the information if I restart the application, is there any way to force this update without having to restart?

1 Answers

Once you have got the data back into your Windows Form you need to redraw the form to update the data.

Take a look at this link here which should explain how to refresh. You will have to put this after the API call has completed, otherwise you might get into issues where it refreshes and nothing appears due to an ongoing API call.

Also these links might help you too:

Related