Beispiel #1
0
        public CreateModulePagePresenter(ICreateModulePage view, ICreateModulePageModel model)
        {
            Guard.ArgumentNotNull(view, "view");
            Guard.ArgumentNotNull(view, "model");

            _view  = view;
            _model = model;

            _view.ModuleNameChanging += new EventHandler <EventArgs>(OnModuleNameChanging);
            _view.ModuleFolderNameOnWebSiteChanged    += new EventHandler <EventArgs>(OnModuleFolderNameOnWebSiteChanged);
            _view.CreateTestProjectChanged            += new EventHandler <EventArgs>(OnCreateTestProjectChanged);
            _view.CreateModuleInterfaceLibraryChanged += new EventHandler <EventArgs>(OnCreateModuleInterfaceLibraryChanged);
            _view.WebProjectSelected             += new EventHandler <EventArgs>(OnWebProjectSelected);
            _view.RequestingValidation           += new EventHandler <EventArgs <bool> >(OnValidating);
            _view.ShowDocumentationChanged       += new EventHandler <EventArgs>(OnShowDocumentationChanged);
            _view.CreateAsFolderInWebsiteChanged += new EventHandler <EventArgs>(OnCreateAsFolderInWebsiteChanged);
        }
        public CreateModulePagePresenter(ICreateModulePage view, ICreateModulePageModel model)
        {
            Guard.ArgumentNotNull(view, "view");
            Guard.ArgumentNotNull(view, "model");

            _view = view;
            _model = model;

            _view.ModuleNameChanging += new EventHandler<EventArgs>(OnModuleNameChanging);
            _view.ModuleFolderNameOnWebSiteChanged += new EventHandler<EventArgs>(OnModuleFolderNameOnWebSiteChanged);
            _view.CreateTestProjectChanged += new EventHandler<EventArgs>(OnCreateTestProjectChanged);
            _view.CreateModuleInterfaceLibraryChanged += new EventHandler<EventArgs>(OnCreateModuleInterfaceLibraryChanged);
            _view.WebProjectSelected += new EventHandler<EventArgs>(OnWebProjectSelected);
            _view.RequestingValidation += new EventHandler<EventArgs<bool>>(OnValidating);
            _view.ShowDocumentationChanged += new EventHandler<EventArgs>(OnShowDocumentationChanged);
            _view.CreateAsFolderInWebsiteChanged += new EventHandler<EventArgs>(OnCreateAsFolderInWebsiteChanged);
        }
Beispiel #3
0
        protected override void DoValidate(string objectToValidate, object currentTarget, string key, ValidationResults validationResults)
        {
            ICreateModulePageModel model = currentTarget as ICreateModulePageModel;

            if (model != null)
            {
                if (model.WebProject.Project != null)
                {
                    WebFolderNameValidator webfolderValidator = new WebFolderNameValidator();
                    ValidationResults      results            = webfolderValidator.Validate(objectToValidate);
                    if (results.IsValid)
                    {
                        string moduleFolderPath = Path.Combine(model.WebProject.ProjectPath, objectToValidate);

                        if (Directory.Exists(moduleFolderPath))
                        {
                            this.LogValidationResult(validationResults, DefaultMessageTemplate, currentTarget, key);
                        }
                    }
                }
            }
        }