public ApplicationWindow(INavigationView navigationView, IDealView dealView, IProjectView projectView, ICatalogView catalogView, IErrorLogView errorLogView)
            : this()
        {
            this.LeftPanel.Children.Add(navigationView as UserControl);
            (navigationView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (navigationView as UserControl).BorderBrush = Brushes.LightGray;
            (navigationView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);

            this.CenterPanel.Children.Add(dealView as UserControl);
            (dealView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (dealView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            dealView.HideView();

            this.CenterPanel.Children.Add(projectView as UserControl);
            (projectView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (projectView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            projectView.HideView();

            this.CenterPanel.Children.Add(catalogView as UserControl);
            (catalogView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (catalogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            catalogView.HideView();

            this.FooterPanel.Children.Add(errorLogView as UserControl);
            (errorLogView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (errorLogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
        }
Example #2
0
 public ProjectController(
     IProjectView projectView, 
     INewProjectView newProjectView, 
     IProjectRepository projectRepository, 
     IDealRepository dealRepository,
     INewProjectSupplyView newProjectSupplyView,
     INewProjectHardwareView newProjectHardwareView,
     IEditProjectSupplyView editProjectSupplyView,
     IEditProjectHardwareView editProjectHardwareView,
     INewProjectFrameView newProjectFrameView,
     IEditProjectHardwareSupplyView editProjectHardwareSupplyView,
     ILoadingView loadingView,
     ICatalogRepository catalogRepository,
     ITaskRepository taskRepository)
 {
     this.projectView = projectView;
     this.newProjectView = newProjectView;
     this.projectRepository = projectRepository;
     this.dealRepository = dealRepository;
     this.newProjectSupplyView = newProjectSupplyView;
     this.newProjectHardwareView = newProjectHardwareView;
     this.editProjectHardwareView = editProjectHardwareView;
     this.editProjectSupplyView = editProjectSupplyView;
     this.newProjectFrameView = newProjectFrameView;
     this.editProjectHardwareSupplyView = editProjectHardwareSupplyView;
     this.loadingView = loadingView;
     this.catalogRepository = catalogRepository;
     this.taskRepository = taskRepository;
 }
		public ProjectViewModel(IProjectView view, IEnumerable<IPresentationViewModel> presentationViewModels, Jira.REST.Jira jira)
		{
			this.Name = "Project Screen";
			this.Page = Pages.Project;
			this.View = view;
			_presentationViewModels = presentationViewModels;
			_jira = jira;

			InitCommands();
		}
        public void SaveProjectAs_CanBeCanceled_AAA()
        {
            //Arrange
            IProjectView      view      = MockRepository.GenerateStrictMock <IProjectView>();
            Project           prj       = new Project("Example Project");
            IProjectPresenter presenter = new ProjectPresenter(prj, view);

            view.Expect(v => v.Title).Return(null);
            view.Expect(v => v.Ask(Arg <string> .Is.Null, Arg <string> .Is.Null)).Return(null);

            //Act
            bool isProjectSave = presenter.SaveProjectAs();

            //Assert
            Assert.IsFalse(isProjectSave);
            view.VerifyAllExpectations();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectViewPresenter"/> class.
        /// </summary>
        /// <param name="view">The <see cref="IProjectView"/> view instance.</param>
        /// <param name="configurationService">The <seealso cref="IConfigurationService"/> service used get the list of the projects.</param>
        /// <param name="serviceFacade">The service facade.</param>
        /// <param name="regionManager">The <see cref="IRegionManager"/>.</param>
        public ProjectViewPresenter(IProjectView view, IConfigurationService configurationService, IDataServiceFacade serviceFacade, IRegionManager regionManager)
        {
            this.serviceFacade        = serviceFacade;
            this.configurationService = configurationService;
            this.regionManager        = regionManager;
            this.deleteCommand        = new DelegateCommand <object>(this.Delete);

            this.View       = view;
            this.View.Model = this;

            this.serviceFacade.GetProjectsByUserCompleted += (sender, e) =>
            {
                if (e.Data != null)
                {
                    if (this.configurationService.GetProjectId() != null)
                    {
                        Project project = e.Data.Where(x => x.ProviderUri == this.configurationService.GetProjectId()).SingleOrDefault();
                        if (project != null && e.Data.Contains(project))
                        {
                            e.Data.Remove(project);
                        }
                    }

                    this.Projects = new ObservableCollection <Project>();
                    e.Data.ForEach(x => this.Projects.Add(x));
                }
            };

            this.serviceFacade.DeleteProjectCompleted += (sender, e) =>
            {
                if (e.Data && this.deletedProjectUri != null)
                {
                    Project project = this.projects.SingleOrDefault(x => x.ProviderUri == this.deletedProjectUri);

                    if (project != null)
                    {
                        this.Projects.Remove(project);
                    }
                }

                this.deletedProjectUri = null;
            };

            this.serviceFacade.GetProjectsByUserAsync(this.configurationService.GetUserName());
        }
        public void SaveProjectAs_NewNameWithoutConflicts_AAA()
        {
            //Arrange
            MockRepository     mocks      = new MockRepository();
            IProjectView       view       = mocks.StrictMock <IProjectView>();
            IProjectRepository repository = mocks.StrictMock <IProjectRepository>();
            IProject           prj        = mocks.StrictMock <IProject>();

            //Component to test
            IProjectPresenter presenter = new ProjectPresenter(prj, repository, view);

            string question       = "Mock ?";
            string answer         = "Yes";
            string newProjectName = "RhinoMocks";

            //Not expected but its necessary for the implementation
            //We give the property behavior to prj.Name
            prj.Expect(p => p.Name).PropertyBehavior();

            using (mocks.Ordered())
            {
                view.Expect(v => v.Title).Return(prj.Name);
                view.Expect(v => v.Ask(question, answer)).Return(newProjectName);
                repository.Expect(r => r.GetProjectByName(newProjectName)).Return(null);

                view.Title      = newProjectName;
                view.HasChanges = false;

                repository.SaveProject(prj);
            }
            //Act
            mocks.ReplayAll();
            bool isSave = presenter.SaveProjectAs();

            //Assert
            Assert.IsTrue(isSave);
            Assert.AreEqual(newProjectName, prj.Name);
            view.VerifyAllExpectations();
            repository.VerifyAllExpectations();
            prj.VerifyAllExpectations();
        }
 public BuildProjectCommand(IProjectView view, Project prj, IProjectsRepository repository)
 {
     this.repository = repository;
     this.view = view;
     this.prj = prj;
 }
 public ProjectPresenter(Project prj, IMainPresenter mainPresenter)
 {
     this.mainPresenter = mainPresenter;
     this.prj = prj;
     this.view  = CreateView(mainPresenter);
 }
 public ProjectPresenter(IProjectView projectView, IProjectRepository repository, Project prj)
     : this(projectView, prj)
 {
     _repository = repository;
 }
 public void SetUp()
 {
     mocks = new MockRepository();
     prj = QueryPresenterTests.BuildProject();
     mainPresenter = (IMainPresenter)mocks.CreateMock(typeof(IMainPresenter));;
     repository = (IProjectsRepository)mocks.CreateMock(typeof(IProjectsRepository));;
     projectView = (IProjectView)mocks.CreateMock(typeof(IProjectView));
     ProjectPresenterWithMockView.MockView = projectView;
     SetupResult.On(mainPresenter).Call(mainPresenter.Repository).Return(repository);
     presenter = new ProjectPresenterWithMockView(prj,mainPresenter);
 }
 public ProjectPresenter(IProjectView projectView)
 {
     _projectView = projectView;
 }
 public ProjectPresenter(IProjectView projectView, Project prj)
 {
     _projectView = projectView;
     _prj = prj;
 }
 protected override IProjectView CreateView(IMainPresenter mainPresenter)
 {
     if(mockView==null)
         throw new InvalidOperationException("Mock View was not set for this instance");
     //avoid using the same instance of mocked view for several instaces of
     //the mocked view
     IProjectView tmp = mockView;
     mockView = null;
     return tmp;
 }
 public void SetUp()
 {
     mocks = new MockRepository();
     view  = mocks.StrictMock <IProjectView>();
 }
        public KickstartWizardPresenter(KickstartWizardModel kickstartWizardModel, IKickstartService kickstartService, IKickstartWizardService kickstartWizardService, IMessageBoxDisplayService messageBoxDisplayService, IKickstartWizardView kickstartWizardView, IMenuView menuView, IProjectView projectView, IProtoFileView protoFileView, IDatabaseSqlView databaseSqlView, IGenerationView generationView, IProtoToKProtoConverter protoToKProtoConverter)
        {
            _kickstartWizardModel = kickstartWizardModel;

            _kickstartService         = kickstartService;
            _kickstartWizardService   = kickstartWizardService;
            _messageBoxDisplayService = messageBoxDisplayService;
            _kickstartWizardView      = kickstartWizardView;
            _menuView               = menuView;
            _protoFileView          = protoFileView;
            _databaseSqlView        = databaseSqlView;
            _generationView         = generationView;
            _projectView            = projectView;
            _protoToKProtoConverter = protoToKProtoConverter;

            kickstartWizardView.Load += KickstartWizardViewLoad;

            _kickstartWizardModel.ProjectNameChanged += (a, b) =>
            {
                _projectView.ProjectName = _kickstartWizardModel.ProjectName;
                return(Task.CompletedTask);
            };

            if (_projectView != null)
            {
                _projectView.ProjectNameChanged += (a, b) =>
                {
                    _kickstartWizardModel.ProjectName = _projectView.ProjectName;
                    return(Task.CompletedTask);
                };
            }

            kickstartWizardView.NextClicked  += KickstartWizardViewNextClicked;
            kickstartWizardView.PreviousStep += KickstartWizardViewPreviousStep;
            protoFileView.ProtoTextChanged   += ProtoFileViewProtoTextChanged;
            databaseSqlView.GenerateStoredProcAsEmbeddedQueryChanged += (a, b) =>
            {
                _kickstartWizardModel.GenerateStoredProcAsEmbeddedQuery = _databaseSqlView.GenerateStoredProcAsEmbeddedQuery;
                return(Task.CompletedTask);
            };

            databaseSqlView.SqlStoredProcTextChanged += (a, b) =>
            {
                _kickstartWizardModel.SqlStoredProcText = _databaseSqlView.SqlStoredProcText;
                return(Task.CompletedTask);
            };

            databaseSqlView.SqlTableTextChanged += (a, b) =>
            {
                _kickstartWizardModel.SqlTableText = _databaseSqlView.SqlTableText;
                return(Task.CompletedTask);
            };

            databaseSqlView.SqlTableTypeTextChanged += (a, b) =>
            {
                _kickstartWizardModel.SqlTableTypeText = _databaseSqlView.SqlTableTypeText;
                return(Task.CompletedTask);
            };

            databaseSqlView.ConvertToSnakeCaseChanged += (a, b) =>
            {
                _kickstartWizardModel.ConvertToSnakeCase = _databaseSqlView.ConvertToSnakeCase;
                return(Task.CompletedTask);
            };


            kickstartWizardView.AddView(menuView);
            kickstartWizardView.AddView(protoFileView);
            kickstartWizardView.AddView(databaseSqlView);
            kickstartWizardView.AddView(generationView);

            //where should this go in MVP ?
            if (_projectView != null)
            {
                _projectView.SolutionName = _kickstartWizardModel.SolutionName;
                _projectView.CompanyName  = _kickstartWizardModel.CompanyName;
                _projectView.ProjectName  = _kickstartWizardModel.ProjectName;
            }
        }
 public void SetUp()
 {
     mocks = new MockRepository();
     view = mocks.StrictMock<IProjectView>();
 }
Example #17
0
 public ProjectPresenter(IProject prj, IProjectView view)
 {
     this.m_Prj  = prj;
     this.m_View = view;
 }
 public ProjectPresenter(IProjectView view)
 {
     _view = view;
 }
Example #19
0
 public ProjectPresenter(IProject prj, IProjectRepository repository, IProjectView view)
 {
     this.m_Prj        = prj;
     this.m_Repository = repository;
     this.m_View       = view;
 }
Example #20
0
 public ProjectPresenter(IProject prj, IProjectRepository repository, IProjectView view)
 {
     this.m_Prj = prj;
     this.m_Repository = repository;
     this.m_View = view;
 }
Example #21
0
 public ProjectPresenter(IProject prj, IProjectView view)
 {
     this.m_Prj = prj;
     this.m_View = view;
 }