Ejemplo n.º 1
0
 public void ToggleProvider(TailProviderInfo eventArgs)
 {
     if (_viewModels.ContainsKey(eventArgs.Type))
     {
         // Set the active item.
         ActivateItem(_viewModels[eventArgs.Type]);
     }
     else
     {
         // Close the currently active item.
         this.CloseItem(ActiveItem);
     }
 }
Ejemplo n.º 2
0
        public StreamConfigurationViewModel(ITailProviderService providerService, IEventAggregator eventAggregator)
        {
            _providerService = providerService;
            _eventAggregator = eventAggregator;
            _viewModels      = new Dictionary <Type, ITailConfiguration>();

            // Create the provider information.
            var providers = new List <TailProviderInfo>();

            foreach (var type in providerService.GetProviderTypes())
            {
                var name = _providerService.GetDisplayName(type);
                if (string.IsNullOrWhiteSpace(name))
                {
                    continue;
                }

                var viewModel = _providerService.CreateConfigurationViewModel(type);
                if (viewModel != null)
                {
                    _viewModels.Add(type, viewModel);
                }

                providers.Add(new TailProviderInfo(name, type));
            }

            // Sort all providers by name.
            _providers = new List <TailProviderInfo>(providers.OrderBy(p => p.Name));

            // Select the first provider in the list.
            if (_providers.Count > 0)
            {
                SelectedProvider = Providers[0];
                ToggleProvider(Providers[0]);
            }

            // Set the display name.
            DisplayName = "Open Stream";
        }