I have the problem with data transfer - i have a wpf application with a splash screen which is runs in App class before main frame is loaded. This Splash is a dialog and App is a static class - how is it possible to pass the data from splash dialog to mainframe maybe via App.. or there is other way?
Asked
Active
Viewed 305 times
1 Answers
1
An event could pass the data about.
public App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var splash = new Splash();
var main = new Main();
splash.SplashViewFinished += (s, data) => {
main.Data = data;
//code to show main..
};
//code to show splash...
}
}
public class Splash : Window
{
public event EventHandler<SplashDataArgs> SplashViewFinished;
}
public class SplashDataArgs: EventArgs
{
}
Or you could use the mediator pattern. Like the Messenger
class in MVVM light
Handling Dialogs in WPF with MVVM
http://mvvmlight.codeplex.com/discussions/209338?ProjectName=mvvmlight