Exemplo n.º 1
0
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            try
            {
                //init project service
                this.LogService     = Container.GetInstance <Services.ILogService>();
                this.ProjectService = Container.GetInstance <Services.IProjectService>();
                this.ProjectService.Initialize(
                    (IVsUIShell)GetService(typeof(SVsUIShell)),                    //uishell
                    (DTE2)GetService(typeof(DTE)),                                 //dte
                    (OleMenuCommandService)GetService(typeof(IMenuCommandService)) //mcs
                    );


                this.ProjectService.AddProjectCommands();
                this.ProjectService.AttachFileEventListeners();
            }
            catch (Exception ex)
            {
                LogService.Exception("Provisioning.VSTools Initialization error", ex);
            }
        }
Exemplo n.º 2
0
        public DeployTemplateItem GetDeployItem(Services.ILogService logService)
        {
            LoadedXMLProvisioningTemplate loadedTemplate = null;

            try
            {
                //load the template xml file
                loadedTemplate = this.TemplateInfo.LoadXmlTemplate();
            }
            catch (Exception ex)
            {
                logService.Exception("Error reading template file " + this.ItemPath, ex);
                return(null);
            }

            if (loadedTemplate.Template != null)
            {
                if (this.TemplateInfo.TemplatePath == this.ItemPath)
                {
                    //deploy complete template
                    var deployItem = new DeployTemplateItem()
                    {
                        Config             = this.ProvisioningConfig,
                        Template           = loadedTemplate.Template,
                        TemplateName       = loadedTemplate.TemplateFileName,
                        IsCompleteTemplate = true,
                    };
                    return(deployItem);
                }
                else
                {
                    //deploy specific file(s)
                    var src = Helpers.ProvisioningHelper.MakeRelativePath(this.ItemPath, this.TemplateInfo.ResourcesPath);

                    var files = loadedTemplate.Template.Files.Where(
                        f => f.Src.StartsWith(src, StringComparison.InvariantCultureIgnoreCase)
                        ).ToList();

                    if (files.Count > 0)
                    {
                        //create a new template for the specified file
                        var filesUnderFolderTemplate = new OfficeDevPnP.Core.Framework.Provisioning.Model.ProvisioningTemplate(loadedTemplate.Template.Connector);
                        filesUnderFolderTemplate.Files.AddRange(files);

                        var deployItem = new DeployTemplateItem()
                        {
                            Config             = this.ProvisioningConfig,
                            Template           = filesUnderFolderTemplate,
                            TemplateName       = loadedTemplate.TemplateFileName,
                            IsCompleteTemplate = false,
                        };
                        return(deployItem);
                    }
                }
            }

            return(null);
        }
        public static void ClassInitialize(TestContext testContext)
        {
            var xmlFileSerialiserMock = new Mock <Services.IXmlFileSerialiser>();

            xmlFileSerialiserMock.Setup(o => o.Deserialise <Services.Models.Configuration>(It.IsAny <string>()))
            .Returns(() => new Services.Models.Configuration());
            _xmlFileSerialiser = xmlFileSerialiserMock.Object;

            _logService = new Mock <Services.ILogService>().Object;

            _testContext = testContext;
        }
Exemplo n.º 4
0
        public async Task InvokeAsync(HttpContext httpContext, Services.ILogService logService)
        {
            this._logService = logService;
            try
            {
                _logService.LogDebug("Invoked");

                await _next(httpContext).ConfigureAwait(false);

                if (httpContext.Response.StatusCode == StatusCodes.Status401Unauthorized)
                {
                    await HandleUnAuthorizeAsync(httpContext).ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                await HandleExceptionAsync(httpContext, ex).ConfigureAwait(false);
            }
        }
Exemplo n.º 5
0
 public AuthorController(BlogManagement.Data.Repositories.RepoWrappers.IRepoWrapper repoWrapper, Services.IUserService userService, Services.ILogService logService)
 {
     _repoWrapper = repoWrapper;
     _userService = userService;
     _logService  = logService;
 }
Exemplo n.º 6
0
 public ProjectService(Services.ILogService logSvc, Services.IProvisioningService prvSvc)
 {
     this.LogService          = logSvc;
     this.ProvisioningService = prvSvc;
 }
Exemplo n.º 7
0
 public ArticleController(BlogManagement.Data.Repositories.RepoWrappers.IRepoWrapper repoWrapper, Services.ILogService logService)
 {
     _repoWrapper = repoWrapper;
     _logService  = logService;
 }
Exemplo n.º 8
0
 public ProjectService(Services.ILogService logSvc, Services.IProvisioningService prvSvc)
 {
     this.LogService = logSvc;
     this.ProvisioningService = prvSvc;
 }
Exemplo n.º 9
0
 public ProvisioningService(Services.ILogService logSvc)
 {
     this.LogService = logSvc;
 }
Exemplo n.º 10
0
        private void AppStartup(object sender, StartupEventArgs e)
        {
            if (!instanceMonitor.Assert()) {

                // Defer to another instance.
                instanceMonitor.NotifyNewInstance(GetQueryString());
                this.Shutdown();
                return;
            }

            instanceMonitor.NewInstanceCreated += OnNewInstanceCreated;

            SetFrameworkElementToUserCulture();

            string deployPath = Assembly.GetExecutingAssembly().Location.Replace("ScrumFactory.Windows.exe", "");

            SetupSpellCheck(deployPath);

            SetupStandAloneServerRoot(deployPath);
            SetupStandAloneDB(deployPath);

            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new DirectoryCatalog(deployPath, "ScrumFactory.*.dll"));
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));

            string myDocumentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
            string pluginPath = myDocumentsPath + "\\Scrum Factory\\Plugins";
            if (System.IO.Directory.Exists(pluginPath))
                catalog.Catalogs.Add(new DirectoryCatalog(pluginPath, "*.dll"));
            else {
                try {
                    System.IO.Directory.CreateDirectory(pluginPath);
                }
                catch (Exception) { }
            }

            catalog.Catalogs.Add(new ConfigurationCatalog());

            Container = new CompositionContainer(catalog);

            this.shellViewModel = Container.GetExport<ScrumFactory.Windows.ViewModel.ShellViewModel>().Value;

            this.log = Container.GetExport<Services.ILogService>().Value;

            // starts all view models with the StartsWithApp interface
            Container.GetExportedValues<ScrumFactory.Composition.ViewModel.IStartsWithApp>();

            var args = ParseQueryString(GetQueryString());

            this.shellViewModel.Show(args);
        }