A
Alex
This is a question of style I guess..
I have something like this:
if (ShowDialog()) {
if (Dialog->ShowMessage(...) == KEY_OK) // User pressed ok button
PerformAction();
}
else
PerformAction();
--
The idea is that if ShowDialog() is true, then the program shows a dialog
with some info before proceeding. Otherwise, the action is performed
immediately.
What I don't like is repeating the PerformAction() sentence.. is there a way
to avoid this more 'elegantly'? I mean, refactoring in a way to make
PerformAction() appear only once, regardless the ShowDialog() return value?
Thanks in advance.
I have something like this:
if (ShowDialog()) {
if (Dialog->ShowMessage(...) == KEY_OK) // User pressed ok button
PerformAction();
}
else
PerformAction();
--
The idea is that if ShowDialog() is true, then the program shows a dialog
with some info before proceeding. Otherwise, the action is performed
immediately.
What I don't like is repeating the PerformAction() sentence.. is there a way
to avoid this more 'elegantly'? I mean, refactoring in a way to make
PerformAction() appear only once, regardless the ShowDialog() return value?
Thanks in advance.