Example #1
0
        public void Handle(MessageEvent applicationEvent)
        {
            if (IsPaused)
            {
                return;
            }

            var vm = new MessageEventViewModel(applicationEvent.Relevance, applicationEvent.Title, applicationEvent.Message);

            _dispacher.Foreground(() => _events.Insert(0, vm));
        }
        public ResolveOperationViewModel(
            string resolveOperationId,
            IHistoricalItemStore <ResolveOperation> historicalItemStore,
            IDispatcher dispatcher)
        {
            if (resolveOperationId == null)
            {
                throw new ArgumentNullException("resolveOperationId");
            }
            if (historicalItemStore == null)
            {
                throw new ArgumentNullException("historicalItemStore");
            }

            dispatcher.Background(() =>
            {
                ResolveOperation resolveOperation;
                if (historicalItemStore.TryGetItem(resolveOperationId, out resolveOperation))
                {
                    var subOperations = Traverse.PreOrder(resolveOperation, r => r.SubOperations)
                                        .Select(o => new SubResolveOperationViewModel(o))
                                        .ToList();

                    dispatcher.Foreground(() =>
                    {
                        foreach (var subResolveOperationViewModel in subOperations)
                        {
                            _subOperations.Add(subResolveOperationViewModel);
                        }
                    });
                }
            });
        }
        public ResolveOperationViewModel(
            string resolveOperationId,
            IHistoricalItemStore<ResolveOperation> historicalItemStore,
            IDispatcher dispatcher)
        {
            if (resolveOperationId == null) throw new ArgumentNullException("resolveOperationId");
            if (historicalItemStore == null) throw new ArgumentNullException("historicalItemStore");

            dispatcher.Background(() =>
            {
                ResolveOperation resolveOperation;
                if (historicalItemStore.TryGetItem(resolveOperationId, out resolveOperation))
                {
                    var subOperations = Traverse.PreOrder(resolveOperation, r => r.SubOperations)
                        .Select(o => new SubResolveOperationViewModel(o))
                        .ToList();
                    
                    dispatcher.Foreground(() =>
                    {
                        foreach (var subResolveOperationViewModel in subOperations)
                            _subOperations.Add(subResolveOperationViewModel);
                    });
                }
            });
        }
Example #4
0
        public ComponentsViewModel(
            INavigator navigator,
            IHistoricalItemStore <Component> components,
            IHistoricalItemStore <RegistrationSource> registrationSources,
            IApplicationEventBus applicationEventBus,
            IDispatcher dispatcher)
        {
            _navigator                = navigator;
            _applicationEventBus      = applicationEventBus;
            _dispatcher               = dispatcher;
            _filteredSortedComponents = new ListCollectionView(_components);
            _filteredSortedComponents.SortDescriptions.Add(new SortDescription("Description", ListSortDirection.Ascending));

            dispatcher.Background(() =>
            {
                _applicationEventBus.Subscribe(this);
                var vms = new List <object>();
                vms.AddRange(components.GetItems().Select(CreateViewModel));
                vms.AddRange(registrationSources.GetItems().Select(CreateViewModel));
                dispatcher.Foreground(() =>
                {
                    foreach (var vm in vms)
                    {
                        _components.Add(vm);
                    }
                });
            });
        }
        public ComponentDetailViewModel(string componentId, IDispatcher dispatcher, IActiveItemRepository<Component> components)
        {
            dispatcher.Background(() =>
            {
                Component component;
                if (!components.TryGetItem(componentId, out component))
                    throw new ArgumentException("Unknown component.");

                var description = component.Description;
                var services = component.DescribeServices();
                var metadata = component.Metadata;
                var sharing = component.Sharing;
                var lifetime = component.Lifetime;
                var activator = component.Activator;
                var ownership = component.Ownership;
                var target = component.TargetComponentId;
                var id = component.Id;

                dispatcher.Foreground(() =>
                {
                    Description = description;
                    Metadata = metadata;
                    Services = services;
                    Sharing = sharing.ToString();
                    Lifetime = lifetime.ToString();
                    Activator = activator.ToString();
                    Ownership = ownership.ToString();
                    Target = target;
                    Id = id;
                });
            });
        }
        public ComponentDetailViewModel(string componentId, IDispatcher dispatcher, IActiveItemRepository <Component> components)
        {
            dispatcher.Background(() =>
            {
                Component component;
                if (!components.TryGetItem(componentId, out component))
                {
                    throw new ArgumentException("Unknown component.");
                }

                var description = component.Description;
                var services    = component.DescribeServices();
                var metadata    = component.Metadata;
                var sharing     = component.Sharing;
                var lifetime    = component.Lifetime;
                var activator   = component.Activator;
                var ownership   = component.Ownership;
                var target      = component.TargetComponentId;
                var id          = component.Id;

                dispatcher.Foreground(() =>
                {
                    Description = description;
                    Metadata    = metadata;
                    Services    = services;
                    Sharing     = sharing.ToString();
                    Lifetime    = lifetime.ToString();
                    Activator   = activator.ToString();
                    Ownership   = ownership.ToString();
                    Target      = target;
                    Id          = id;
                });
            });
        }
Example #7
0
 public void Handle(ProfilerConnectedEvent e)
 {
     _dispatcher.Foreground(() =>
     {
         _isConnected       = true;
         ProcessDescription = e.Name + " (" + e.Id + ")";
         Connected(this, new SessionConnectedEventArgs(e.Name, e.Id));
         Navigate <EventsView>();
         _navigationJournal.ClearHistory();
     });
 }
Example #8
0
        public void Handle(ItemCreatedEvent <Component> applicationEvent)
        {
            var vm = CreateViewModel(applicationEvent.Item);

            _dispatcher.Foreground(() => _components.Add(vm));
        }