protected override void OnStartup(StartupEventArgs e) { var cnnService = new FarmingConnectionService(); var authSnackbarMessageQueue = new SnackbarMessageQueue(); var cnnViewModel = new SignInViewModel(cnnService, authSnackbarMessageQueue); var authView = new AuthorizationView(cnnViewModel, authSnackbarMessageQueue); ConnectionEventHandler onSuccessfulSignIn = null; onSuccessfulSignIn = (obj, _e) => { cnnService.SuccessfulSignIn -= onSuccessfulSignIn; var navigation = new Navigation(); var snackbarMessageQueue = new SnackbarMessageQueue(); var mainViewModel = new MainViewModel(_e.User, navigation, "FARMING inc.", snackbarMessageQueue); MainWindow = new MainWindow(mainViewModel, snackbarMessageQueue); authView.Close(); MainWindow.Show(); }; cnnService.SuccessfulSignIn += onSuccessfulSignIn; authView.Show(); base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "/Images")) { Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "/Images"); } Data = new DataBaseSaource(); AuthWindow = new AuthorizationView(); AuthWindow.Show(); }
protected override void OnStartup(StartupEventArgs info) { base.OnStartup(info); var authorizationViewModel = new AuthorizationViewModel( StandartNinjectKernel.Get <IUserRelatedRepository>(), StandartNinjectKernel.Get <IUserSession>() ); var authorizationView = new AuthorizationView() { DataContext = authorizationViewModel }; authorizationViewModel.RelatedView = authorizationView; authorizationView.Show(); }