tags:

views:

120

answers:

1

Hello, How can I undo send, save or delete in Vb like Gmail is using this feature in Messages. The feature used by Gmail is they are queing the message for 5 secs and if the user clicks on Undo before that 5secs the whole send process is pulled back.

Now what I want is to implement this same in my Vb.net application. Is there any code available to do this. Please help ?

+11  A: 

About an "undo send" feature, the most evident way of doing that is to actually not "do" what you want to "undo".

What I mean is :

  • When a user clicks on "send", you should not really send the message
  • Instead, you should mark it as "to send in X seconds" -- place it in some queue, for instance
  • Which means it'll only be sent after X seconds, and not immediatly.
  • During this X number of seconds, if the user clicks "undo send", you just have to remove that mail from the "waiting queue"

Of course, you cannot "undo send" on a mail which has already been sent : it's gone from your server, and there is nothing you can do anymore about it.

To implement that, you'll need :

  • Some queue for actions
  • To place your data into this queue when the user clicks "send"
  • To have some batch that really sends data that's been in the queue for more than X seconds
  • To remove the data from the queue when the user clicks "undo send".


The same idea can be applied to "undo delete" :

  • When a user clicks on "delete", don't physicilly delete the data
  • Instead, use some boolean flag to indicate that it should be considered as deleted
  • Then, un-doping that deletion only means de-activating that flag

This can easily be implemented in any language :

  • Add a is_deleted field on your data
  • When displaying the data, filter those for which this flag is enabled
  • When deleting, instead of physically deleting, set this flag
  • When un-deleting, un-set this flag


The "undo save" can be a bit harder : a solution would be to not keep only one version of the message, but several :

  • Each time the user clicks "save", you should store a new version of the message
  • Which means you'll end up, after some time, with many versions of the message
  • Which will allow you to "come back" to a previous version, restoring it from the history.

This can be done :

  • adding a new field called like "version" on your data.
  • each time the user saves, just increment that field, and store a copy of the data
  • i.e. never actually update any exiting data, but always insert a new version of it.
  • then, "undo save" only means "get the previous version of the data"
Pascal MARTIN
Yes i know that , I cannot undo send, but my point over here is can I do this in VB?
ahmed
@ahmed Yes of course
Yacoby
thank you ...thank you
ahmed
Sorry, I don't know VB, actually -- But I don't see why it couldn't be done : the ideas I wrote should be developped using almost any kind of programming language *(I will not be able to give any technical detail for VB, though... )*
Pascal MARTIN
+1. You have written a detailed spec for the code. The only way to go further would be to actually write the code, which seems excessive.
MarkJ