Beispiel #1
0
        public void Start()
        {
            if (_trigger != null)
            {
                throw new InvalidOperationException("Already started.");
            }

            var listenPrefix = Properties.Settings.Default.BaseAddress;

            if (!listenPrefix.EndsWith("/"))
            {
                listenPrefix += "/";
            }

            var serverProvider         = new AppConfigTfsConnectionProvider();
            var server                 = serverProvider.GetConnection();
            var eventService           = server.GetService <IEventService>();
            var buildServer            = server.GetService <IBuildServer>();
            var versionControlServer   = server.GetService <VersionControlServer>();
            var configurationReader    = new ConfigurationReader(new VersionControlDeploymentFileSource(versionControlServer), Properties.Settings.Default.KeyFile);
            var deploymentFolderSource = new VersionControlDeploymentFolderSource(versionControlServer);
            var baseAddress            = new Uri(listenPrefix + "event/");
            var listener               = new TfsListener(eventService, baseAddress);
            var duplicateEventDetector = new DuplicateEventDetector();

            _trigger = new TfsBuildStatusTrigger(listener, new DeployerFactory(buildServer, configurationReader, deploymentFolderSource), duplicateEventDetector);
            _trigger.Start();
        }