Skip to content

Instantly share code, notes, and snippets.

@julesx
Created April 27, 2015 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/dadc7dfa20089aaec0b1 to your computer and use it in GitHub Desktop.
Save julesx/dadc7dfa20089aaec0b1 to your computer and use it in GitHub Desktop.
Loading method
public LoadingWindow()
{
InitializeComponent();
DataContext = this;
Loaded += LoadingWindow_Loaded;
}
void LoadingWindow_Loaded(object sender, RoutedEventArgs e)
{
//Task.Factory.StartNew(() =>
//{
LoadViewModels();
//});
}
private void LoadViewModels()
{
Globals.MainWindowVm = new MainWindowVm();
using (var dbContext = new MyDbContext())
{
LoadItems<Type, TypeVm>("Type", dbContext.Types);
LoadSecondaryItems<SecondaryItem, SecondaryItemVm>("SecondaryType", dbContext.SecondaryTypes)
}
App.Current.Dispatcher.Invoke(() =>
{
Globals.MainWindow = new MainWindow();
Globals.MainWindow.Show();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment