public UIController(IGitHubServiceProvider serviceProvider) : this(serviceProvider, serviceProvider.TryGetService <IRepositoryHosts>(), serviceProvider.TryGetService <IUIFactory>(), serviceProvider.TryGetService <IConnectionManager>()) { }
public GitHubPaneViewModel(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager cm, IUIProvider uiProvider, IVisualStudioBrowser vsBrowser, IUsageTracker usageTracker) : base(serviceProvider, apiFactory, holder) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); Guard.ArgumentNotNull(apiFactory, nameof(apiFactory)); Guard.ArgumentNotNull(holder, nameof(holder)); Guard.ArgumentNotNull(cm, nameof(cm)); Guard.ArgumentNotNull(uiProvider, nameof(uiProvider)); Guard.ArgumentNotNull(vsBrowser, nameof(vsBrowser)); Guard.ArgumentNotNull(usageTracker, nameof(usageTracker)); this.connectionManager = cm; this.uiProvider = uiProvider; this.usageTracker = usageTracker; CancelCommand = ReactiveCommand.Create(); Title = "GitHub"; Message = String.Empty; browser = vsBrowser; this.WhenAnyValue(x => x.Control.DataContext) .Subscribe(x => { var pageViewModel = x as IPanePageViewModel; var searchable = x as ISearchablePanePageViewModel; controlViewModel = x as IViewModel; Title = pageViewModel?.Title ?? "GitHub"; IsSearchEnabled = searchable != null; SearchQuery = searchable?.SearchQuery; }); }
public GitHubPaneViewModel(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager cm, IRepositoryHosts hosts, IUIProvider uiProvider, IVisualStudioBrowser vsBrowser, IUsageTracker usageTracker) : base(serviceProvider, apiFactory, holder) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); Guard.ArgumentNotNull(apiFactory, nameof(apiFactory)); Guard.ArgumentNotNull(holder, nameof(holder)); Guard.ArgumentNotNull(cm, nameof(cm)); Guard.ArgumentNotNull(hosts, nameof(hosts)); Guard.ArgumentNotNull(uiProvider, nameof(uiProvider)); Guard.ArgumentNotNull(vsBrowser, nameof(vsBrowser)); Guard.ArgumentNotNull(usageTracker, nameof(usageTracker)); this.connectionManager = cm; this.hosts = hosts; this.uiProvider = uiProvider; this.usageTracker = usageTracker; CancelCommand = ReactiveCommand.Create(); Title = "GitHub"; Message = String.Empty; browser = vsBrowser; this.WhenAnyValue(x => x.Control.DataContext) .OfType <IPanePageViewModel>() .Select(x => x.WhenAnyValue(y => y.Title)) .Switch() .Subscribe(x => Title = x ?? "GitHub"); }
public GitHubInvitationSection( IGitHubServiceProvider serviceProvider, IDialogService dialogService, IConnectionManager cm, Lazy <IVisualStudioBrowser> browser) : base(serviceProvider) { this.dialogService = dialogService; lazyBrowser = browser; CanConnect = true; CanSignUp = true; ConnectLabel = Resources.GitHubInvitationSectionConnectLabel; SignUpLabel = Resources.SignUpLink; Name = "GitHub"; Provider = "GitHub, Inc."; Description = Resources.BlurbText; OnThemeChanged(); VSColorTheme.ThemeChanged += _ => { OnThemeChanged(); }; IsVisible = cm.Connections.Count == 0; cm.Connections.CollectionChanged += (s, e) => IsVisible = cm.Connections.Count == 0; }
static async Task <CloneDialogResult> ShowCloneDialog( IGitHubServiceProvider gitHubServiceProvider, IProgress <ServiceProgressData> progress, CancellationToken cancellationToken, RepositoryModel repository = null) { var dialogService = gitHubServiceProvider.GetService <IDialogService>(); var cloneService = gitHubServiceProvider.GetService <IRepositoryCloneService>(); var usageTracker = gitHubServiceProvider.GetService <IUsageTracker>(); var cloneUrl = repository?.CloneUrl; if (await dialogService.ShowCloneDialog(null, cloneUrl) is CloneDialogResult result) { try { await cloneService.CloneOrOpenRepository(result, progress, cancellationToken); usageTracker.IncrementCounter(x => x.NumberOfStartPageClones).Forget(); return(result); } catch { var teServices = gitHubServiceProvider.TryGetService <ITeamExplorerServices>(); teServices.ShowError($"Failed to clone the repository '{result.Url.RepositoryName}'"); } } return(null); }
public GitHubConnectSection(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager manager, IPackageSettings packageSettings, IVSServices vsServices, ILocalRepositories localRepositories, int index) : base(serviceProvider, apiFactory, holder, manager) { Guard.ArgumentNotNull(apiFactory, nameof(apiFactory)); Guard.ArgumentNotNull(holder, nameof(holder)); Guard.ArgumentNotNull(manager, nameof(manager)); Guard.ArgumentNotNull(packageSettings, nameof(packageSettings)); Guard.ArgumentNotNull(vsServices, nameof(vsServices)); Guard.ArgumentNotNull(localRepositories, nameof(localRepositories)); Title = "GitHub"; IsEnabled = true; IsVisible = false; LoggedIn = false; sectionIndex = index; this.packageSettings = packageSettings; this.vsServices = vsServices; this.localRepositories = localRepositories; Clone = CreateAsyncCommandHack(DoClone); connectionManager.Connections.CollectionChanged += RefreshConnections; PropertyChanged += OnPropertyChange; UpdateConnection(); }
public VSGitExt(IGitHubServiceProvider serviceProvider, IVSUIContextFactory factory, ILocalRepositoryModelFactory repositoryFactory) { this.serviceProvider = serviceProvider; this.repositoryFactory = repositoryFactory; // The IGitExt service isn't available when a TFS based solution is opened directly. // It will become available when moving to a Git based solution (cause a UIContext event to fire). context = factory.GetUIContext(new Guid(Guids.GitSccProviderId)); // Start with empty array until we have a change to initialize. ActiveRepositories = Array.Empty <ILocalRepositoryModel>(); if (context.IsActive && TryInitialize()) { // Refresh ActiveRepositories on background thread so we don't delay startup. InitializeTask = Task.Run(() => RefreshActiveRepositories()); } else { // If we're not in the UIContext or TryInitialize fails, have another go when the UIContext changes. context.UIContextChanged += ContextChanged; log.Debug("VSGitExt will be initialized later"); InitializeTask = Task.CompletedTask; } }
public GitHubContextService(IGitHubServiceProvider serviceProvider, IGitService gitService, IVSServices vsServices) { this.serviceProvider = serviceProvider; this.gitService = gitService; this.vsServices = vsServices; textManager = new Lazy <IVsTextManager2>(() => serviceProvider.GetService <SVsTextManager, IVsTextManager2>()); }
public TeamExplorerItemBase(IGitHubServiceProvider serviceProvider, ITeamExplorerServiceHolder holder) : base(serviceProvider) { Guard.ArgumentNotNull(holder, nameof(holder)); this.holder = holder; }
public TeamExplorerSectionBase(IGitHubServiceProvider serviceProvider, ITeamExplorerServiceHolder holder) : base(serviceProvider, holder) { IsVisible = false; IsEnabled = true; IsExpanded = true; }
public TeamExplorerItemBase(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder) : this(serviceProvider, holder) { Guard.ArgumentNotNull(apiFactory, nameof(apiFactory)); this.apiFactory = apiFactory; }
public PullRequestEditorService( IGitHubServiceProvider serviceProvider, IPullRequestService pullRequestService, IVsEditorAdaptersFactoryService vsEditorAdaptersFactory, IStatusBarNotificationService statusBar, IGoToSolutionOrPullRequestFileCommand goToSolutionOrPullRequestFileCommand, IEditorOptionsFactoryService editorOptionsFactoryService, IUsageTracker usageTracker) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); Guard.ArgumentNotNull(pullRequestService, nameof(pullRequestService)); Guard.ArgumentNotNull(vsEditorAdaptersFactory, nameof(vsEditorAdaptersFactory)); Guard.ArgumentNotNull(statusBar, nameof(statusBar)); Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(goToSolutionOrPullRequestFileCommand)); Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(editorOptionsFactoryService)); Guard.ArgumentNotNull(usageTracker, nameof(usageTracker)); this.serviceProvider = serviceProvider; this.pullRequestService = pullRequestService; this.vsEditorAdaptersFactory = vsEditorAdaptersFactory; this.statusBar = statusBar; this.goToSolutionOrPullRequestFileCommand = goToSolutionOrPullRequestFileCommand; this.editorOptionsFactoryService = editorOptionsFactoryService; this.usageTracker = usageTracker; }
public UsageService(IGitHubServiceProvider serviceProvider, IEnvironment environment, [Import(AllowDefault = true)] JoinableTaskContext joinableTaskContext) { this.serviceProvider = serviceProvider; this.environment = environment; JoinableTaskContext = joinableTaskContext ?? ThreadHelper.JoinableTaskContext; }
public UIController(IGitHubServiceProvider gitHubServiceProvider, IUIFactory factory, IConnectionManager connectionManager) { Guard.ArgumentNotNull(gitHubServiceProvider, nameof(gitHubServiceProvider)); Guard.ArgumentNotNull(factory, nameof(factory)); Guard.ArgumentNotNull(connectionManager, nameof(connectionManager)); this.factory = factory; this.gitHubServiceProvider = gitHubServiceProvider; this.connectionManager = connectionManager; #if DEBUG if (Application.Current != null && !Splat.ModeDetector.InUnitTestRunner()) { var waitDispatcher = RxApp.MainThreadScheduler as WaitForDispatcherScheduler; if (waitDispatcher != null) { Log.Assert(DispatcherScheduler.Current.Dispatcher == Application.Current.Dispatcher, "DispatcherScheduler is set correctly"); } else { Log.Assert(((DispatcherScheduler)RxApp.MainThreadScheduler).Dispatcher == Application.Current.Dispatcher, "The MainThreadScheduler is using the wrong dispatcher"); } } #endif ConfigureLogicStates(); uiStateMachine = new StateMachineType(UIViewType.None); ConfigureUIHandlingStates(); }
protected PreviousInlineCommentCommand( IGitHubServiceProvider serviceProvider, IViewTagAggregatorFactoryService tagAggregatorFactory, IInlineCommentPeekService peekService) : base(serviceProvider, tagAggregatorFactory, peekService, CommandSet, CommandId) { }
public UsageTracker(IGitHubServiceProvider gitHubServiceProvider) { this.gitHubServiceProvider = gitHubServiceProvider; fileExists = (path) => System.IO.File.Exists(path); readAllText = (path, encoding) => { try { return(System.IO.File.ReadAllText(path, encoding)); } catch { return(null); } }; writeAllText = (path, content, encoding) => { try { System.IO.File.WriteAllText(path, content, encoding); } catch {} }; dirCreate = (path) => System.IO.Directory.CreateDirectory(path); this.timer = new DispatcherTimer( TimeSpan.FromMinutes(3), DispatcherPriority.Background, TimerTick, ThreadingHelper.MainThreadDispatcher); RunTimer(); }
public UIController(IGitHubServiceProvider serviceProvider) : this(serviceProvider, serviceProvider.TryGetService <IUIFactory>(), serviceProvider.TryGetService <IConnectionManager>()) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); }
public EnsureLoggedInSectionSync(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager cm, ITeamExplorerServices teServices, IDialogService dialogService) : base(serviceProvider, apiFactory, holder, cm, teServices, dialogService) { }
public UsageTracker(IGitHubServiceProvider gitHubServiceProvider) { this.gitHubServiceProvider = gitHubServiceProvider; fileExists = (path) => System.IO.File.Exists(path); readAllText = (path, encoding) => { try { return(System.IO.File.ReadAllText(path, encoding)); } catch { return(null); } }; writeAllText = (path, content, encoding) => { try { System.IO.File.WriteAllText(path, content, encoding); } catch {} }; dirCreate = (path) => System.IO.Directory.CreateDirectory(path); this.timer = new Timer( TimerTick, null, TimeSpan.FromMinutes(3), TimeSpan.FromHours(8)); }
protected MenuBase(IGitHubServiceProvider serviceProvider) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); this.serviceProvider = serviceProvider; apiFactory = new Lazy <ISimpleApiClientFactory>(() => ServiceProvider.TryGetService <ISimpleApiClientFactory>()); }
public VSGitServices(IGitHubServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; #if TEAMEXPLORER15 this.statusBar = serviceProvider.GetService <IVsStatusbar>(); #endif }
public TeamExplorerItemBase(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder) : base(serviceProvider) { this.apiFactory = apiFactory; this.holder = holder; }
public CreateGist(IGitHubServiceProvider serviceProvider) : base(serviceProvider) { Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider)); selectedTextProvider = new Lazy <ISelectedTextProvider>(() => ServiceProvider.TryGetService <ISelectedTextProvider>()); }
public ViewViewModelFactory( IGitHubServiceProvider serviceProvider, ICompositionService cc) { this.serviceProvider = serviceProvider; cc.SatisfyImportsOnce(this); }
async Task ShowTeamExplorerPage(IGitHubServiceProvider gitHubServiceProvider) { var te = gitHubServiceProvider?.GetService(typeof(ITeamExplorer)) as ITeamExplorer; if (te != null) { var page = te.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null); if (page == null) { var tcs = new TaskCompletionSource <ITeamExplorerPage>(); PropertyChangedEventHandler handler = null; handler = new PropertyChangedEventHandler((s, e) => { if (e.PropertyName == "CurrentPage") { tcs.SetResult(te.CurrentPage); te.PropertyChanged -= handler; } }); te.PropertyChanged += handler; page = await tcs.Task; } } }
public GitHubConnectSection(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager manager, IPackageSettings packageSettings, IVSServices vsServices, IRepositoryCloneService cloneService, IDialogService dialogService, int index) : base(serviceProvider, apiFactory, holder, manager) { Title = "GitHub"; IsEnabled = true; IsVisible = false; LoggedIn = false; sectionIndex = index; this.packageSettings = packageSettings; this.vsServices = vsServices; this.cloneService = cloneService; this.dialogService = dialogService; Clone = CreateAsyncCommandHack(DoClone); connectionManager.Connections.CollectionChanged += RefreshConnections; PropertyChanged += OnPropertyChange; UpdateConnection(); }
public VSGitServices(IGitHubServiceProvider serviceProvider, Lazy <IStatusBarNotificationService> statusBar, Lazy <ITeamExplorerServices> teamExplorerServices) { this.serviceProvider = serviceProvider; this.statusBar = statusBar; this.teamExplorerServices = teamExplorerServices; }
public EnsureLoggedInSection(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager cm, ITeamExplorerServices teServices) : base(serviceProvider, apiFactory, holder, cm) { IsVisible = false; this.teServices = teServices; }
public GitHubHomeSection(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder) : base(serviceProvider, apiFactory, holder) { Title = "GitHub"; View = new GitHubHomeContent(); View.DataContext = this; }
public TeamExplorerSectionBase(IGitHubServiceProvider serviceProvider, ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder) : base(serviceProvider, apiFactory, holder) { IsVisible = false; IsEnabled = true; IsExpanded = true; }