public MainWindowViewModel(IDialogService dialogService = null, IPersonListViewModel personListVM = null, IPersonParser parser = null, IPersonFactory factory = null, IFileProxy fileProxy = null, IFileWrapper wrapper = null)
 {
     m_dialogService  = dialogService ?? new DialogService.DialogService(null);
     PersonListVM     = personListVM ?? new PersonListViewModel();
     m_factory        = factory ?? new PersonFactory();
     m_fileWrapper    = wrapper ?? new FileWrapper();
     m_fileProxy      = fileProxy;
     m_parser         = parser ?? new PersonParser(factory);
     HaveLoadedPeople = false;
     LoadCommands();
 }
예제 #2
0
        public MainViewModel(
            IMediator mediator,
            IFilmListViewModel filmListViewModel,
            IPersonListViewModel personListViewModel,
            ISearchViewModel searchViewModel,
            IFactory <IFilmDetailViewModel> filmDetailViewModelFactory,
            IFactory <IPersonDetailViewModel> personDetailViewModelFactory)
        {
            _mediator = mediator;

            FilmListViewModel   = filmListViewModel;
            PersonListViewModel = personListViewModel;
            SearchViewModel     = searchViewModel;

            _filmDetailViewModelFactory   = filmDetailViewModelFactory;
            _personDetailViewModelFactory = personDetailViewModelFactory;

            FilmDetailViewModel   = _filmDetailViewModelFactory.Create();
            PersonDetailViewModel = _personDetailViewModelFactory.Create();

            CloseFilmDetailTabCommand              = new RelayCommand(OnCloseFilmDetailTabExecute);
            ClosePersonDetailTabCommand            = new RelayCommand(OnClosePersonDetailTabExecute);
            FilmDetailTabSelectionChangedCommand   = new RelayCommand <FilmDetailViewModel>(FilmDetailTabChanged);
            PersonDetailTabSelectionChangedCommand = new RelayCommand <PersonDetailViewModel>(PersonDetailTabChanged);

            mediator.Register <NewMessage <FilmWrapper> >(OnFilmNewMessage);
            mediator.Register <NewMessage <PersonWrapper> >(OnPersonNewMessage);

            mediator.Register <SelectedMessage <FilmWrapper> >(OnFilmSelected);
            mediator.Register <SelectedMessage <PersonWrapper> >(OnPersonSelected);

            mediator.Register <UpdateMessage <FilmWrapper> >(OnFilmUpdated);
            mediator.Register <UpdateMessage <PersonWrapper> >(OnPersonUpdated);

            mediator.Register <DeleteMessage <FilmWrapper> >(OnFilmDeleted);
            mediator.Register <DeleteMessage <PersonWrapper> >(OnPersonDeleted);
        }
예제 #3
0
 public PersonView(IPersonListViewModel listViewModel)
 {
     DataContext = listViewModel;
     InitializeComponent();
 }