예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditConnectionViewModel" /> class.
        /// </summary>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="logService">The log service.</param>
        /// <param name="settingsRepository">The build provider settings repository.</param>
        /// <param name="connectionSettingsFactory">The connection settings factory.</param>
        /// <param name="buildProviderStrategy">The build provider strategy.</param>
        /// <param name="trackedProjectFactory">The tracked project factory.</param>
        /// <param name="trackedProjectsFactory">The tracked projects factory.</param>
        /// <param name="currentSettings">The current settings.</param>
        public EditConnectionViewModel(
            IPlatformProvider platformProvider,
            ILogService logService,
            IConnectionSettingsRepository settingsRepository,
            IConnectionSettingsViewModelFactory <AppVeyor.ConnectionSettings, ConnectionSettingsViewModel> connectionSettingsFactory,
            IBuildProviderStrategy buildProviderStrategy,
            ITrackedProjectViewModelFactory trackedProjectFactory,
            ITrackedProjectsViewModelFactory trackedProjectsFactory,
            AppVeyor.ConnectionSettings currentSettings)
            : base(
                platformProvider,
                logService,
                settingsRepository,
                buildProviderStrategy,
                trackedProjectFactory,
                trackedProjectsFactory,
                currentSettings)
        {
            Ensure.That(connectionSettingsFactory).IsNotNull();

            var settings = connectionSettingsFactory.Create();

            settings.Name             = currentSettings.Name;
            settings.Token            = currentSettings.Token;
            settings.BuildsPerProject = currentSettings.BuildsPerProject;
            settings.IsDirty          = false;

            Settings = settings;

            TryConnect();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditConnectionViewModel{T}" /> class.
        /// </summary>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="logService">The log service.</param>
        /// <param name="settingsRepository">The settings repository.</param>
        /// <param name="buildProviderStrategy">The build provider strategy.</param>
        /// <param name="trackedProjectFactory">The tracked project factory.</param>
        /// <param name="trackedProjectsFactory">The tracked projects factory.</param>
        /// <param name="currentSettings">The current settings.</param>
        protected EditConnectionViewModel(
            IPlatformProvider platformProvider,
            ILogService logService,
            IConnectionSettingsRepository settingsRepository,
            IBuildProviderStrategy buildProviderStrategy,
            ITrackedProjectViewModelFactory trackedProjectFactory,
            ITrackedProjectsViewModelFactory trackedProjectsFactory,
            T currentSettings)
            : base(platformProvider)
        {
            Ensure.That(logService).IsNotNull();
            Ensure.That(settingsRepository).IsNotNull();
            Ensure.That(buildProviderStrategy).IsNotNull();
            Ensure.That(trackedProjectFactory).IsNotNull();
            Ensure.That(trackedProjectsFactory).IsNotNull();
            Ensure.That(currentSettings).IsNotNull();

            _logService             = logService;
            _settingsRepository     = settingsRepository;
            _buildProviderStrategy  = buildProviderStrategy;
            _trackedProjectFactory  = trackedProjectFactory;
            _trackedProjectsFactory = trackedProjectsFactory;
            _currentSettings        = currentSettings;
            DisplayName             = Properties.Resources.EditConnection_View;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditConnectionViewModel" /> class.
        /// </summary>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="logService">The log service.</param>
        /// <param name="settingsRepository">The build provider settings repository.</param>
        /// <param name="connectionSettingsFactory">The connection settings factory.</param>
        /// <param name="buildProviderStrategy">The build provider strategy.</param>
        /// <param name="trackedProjectFactory">The tracked project factory.</param>
        /// <param name="trackedProjectsFactory">The tracked projects factory.</param>
        /// <param name="currentSettings">The current settings.</param>
        public EditConnectionViewModel(
            IPlatformProvider platformProvider,
            ILogService logService,
            IConnectionSettingsRepository settingsRepository,
            IConnectionSettingsViewModelFactory <TeamCity.ConnectionSettings, ConnectionSettingsViewModel> connectionSettingsFactory,
            IBuildProviderStrategy buildProviderStrategy,
            ITrackedProjectViewModelFactory trackedProjectFactory,
            ITrackedProjectsViewModelFactory trackedProjectsFactory,
            TeamCity.ConnectionSettings currentSettings)
            : base(
                platformProvider,
                logService,
                settingsRepository,
                buildProviderStrategy,
                trackedProjectFactory,
                trackedProjectsFactory,
                currentSettings)
        {
            Ensure.That(connectionSettingsFactory).IsNotNull();

            var settings = connectionSettingsFactory.Create();

            settings.Name = currentSettings.Name;
            settings.Url  = currentSettings.Url;
            settings.AuthenticationType = currentSettings.AuthenticationType;
            settings.Username           = currentSettings.Username;
            settings.Password           = currentSettings.Password;
            settings.BuildsPerProject   = currentSettings.BuildsPerProject;
            settings.IsDirty            = false;

            Settings = settings;

            TryConnect();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AddConnectionViewModel{T1,T2}" /> class.
        /// </summary>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="logService">The log service.</param>
        /// <param name="settingsRepository">The settings repository.</param>
        /// <param name="buildProviderStrategy">The build provider strategy.</param>
        /// <param name="trackedProjectFactory">The tracked project factory.</param>
        /// <param name="trackedProjectsFactory">The tracked projects factory.</param>
        /// <param name="connectionSettingsFactory">The settings factory.</param>
        public AddConnectionViewModel(
            IPlatformProvider platformProvider,
            IEventAggregator eventAggregator,
            ILogService logService,
            IConnectionSettingsRepository settingsRepository,
            IBuildProviderStrategy buildProviderStrategy,
            ITrackedProjectViewModelFactory trackedProjectFactory,
            ITrackedProjectsViewModelFactory trackedProjectsFactory,
            IConnectionSettingsViewModelFactory <T1, T2> connectionSettingsFactory)
            : base(platformProvider)
        {
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(logService).IsNotNull();
            Ensure.That(settingsRepository).IsNotNull();
            Ensure.That(buildProviderStrategy).IsNotNull();
            Ensure.That(trackedProjectFactory).IsNotNull();
            Ensure.That(trackedProjectsFactory).IsNotNull();
            Ensure.That(connectionSettingsFactory).IsNotNull();

            _eventAggregator        = eventAggregator;
            _logService             = logService;
            _settingsRepository     = settingsRepository;
            _buildProviderStrategy  = buildProviderStrategy;
            _trackedProjectFactory  = trackedProjectFactory;
            _trackedProjectsFactory = trackedProjectsFactory;

            _connectionTask = new NotifyTask();

            Settings = connectionSettingsFactory.Create();
            Settings.BuildsPerProject = 5;
            DisplayName = Properties.Resources.AddConnection_View;
        }