New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling SaveViewModelAsync() twice #1226

Open
RCP161 opened this Issue Oct 19, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@RCP161

RCP161 commented Oct 19, 2018

If I use the CancelViewModelAsync() Method, the ViewModel doesn't get the PropertyChanged of the Model anymore. So if I edit the ViewModel again, the changes will be written to the Model, but changes on other Properties will not be shown in the ViewModel.
Addtional to that, if i call CancelViewModelAsync() the second time, nothing happend.

Steps to reproduce

Done in this TestRepo: https://github.com/RCP161/IDataObjectTest/tree/master/M1Vm2

  1. Start the program and change one value. Leave the field, so that the Property updates. The State TextBlock changes.
  2. Click Revert to call CancelViewModelAsync() and change the value again.

=> The TextBlock does not change the state anymore. You can trace the problem in the output window.

  1. Click Revert again.

=> Nothing happened.

Platform:
.NET version: 4.6.1

Expected behaviour

The ViewModel should still listen on the PropertyChanged of the Model.
The CancelViewModelAsync (or SaveViewModelAsync) should be called more times than one.

Actual behaviour

ViewModel dosen't listen to the PropertyChanged of the Model anymore.
Can't call ((System.ComponentModel.IEditableObject)this).BeginEdit(); to use the functionality again. So nothing happened.

@GeertvanHorrik

This comment has been minimized.

Member

GeertvanHorrik commented Oct 22, 2018

A model only has a single backup at a time. We don't have plans to support multiple backup scenarios at the same time.

@RCP161

This comment has been minimized.

RCP161 commented Oct 22, 2018

You don’t have to do this as default.
What I need to know is, how I can create a new backup, so that I can call it by myself. The problem is, that it doesn't work, like it is described in the comment of this answer and here in the actual behavior with the ((System.ComponentModel.IEditableObject)this).BeginEdit();.
Also, I need the behavior, that the ViewModel should listen to the Model, until it is not needed anymore. For Example, if the usercontrol will be unloaded or so.

Or what is the common scenario for this? Have I to change the view after calling cancel or save?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment