I have a Windows Phone 7.5/Silverlight app.
I have some code that I duplicate in some sense on most of my pages.
e.g. of Code duplication:
1: OnNavigatedTo – I Stop animations, clear BackStack, add event handlers(same ones on each page), etc.
2: OnNaviateFrom – I Stop animations and set them to null, remove event handlers, stop all sounds, dispose soundffects and instances,etc.
3: OnInitilalizeComponent – I set up my SoundEffects
4: On image click I play SoundEffects
So what would be the best way so I don’t have to replicate the code in all pages?
I was thinking of somekind of base class or page?
Any ideas really appreciated. Thanks.
If you are doing the same thing in each page then a base Page class makes perfect sense.