Пример #1
0
        public UsersController(
            UsersViewModel viewModel,
            IRepository<Userdb> userdbRepository,
            IPersistDomainModelsAsync<Userdb> userdbPersisterRepository,
            IInvokeBackgroundWorker<IEnumerable<Userdb>> asyncClient,
            ILog logger,
            IUIInvoker uiInvoker,
            IProgressbar loadingNotifier, 
            IMetadataService metadataService)
        {
            Guard.Requires<ArgumentException>(userdbRepository != null, "userdbRepository");
            Guard.Requires<ArgumentException>(userdbPersisterRepository != null, "userdbPersisterRepository");
            Guard.Requires<ArgumentException>(asyncClient != null, "asyncClient");
            Guard.Requires<ArgumentException>(logger != null, "logger");

            this.userdbRepository = userdbRepository;
            this.metadataService = metadataService;
            this.userdbPersisterRepository = userdbPersisterRepository;
            this.asyncClient = asyncClient;
            this.logger = logger;
            this.uiInvoker = uiInvoker;
            this.loadingNotifier = loadingNotifier;
            this.viewModel = viewModel;

            this.viewModel.Save.AfterExecute += (sender, args) => SaveDataToRepository();
            this.viewModel.Refresh.AfterExecute += (sender, args) => LoadData();
            this.viewModel.PropertyChanged += SelectedDbChanged;
            this.userdbPersisterRepository.SaveCompleted += OnSaveCompleted;

            LoadData();
        }
Пример #2
0
 public UsersWidget()
 {
     Title = "User Administration";
     
 	var controller = NewController<UsersController>();
     viewModel = GetInstance<UsersViewModel>();
     View = new UsersView() {DataContext = viewModel};
     viewModel.PropertyChanged += ViewModelPropertyChanged;
     this.PropertyChanged += UsersWidgetPropertyChanged;
 }
Пример #3
0
        private static void CreateController()
        {
            viewModel = new UsersViewModel();

            controller = new UsersController(
                viewModel,
                mockRepository.Object,
                mockPersistDomainModels.Object,
                backgroundWorkerInvoker,
                mockLog.Object,
                new NoUIInvokation(),
                loadingNotifierMock.Object,
                metadataServiceMock.Object);
        }