Exemplo n.º 1
0
        public SourcesControlViewModel(ISourceService sourceService, Func <string, Uri, Type, SourceTabViewModel> sourceViewModelFactory)
        {
            if (sourceService == null)
            {
                throw new ArgumentNullException("sourceService");
            }

            if (sourceViewModelFactory == null)
            {
                throw new ArgumentNullException("sourceViewModelFactory");
            }

            this.sourceViewModelFactory = sourceViewModelFactory;
            this.Sources = new ObservableCollection <SourceTabViewModel>
            {
                sourceViewModelFactory("This PC", null, typeof(LocalSourceControl))
            };

            foreach (var source in sourceService.GetSources())
            {
                this.Sources.Add(this.sourceViewModelFactory(source.Name, new Uri(source.Url), typeof(RemoteSourceControl)));
            }

            this.SelectedSource = this.Sources[0];

            SourcesChangedEventManager.AddListener(sourceService, this);
        }
Exemplo n.º 2
0
        public MainWindowViewModel(ISourceService sourceService, IProgressService progressService, Lazy <IPackageService> packageServiceLazy)
        {
            _sourceService   = sourceService;
            _progressService = progressService;
            _packageService  = packageServiceLazy;
            Sources          = new ObservableCollection <SourceViewModel>(_sourceService.GetSources());

            SourcesChangedEventManager.AddListener(sourceService, this);
        }
        public MainWindowViewModel(ISourceService sourceService, IProgressService progressService, IVersionNumberProvider versionNumberProvider)
        {
            if (sourceService == null)
            {
                throw new ArgumentNullException("sourceService");
            }

            this._sourceService         = sourceService;
            this._progressService       = progressService;
            this._versionNumberProvider = versionNumberProvider;
            this.Sources = new ObservableCollection <SourceViewModel>(this._sourceService.GetSources());

            SourcesChangedEventManager.AddListener(sourceService, this);
        }
Exemplo n.º 4
0
        public SourcesControlViewModel(ISourceService sourceService, Func <string, Uri, Type, SourceTabViewModel> sourceVmFactory)
        {
            _sourceVmFactory = sourceVmFactory;
            Sources          = new ObservableCollection <SourceTabViewModel>
            {
                sourceVmFactory("This PC", null, typeof(LocalSourceControl))
            };

            foreach (var source in sourceService.GetSources())
            {
                Sources.Add(_sourceVmFactory(source.Name, new Uri(source.Url), typeof(RemoteSourceControl)));
            }

            SelectedSource = Sources[0];

            SourcesChangedEventManager.AddListener(sourceService, this);
        }