public UserSelfAdministrationModel(IAdministrationRemoteService adminService, ApplicationGlobalModel globalModel,
                                           UserNameClientCredentials userCredentials, [Named("WpfClientMapper")]  IMapper mapper, IEventAggregator eventAggregator)
        {
            this._adminService    = adminService;
            this._mapper          = mapper;
            this._userCredentials = userCredentials;
            this._eventAggregator = eventAggregator;

            TabModel = new TabModel()
            {
                Title      = Properties.Resources.AdministrationTab_Title_User,
                CanClose   = false,
                IsModified = false
            };

            CurrentUser = globalModel.CurrentUser;
            BackupUser  = new User();

            IsUserInEditMode     = false;
            IsPasswordInEditMode = false;
            PasswordChangeModel  = new PasswordChangeViewModel();

            StartUserChangesCommand  = new DelegateCommand(StartUserChanges);
            SaveUserChangesCommand   = new AwaitableDelegateCommand(SaveUserChanges);
            CancelUserChangesCommand = new DelegateCommand(CancelUserChanges);

            StartPasswordChangeCommand  = new DelegateCommand(StartPasswordChange);
            ChangeUserPasswordCommand   = new AwaitableDelegateCommand(ChangeUserPassword);
            CancelPasswordChangeCommand = new DelegateCommand(CancelPasswordChange);

            ChangeNotification = new InteractionRequest <INotification>();
        }
Пример #2
0
        public LoginModel(ApplicationGlobalModel applicationGlobalModel, UserNameClientCredentials userCredentials,
                          IAuthorisationRemoteService authorisationService, IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            this.applicationGlobalModel = applicationGlobalModel;
            this.regionManager          = regionManager;
            this.userCredentials        = userCredentials;
            this.authorisationService   = authorisationService;
            this._eventAggregator       = eventAggregator;

            LoginCommand  = new AwaitableDelegateCommand(Login);
            LoadedCommand = new AwaitableDelegateCommand(Loaded);

            scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            LoadPreviousSettings();
        }
        public async System.Threading.Tasks.Task InitializeKernelAsync()
        {
            kernel = new StandardKernel();
            kernel.Load(new ServiceConsumerNinjectModule());
            Mock <IServiceRunningIndicator> servMock = new Mock <IServiceRunningIndicator>();

            kernel.Bind <IServiceRunningIndicator>().ToConstant(servMock.Object);


            service              = kernel.Get <IAdministrationRemoteService>();
            pinzService          = kernel.Get <IPinzAdminRemoteService>();
            taskService          = kernel.Get <ITaskRemoteService>();
            authorisationService = kernel.Get <IAuthorisationRemoteService>();

            UserNameClientCredentials credentials = kernel.Get <UserNameClientCredentials>();

            credentials.UserName = TestUserCredentials.UserName;
            credentials.Password = TestUserCredentials.Password;
            credentials.UpdateCredentialsForAllFactories();

            company = new Company()
            {
                Name = "Pinz Online"
            };
            company = await pinzService.CreateCompanyAsync(company);

            Project project = new Project()
            {
                CompanyId   = company.CompanyId,
                Name        = "My test project",
                Description = "Descirption"
            };
            await service.CreateProjectAsync(project);

            User user = new User()
            {
                EMail          = "*****@*****.**",
                IsCompanyAdmin = true,
                CompanyId      = company.CompanyId
            };

            user = await service.CreateUserAsync(user);

            await service.AddUserToProjectAsync(user, project, true);

            category = await taskService.CreateCategoryInProjectAsync(project);
        }
Пример #4
0
        public async System.Threading.Tasks.Task InitializeKernelAsync()
        {
            kernel = new StandardKernel();
            kernel.Load(new ServiceConsumerNinjectModule());
            Mock <IServiceRunningIndicator> servMock = new Mock <IServiceRunningIndicator>();

            kernel.Bind <IServiceRunningIndicator>().ToConstant(servMock.Object);

            service     = kernel.Get <IAdministrationRemoteService>();
            pinzService = kernel.Get <IPinzAdminRemoteService>();

            credentials          = kernel.Get <UserNameClientCredentials>();
            credentials.UserName = TestUserCredentials.UserName;
            credentials.Password = TestUserCredentials.Password;
            credentials.UpdateCredentialsForAllFactories();

            Company company1 = new Company()
            {
                Name = "Pinz Online"
            };

            company = await pinzService.CreateCompanyAsync(company1);
        }
 public TaskService([Named("ServiceConsumerMapper")] IMapper mapper, ChannelFactory <TaskServiceReference.ITaskService> clientFactory, UserNameClientCredentials clientCredentials)
 {
     this.mapper            = mapper;
     this.clientFactory     = clientFactory;
     this.clientCredentials = clientCredentials;
 }