djcouchycouch
djcouchycouch

Reputation: 12834

File has been modified? Now to handle in WPF?

What's the best way to tell my application that the file has been modified and that it should ask the user for a filename? Is there a class for that or do I write that all that logic by hand?

Thanks!

Upvotes: 1

Views: 154

Answers (2)

Nick Randell
Nick Randell

Reputation: 18295

Another solution is something I've seen recently. If setting a modified flag on your 'file' object is difficult, you could always try saving to a memory stream and calculating a hash on it, and if the hash is different to the original version's hash, it has changed.

It's not as elegant as setting a modified flag, but is much easier to retrofit.

Upvotes: 0

Greg D
Greg D

Reputation: 44066

You'll need to handle that logic by hand. It's not too difficult if you've got a decent application architecture working for you. Just flip a Modified flag on your "file" object that gets serialized to disk whenever the object is mutated.

Upvotes: 2

Related Questions