Created
April 27, 2015 12:42
-
-
Save julesx/dadc7dfa20089aaec0b1 to your computer and use it in GitHub Desktop.
Loading method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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