c# - Design pattern for single window with multiple views -
i have window contain multiple subviews. example, @ start-up user presented login screen , when user presses 'login' (and succeeds) window should updated new view.
currently have created window in xaml (the main window) , page, added frame of window. idea when user presses login, notify main window , tell login success , should change view else. common task , triggered both subviews , other actions (such interaction menu bar). right approach?
if so, how notify main window subview finished? also, uses page subview; correct?
one goal project me learn mvvm, mvvm-motivation of answer appreciated!
thanks in advance!
xaml mainwindow
<window x:class="cast.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525" > <frame source="/loginpage.xaml"/> </window>
i think view inheritance friend in pursuit. should think basic operations views need share. example, if database app may conceivably have methods or events such as:
beforeinsert afterinsert beforeupdate afterupdate beforecancel aftercancel onerror ... ...
for view switching basic operations be:
onviewload onviewunload validate ...
then place code in generic manner base view baseview class. after have base view can make normal views inherit baseview's functionality. can further model creating basedataview:baseview in introduce generic database ui operations such validation.
your main form primarly work base or super class such ((baseview)currentview).validateform() , on , fourth.
Comments
Post a Comment