public MainWindowViewModel() { // TODO: запуск авторизации CurrentPage = new StartWindowViewModel(this); // TODO: запуск сразу клиентской части //GetClient(); // TODO: запуск сразу из под админа //CurrentPage = new ManagerMainViewModel(); // собственные пространства имен var viewModelLocator = ServiceLocator.Default.ResolveType <IViewModelLocator>(); var viewLocator = ServiceLocator.Default.ResolveType <IViewLocator>(); viewModelLocator.NamingConventions.Add("[AS].ViewModels.ClientViewModels.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.ClientViews.[VM]View"); viewModelLocator.NamingConventions.Add("[AS].ViewModels.ClientViewModels.OrderViewModels.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.ClientViews.OrderViews.[VM]View"); viewModelLocator.NamingConventions.Add("[AS].ViewModels.AuthorizationViewModels.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.AuthorizationViews.[VM]View"); viewModelLocator.NamingConventions.Add("[AS].ViewModels.ManagerViewModels.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.ManagerViews.[VM]View"); viewModelLocator.NamingConventions.Add("[AS].ViewModels.ManagerViewModels.Actions.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.ManagerViews.Actions.[VM]View"); viewModelLocator.NamingConventions.Add("[AS].ViewModels.ManagerViewModels.AdditionalWindows.[VW]ViewModel"); viewLocator.NamingConventions.Add("[AS].Views.ManagerViews.AdditionalWindows.[VM]View"); }
protected override void OnStartup(StartupEventArgs e) { HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize(); base.OnStartup(e); //главный контекст MainContext = new MainEntititesContext(); //Стартовое окно выбора отеля var hotelsRepository = new HotelsRepository(MainContext); var startWindowViewModel = new StartWindowViewModel(hotelsRepository); var startWindow = new StartWindow() { DataContext = startWindowViewModel }; startWindow.Show(); //подписка на событие выбора отеля startWindowViewModel.StartButtonClicked += () => { MainContext.CurrentHotel = startWindowViewModel.SelectedHotel; //--Создание репозитеориев с данными var guestsRepository = new GuestsRepository(MainContext); var roomsRepository = new RoomsRepository(MainContext); var typesRepository = new TypeOfRoomsRepository(MainContext); var registrationRepository = new RegistrationRepository(MainContext); var registrationViewRepository = new RegistrationViewRepository(MainContext); var paymentsRepository = new PaymentsRepository(MainContext); var paymentsViewRepository = new PaymentsViewRepository(MainContext); var wishesRepository = new WishesRepository(MainContext); var discountsRepository = new DiscountsRepository(MainContext); var guestsDiscountsRepository = new GuestsDiscountsRepository(MainContext); var servicesRepository = new ServicesRepository(MainContext); var realizationRepository = new ServiceRealizationRepository(MainContext); //создание модели представления главного окна var mainviewmodel = new MainWindowViewModel(hotelsRepository, guestsRepository, roomsRepository, typesRepository, registrationViewRepository, registrationRepository, paymentsRepository, paymentsViewRepository, wishesRepository, discountsRepository, guestsDiscountsRepository, servicesRepository, realizationRepository); //создание представления главного окна var mainview = new MainWindow() { DataContext = mainviewmodel }; mainview.Show(); startWindowViewModel = null; startWindow.Close(); }; }
public StartView(ISessionService sessionService, IQuizDataService quizDataService, IWindowService windowService) { InitializeComponent(); var vm = new StartWindowViewModel(sessionService, quizDataService, windowService); DataContext = vm; if (vm.CloseWindowAction == null) { vm.CloseWindowAction = new System.Action(() => Close()); } }
public void OpenStartWindow(StartWindowViewModel startWindowViewModel) { if (_startWindow.IsVisible) { return; } _startWindow.DataContext = startWindowViewModel; _startWindow.Show(); _startWindow.Closing += onStartWindowClosing; _startWindow.Closed += onStartWindowClosed; }
public StartWindow() { InitializeComponent(); DataContext = new StartWindowViewModel(); }