/// <summary>
        /// Initializes a new instance of the <see cref="ConnectionViewModel{T}" /> class.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="buildTracker">The build tracker.</param>
        /// <param name="projectFactory">The project factory.</param>
        /// <param name="removeConnectionFactory">The remove connection factory.</param>
        /// <param name="editConnectionFactory">The edit connection factory.</param>
        /// <param name="settings">The settings.</param>
        public ConnectionViewModel(
            IApp application,
            IPlatformProvider platformProvider,
            IEventAggregator eventAggregator,
            IBuildTracker buildTracker,
            IProjectViewModelFactory projectFactory,
            IRemoveConnectionViewModelFactory removeConnectionFactory,
            IEditConnectionViewModelFactory <T> editConnectionFactory,
            T settings)
            : base(platformProvider)
        {
            Ensure.That(application).IsNotNull();
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(buildTracker).IsNotNull();
            Ensure.That(projectFactory).IsNotNull();
            Ensure.That(removeConnectionFactory).IsNotNull();
            Ensure.That(editConnectionFactory).IsNotNull();
            Ensure.That(settings).IsNotNull();

            _application             = application;
            _eventAggregator         = eventAggregator;
            _projectFactory          = projectFactory;
            _removeConnectionFactory = removeConnectionFactory;
            _editConnectionFactory   = editConnectionFactory;
            Settings    = settings;
            _isBusy     = true;
            _isErrored  = false;
            DisplayName = Properties.Resources.Connection_View;
            KeepAlive   = true;

            WeakEventManager <IBuildTracker, BuildTrackerConnectionErrorEventArgs> .AddHandler(buildTracker, nameof(buildTracker.ConnectionError), BuildTrackerConnectionError);

            WeakEventManager <IBuildTracker, BuildTrackerConnectionProgressEventArgs> .AddHandler(buildTracker, nameof(buildTracker.ConnectionProgressChanged), BuildTrackerConnectionProgressChanged);

            _projects = new BindableCollection <IProjectViewModel>();

            _filteredProjects = new CollectionViewSource
            {
                Source = _projects
            };

            _filteredProjects.Filter += (sender, e) =>
            {
                var project = (IProjectViewModel)e.Item;

                e.Accepted = _matches?.Contains(project) ?? true;
            };

            FilteredProjects = _filteredProjects.View;
        }
        public TabadminControllerEvent(string eventType,
                                       LogLine logLine,
                                       JavaLineMatchResult javaLineMatchResult,
                                       IBuildTracker buildTracker = null)
            : base(logLine, javaLineMatchResult.Timestamp)
        {
            EventType = eventType;

            Class     = javaLineMatchResult.Class;
            Message   = javaLineMatchResult.Message;
            ProcessId = javaLineMatchResult.ProcessId;
            Severity  = javaLineMatchResult.Severity;
            Thread    = javaLineMatchResult.Thread;

            Build = buildTracker?.GetBuild(javaLineMatchResult.Timestamp);
        }
        /// <summary>
        /// Configures build notification.
        /// </summary>
        /// <param name="buildTracker">The build tracker.</param>
        /// <param name="buildNotificationManager">The build notification manager.</param>
        public static void Configure(IBuildTracker buildTracker, IBuildNotificationManager buildNotificationManager)
        {
            Ensure.That(buildTracker).IsNotNull();
            Ensure.That(buildNotificationManager).IsNotNull();

            buildTracker.ProjectProgressChanged += (sender, e) =>
            {
                if (!e.Builds.Any())
                {
                    return;
                }

                foreach (var build in e.Builds)
                {
                    buildNotificationManager.ShowNotification(e.Project, build);
                }
            };
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectViewModel" /> class.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="platformProvider">The platform provider.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="buildTracker">The build tracker.</param>
        /// <param name="buildFactory">The build factory.</param>
        /// <param name="settingsId">The settings identifier.</param>
        /// <param name="projectId">The project identifier.</param>
        /// <param name="projectName">The project name.</param>
        public ProjectViewModel(
            IApp application,
            IPlatformProvider platformProvider,
            IEventAggregator eventAggregator,
            IBuildTracker buildTracker,
            IBuildViewModelFactory buildFactory,
            Guid settingsId,
            string projectId,
            string projectName)
            : base(platformProvider)
        {
            Ensure.That(application).IsNotNull();
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(buildTracker).IsNotNull();
            Ensure.That(buildFactory).IsNotNull();
            Ensure.That(settingsId).IsNotEmpty();
            Ensure.That(projectId).IsNotNullOrWhiteSpace();

            _application     = application;
            _eventAggregator = eventAggregator;
            _buildFactory    = buildFactory;
            _settingsId      = settingsId;
            Id          = projectId;
            _name       = projectName;
            _isBusy     = true;
            _isErrored  = false;
            DisplayName = Properties.Resources.Project_View;

            WeakEventManager <IBuildTracker, BuildTrackerProjectErrorEventArgs> .AddHandler(buildTracker, nameof(buildTracker.ProjectError), BuildTrackerProjectError);

            WeakEventManager <IBuildTracker, BuildTrackerProjectProgressEventArgs> .AddHandler(buildTracker, nameof(buildTracker.ProjectProgressChanged), BuildTrackerProjectProgressChanged);

            _builds = new BindableCollection <IBuildViewModel>();

            _orderedBuilds = new CollectionViewSource
            {
                Source = _builds
            };

            OrderedBuilds = _orderedBuilds.View;
        }
Beispiel #5
0
 public BuildTrackerTests()
 {
     _processingNotificationsCollectorMock = new Mock <IProcessingNotificationsCollector>();
     _buildTracker = new BuildTracker(_processingNotificationsCollectorMock.Object);
     _buildTracker.AddBuild(TestTimestamp, TestBuild);
 }
Beispiel #6
0
 public TabadminControllerEventParser(IBuildTracker buildTracker, IProcessingNotificationsCollector processingNotificationsCollector)
 {
     _buildTracker = buildTracker;
     _processingNotificationsCollector = processingNotificationsCollector;
 }