示例#1
0
        public ViewModelLocator()
        {
            ConfigurationBuilder config = new ConfigurationBuilder();

            config.AddJsonFile("autofac.json");
            ConfigurationModule module  = new ConfigurationModule(config.Build());
            ContainerBuilder    builder = new ContainerBuilder();

            builder.RegisterModule(module);
            Container = builder.Build();

            navigationService = Container.Resolve <INavigationService>();

            addTripViewModel    = Container.Resolve <AddEditTripViewModel>();
            addTicketViewModel  = Container.Resolve <AddTicketViewModel>();
            cityViewModel       = Container.Resolve <CityViewModel>();
            mainWindowViewModel = Container.Resolve <MainWindowViewModel>();
            menuViewModel       = Container.Resolve <MenuViewModel>();
            routeMapViewModel   = Container.Resolve <RouteMapViewModel>();
            showTicketViewModel = Container.Resolve <ShowTicketViewModel>();
            tripListViewModel   = Container.Resolve <TripListViewModel>();
            ticketsViewModel    = Container.Resolve <TicketListViewModel>();

            navigationService.Register <AddEditTripViewModel>(addTripViewModel);
            navigationService.Register <AddTicketViewModel>(addTicketViewModel);
            navigationService.Register <CityViewModel>(cityViewModel);
            navigationService.Register <MenuViewModel>(menuViewModel);
            navigationService.Register <RouteMapViewModel>(routeMapViewModel);
            navigationService.Register <ShowTicketViewModel>(showTicketViewModel);
            navigationService.Register <TicketListViewModel>(ticketsViewModel);
            navigationService.Register <TripListViewModel>(tripListViewModel);

            navigationService.Navigate <TripListViewModel>();
        }
        public ViewModelLocator()
        {
            try
            {
                var config = new ConfigurationBuilder();
                config.AddJsonFile("autofac.json");
                var module  = new ConfigurationModule(config.Build());
                var builder = new ContainerBuilder();
                builder.RegisterModule(module);
                Container = builder.Build();

                navigationService = Container.Resolve <INavigationService>();
                apiService        = Container.Resolve <IApiService>();
                messageService    = Container.Resolve <IMessageService>();

                appViewModel             = Container.Resolve <AppViewModel>();
                startPageViewModel       = Container.Resolve <StartPageViewModel>();
                signUpViewModel          = Container.Resolve <SignUpViewModel>();
                tripBoardViewModel       = Container.Resolve <TripBoardViewModel>();
                addNewTripViewModel      = Container.Resolve <AddNewTripViewModel>();
                addDestinationsViewModel = Container.Resolve <AddDestinationsViewModel>();
                addNewTripTaskViewModel  = Container.Resolve <AddNewTripTaskViewModel>();
                reviewTripViewModel      = Container.Resolve <ReviewTripViewModel>();
                tripTasksViewModel       = Container.Resolve <TripTasksViewModel>();
                destinationsViewModel    = Container.Resolve <DestinationsViewModel>();
                routeMapViewModel        = Container.Resolve <RouteMapViewModel>();
                ticketsViewModel         = Container.Resolve <TicketsViewModel>();
                checkTicketViewModel     = Container.Resolve <CheckTicketViewModel>();

                navigationService.Register <StartPageViewModel>(startPageViewModel);
                navigationService.Register <SignUpViewModel>(signUpViewModel);
                navigationService.Register <TripBoardViewModel>(tripBoardViewModel);
                navigationService.Register <AddNewTripViewModel>(addNewTripViewModel);
                navigationService.Register <AddDestinationsViewModel>(addDestinationsViewModel);
                navigationService.Register <AddNewTripTaskViewModel>(addNewTripTaskViewModel);
                navigationService.Register <ReviewTripViewModel>(reviewTripViewModel);
                navigationService.Register <TripTasksViewModel>(tripTasksViewModel);
                navigationService.Register <DestinationsViewModel>(destinationsViewModel);
                navigationService.Register <RouteMapViewModel>(routeMapViewModel);
                navigationService.Register <TicketsViewModel>(ticketsViewModel);
                navigationService.Register <CheckTicketViewModel>(checkTicketViewModel);

                navigationService.Navigate <StartPageViewModel>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
 public RouteCreateViewModel()
 {
     RouteMap         = new RouteMapViewModel();
     SignalSelectList = new List <Tuple <string, string> >();
 }