static RepositoryCloneViewModel CreateTarget( IOperatingSystem os = null, IConnectionManager connectionManager = null, IRepositoryCloneService service = null, IUsageService usageService = null, IUsageTracker usageTracker = null, IRepositorySelectViewModel gitHubTab = null, IRepositorySelectViewModel enterpriseTab = null, IGitService gitService = null, IRepositoryUrlViewModel urlTab = null, string defaultClonePath = defaultPath) { os = os ?? Substitute.For <IOperatingSystem>(); connectionManager = connectionManager ?? CreateConnectionManager("https://github.com"); service = service ?? CreateRepositoryCloneService(defaultClonePath); usageService = usageService ?? CreateUsageService(); usageTracker = usageTracker ?? Substitute.For <IUsageTracker>(); gitHubTab = gitHubTab ?? CreateSelectViewModel(); enterpriseTab = enterpriseTab ?? CreateSelectViewModel(); gitService = gitService ?? CreateGitService(true, "https://github.com/owner/repo"); urlTab = urlTab ?? CreateRepositoryUrlViewModel(); return(new RepositoryCloneViewModel( os, connectionManager, service, gitService, usageService, usageTracker, gitHubTab, enterpriseTab, urlTab)); }
public UsageTracker( IGitHubServiceProvider gitHubServiceProvider, IUsageService service) { this.gitHubServiceProvider = gitHubServiceProvider; this.service = service; timer = StartTimer(); }
public UsageTracker( IGitHubServiceProvider gitHubServiceProvider, IUsageService service, IPackageSettings settings) { this.gitHubServiceProvider = gitHubServiceProvider; this.service = service; this.userSettings = settings; timer = StartTimer(); }
public UsageTracker( IGitHubServiceProvider gitHubServiceProvider, IUsageService service, IPackageSettings settings, JoinableTaskContext joinableTaskContext) { this.gitHubServiceProvider = gitHubServiceProvider; this.service = service; this.userSettings = settings; JoinableTaskContext = joinableTaskContext; timer = StartTimer(); }
static Tuple <UsageTracker, Func <Task> > CreateTargetAndGetTick( IGitHubServiceProvider serviceProvider, IUsageService service) { Func <Task> tick = null; service.WhenForAnyArgs(x => x.StartTimer(null, new TimeSpan(), new TimeSpan())) .Do(x => tick = x.ArgAt <Func <Task> >(0)); var target = new UsageTracker(serviceProvider, service); return(Tuple.Create(target, tick)); }
public RepositoryCloneViewModel( IOperatingSystem os, IConnectionManager connectionManager, IRepositoryCloneService service, IGitService gitService, IUsageService usageService, IUsageTracker usageTracker, IRepositorySelectViewModel gitHubTab, IRepositorySelectViewModel enterpriseTab, IRepositoryUrlViewModel urlTab) { this.os = os; this.connectionManager = connectionManager; this.service = service; this.gitService = gitService; this.usageService = usageService; this.usageTracker = usageTracker; GitHubTab = gitHubTab; EnterpriseTab = enterpriseTab; UrlTab = urlTab; tabs = new IRepositoryCloneTabViewModel[] { GitHubTab, EnterpriseTab, UrlTab }; var repository = this.WhenAnyValue(x => x.SelectedTabIndex) .SelectMany(x => tabs[x].WhenAnyValue(tab => tab.Repository)); Path = service.DefaultClonePath; repository.Subscribe(x => UpdatePath(x)); pathWarning = Observable.CombineLatest( repository, this.WhenAnyValue(x => x.Path), ValidatePathWarning) .ToProperty(this, x => x.PathWarning); var canClone = Observable.CombineLatest( repository, this.WhenAnyValue(x => x.Path), (repo, path) => repo != null && !service.DestinationFileExists(path) && !service.DestinationDirectoryExists(path)); var canOpen = Observable.CombineLatest( repository, this.WhenAnyValue(x => x.Path), (repo, path) => repo != null && !service.DestinationFileExists(path) && service.DestinationDirectoryExists(path)); Browse = ReactiveCommand.Create().OnExecuteCompleted(_ => BrowseForDirectory()); Clone = ReactiveCommand.CreateAsyncObservable( canClone, _ => repository.Select(x => new CloneDialogResult(Path, x?.CloneUrl))); Open = ReactiveCommand.CreateAsyncObservable( canOpen, _ => repository.Select(x => new CloneDialogResult(Path, x?.CloneUrl))); }
public UsageViewModel(IEventAggregator eventAggregator, IUsageService usageService, IMenuService menuService, IRegionManager regionManager) { this.eventAggregator = eventAggregator; this.usageService = usageService; this.menuService = menuService; this.regionManager = regionManager; CounterpartyChangeEvent counterpartyChangeEvent = eventAggregator.GetEvent <CounterpartyChangeEvent>(); counterpartyChangeEvent.Subscribe(OnCounterpartyChanged); showUsageCommand = new DelegateCommand(ShowUsage); menuService.RegisterMenu(new MenuEntry() { Text = viewName, Command = showUsageCommand }); }
public UsageDailyViewModel(IEventAggregator eventAggregator, IUsageService usageService, IMenuService menuService, IRegionManager regionManager) { this.eventAggregator = eventAggregator; this.usageService = usageService; this.menuService = menuService; this.regionManager = regionManager; CounterpartyChangeEvent evt = eventAggregator.GetEvent <CounterpartyChangeEvent>(); evt.Subscribe(OnSelectedCounterpartyChanged); // We may be launching this view after the counterparty has been selected e.g. popup window so get the usage for the currently selected counterparty if (usageService.CurrentCounterparty != null) { var usages = usageService.FindLatestUsageByCounterparty(usageService.CurrentCounterparty); Usages = new ObservableCollection <Model.Usage>(usages); } showUsageDailyCommand = new DelegateCommand(ShowUsageDaily); menuService.RegisterMenu(new MenuEntry() { Text = "Daily Usage", Command = showUsageDailyCommand }); showGraphCommand = new DelegateCommand(ShowGraph); menuService.RegisterMenu(new MenuEntry() { Text = "Show Graph", Command = showGraphCommand }); showUsageDailyPopupCommand = new DelegateCommand(ShowUsageDailyPopup); menuService.RegisterMenu(new MenuEntry() { Text = "Show PopUp Daily Usage", Command = showUsageDailyPopupCommand }); }
public UsageController(IUsageService usageService) { _usageService = usageService; }
public UsageController(IUsageService loggerService) { _loggerService = loggerService; }