/// <summary>
 ///     Overridden method called when the navigation link is clicked.
 /// </summary>
 public override void Execute()
 {
     try
     {
         ITeamExplorer teamExplorer = this.GetService <ITeamExplorer>();
         teamExplorer?.NavigateToPage(new Guid(ShelvesetComparerPage.PageId), null);
     }
     catch (Exception ex)
     {
         this.ShowNotification(ex.Message, NotificationType.Error);
     }
 }
 public override void Execute()
 {
     try
     {
         ITeamExplorer teamExplorer = GetService <ITeamExplorer>();
         if (teamExplorer != null)
         {
             teamExplorer.NavigateToPage(new Guid(MyHistoryPage.PageId), null);
         }
     }
     catch (Exception ex)
     {
         this.ShowNotification(ex.Message, NotificationType.Error);
     }
 }
 /// <summary>
 /// This function is the callback used to execute the command when the menu item is clicked.
 /// See the constructor to see how the menu item is associated with this function using
 /// OleMenuCommandService service and MenuCommand class.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 private void ShelvesetComparerTeamExplorerViewIdMenuItemCallback(object sender, EventArgs e)
 {
     try
     {
         ITeamExplorer teamExplorer = GetService <ITeamExplorer>();
         if (teamExplorer != null)
         {
             teamExplorer.NavigateToPage(new Guid(ShelvesetComparerPage.PageId), null);
         }
     }
     catch (Exception ex)
     {
         //this.ShowNotification(ex.Message, NotificationType.Error);
     }
 }
예제 #4
0
 private void MyLink_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ITeamExplorer teamExplorer = this.ParentSection.GetService <ITeamExplorer>();
         if (teamExplorer != null)
         {
             teamExplorer.NavigateToPage(new Guid(MyHistoryPage.PageId), null);
         }
     }
     catch (Exception ex)
     {
         this.ParentSection.ShowNotification(ex.Message, NotificationType.Error);
     }
 }
        /// <summary>
        /// Executes the action of the navigation item.
        /// </summary>
        public override void Execute()
        {
            try
            {
                Logger.PageView("Navigate");
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
                this.ShowNotification(ex.Message, NotificationType.Error);
            }

            ITeamExplorer service = this.GetService <ITeamExplorer>();

            service?.NavigateToPage(new Guid(GitSquashPackage.SquashPageGuidString), null);
        }
예제 #6
0
        private static void SetLastWorkItem(ITeamExplorer teamExplorer, Changeset changeset)
        {
            var workItemId = GetAssociatedWorkItemId(changeset);

            if (workItemId == 0)
                return;

            var pendingChangesPage = (TeamExplorerPageBase)teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.PendingChanges), null);
            var model = (IPendingCheckin)pendingChangesPage.Model;

            var modelType = model.GetType();
            var method = modelType.GetMethod("AddWorkItemsByIdAsync",
                BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            var workItemsIdsArray = new[] { workItemId };
            method.Invoke(model, new object[] { workItemsIdsArray, 1 /* Add */ });

        }
예제 #7
0
        private async void ShowGitCommitsPageInformation()
        {
            string pageGuid = TeamExplorerPageIds.GitCommits;

            ITeamExplorer teamExplorer = await package.GetServiceAsync(typeof(ITeamExplorer)) as ITeamExplorer;

            ITeamExplorerPage teamExplorerPage = teamExplorer.NavigateToPage(new Guid(pageGuid), null);
            var fe           = (FrameworkElement)teamExplorerPage;
            var syncTextLink = fe.FindName("syncTextLink");

            //if (teamExplorerPage.GetExtensibilityService(typeof(ICommitsExt)) is ICommitsExt commitsExt)
            //{
            //    System.Collections.Generic.IReadOnlyList<ICommitsCommitItem> asda = commitsExt.IncomingCommits;
            //    //ShowCommits("IncomingCommits", commitsExt.IncomingCommits);
            //    //ShowCommits("OutgoingCommits", commitsExt.OutgoingCommits);
            //    //ShowCommits("SelectedIncomingCommits", commitsExt.SelectedIncomingCommits);
            //    //ShowCommits("SelectedOutgoingCommits", commitsExt.SelectedOutgoingCommits);
            //}
        }
예제 #8
0
        private static void SetLastWorkItem(ITeamExplorer teamExplorer, Changeset changeset)
        {
            var workItemId = GetAssociatedWorkItemId(changeset);

            if (workItemId == 0)
            {
                return;
            }

            var pendingChangesPage = (TeamExplorerPageBase)teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.PendingChanges), null);
            var model = (IPendingCheckin)pendingChangesPage.Model;

            var modelType = model.GetType();
            var method    = modelType.GetMethod("AddWorkItemsByIdAsync",
                                                BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            var workItemsIdsArray = new[] { workItemId };

            method.Invoke(model, new object[] { workItemsIdsArray, 1 /* Add */ });
        }
        /// <summary>
        /// View details for the changeset.
        /// </summary>
        public void ViewChangesetDetails(int changesetId)
        {
            // The preferred method would be to use VersionControlExt.ViewChangesetDetails, but that
            // method still uses the modal Changeset Details dialog at this time.  As a temporary
            // workaround, navigate to the Changeset Details Team Explorer page and pass the
            // changeset ID.

            //VersionControlExt vcExt = Helpers.GetVersionControlExt(ParentSection.ServiceProvider);
            //if (vcExt != null)
            //{
            //    vcExt.ViewChangesetDetails(changesetId);
            //}

            ITeamExplorer teamExplorer = this.GetService <ITeamExplorer>();

            if (teamExplorer != null)
            {
                teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.ChangesetDetails), changesetId);
            }
        }
예제 #10
0
        public void AddWorkItemsAndCommentThenNavigate(Workspace workspaceModel, string comment, IEnumerable <int> workItemIds)
        {
            var workspace = _tfvcService.GetWorkspace(workspaceModel.Name, workspaceModel.OwnerName);

            var pendingChangePage  = (TeamExplorerPageBase)_teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.PendingChanges), null);
            var pendingChangeModel = pendingChangePage.Model;

            var modelType = pendingChangeModel.GetType();

            var propertyInfo = modelType.GetProperty("Workspace");

            propertyInfo.SetValue(pendingChangeModel, workspace.GetType().GetProperty("Workspace").GetValue(workspace, null));

            var method = modelType.GetMethod("AddWorkItemsByIdAsync", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

            method.Invoke(pendingChangeModel, new object[] { workItemIds.ToArray(), 1 });

            modelType.GetProperty("CheckinComment", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
            .SetValue(pendingChangeModel, comment);
        }
예제 #11
0
        public void AddWorkItemsAndNavigate(IEnumerable <int> changesetIds)
        {
            var workItemIds = new List <int>();

            foreach (var changesetId in changesetIds)
            {
                var changeSet = _changesetService.GetChangeset(changesetId);

                if (changeSet != null && changeSet.AssociatedWorkItems != null)
                {
                    workItemIds.AddRange(changeSet.AssociatedWorkItems.Select(x => x.Id));
                }
            }

            var pendingChangePage  = (TeamExplorerPageBase)_teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.PendingChanges), null);
            var pendingChangeModel = (IPendingCheckin)pendingChangePage.Model;

            var modelType = pendingChangeModel.GetType();
            var method    = modelType.GetMethod("AddWorkItemsByIdAsync", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

            method.Invoke(pendingChangeModel, new object[] { workItemIds.ToArray(), 1 });
        }
		public PendingChangesInclusion(ITeamExplorer teamExplorer)
		{
			var pendingChangesPage = (TeamExplorerPageBase)teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.PendingChanges), null);

			var model = pendingChangesPage.Model;
			var p = model.GetType().GetProperty("DataProvider", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

			var dataProvider = p.GetValue(model); // IPendingChangesDataProvider is internal;
			var dataProviderType = dataProvider.GetType();

			p = dataProviderType.GetProperty("IncludedChanges", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
			var m = p.GetMethod;
			this.getIncludedChanges = (Func<IList<PendingChange>>)m.CreateDelegate(typeof(Func<IList<PendingChange>>), dataProvider);

			p = dataProviderType.GetProperty("ExcludedChanges", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
			m = p.GetMethod;
			this.getExcludedChanges = (Func<IList<PendingChange>>)m.CreateDelegate(typeof(Func<IList<PendingChange>>), dataProvider);

			m = dataProviderType.GetMethod("IncludeChanges", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
			this.includeChanges = (Action<IList<PendingChange>>)m.CreateDelegate(typeof(Action<IList<PendingChange>>), dataProvider);

			m = dataProviderType.GetMethod("ExcludeChanges", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
			this.excludeChanges = (Action<IList<PendingChange>>)m.CreateDelegate(typeof(Action<IList<PendingChange>>), dataProvider);
		}
예제 #13
0
 public void ShowPage(string page)
 {
     System.Windows.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                                               new Action(() =>
                                                                          teamExplorer.NavigateToPage(new Guid(page), null)));
 }
예제 #14
0
 public void Execute()
 {
     _teamExplorer.NavigateToPage(new Guid(Constants.StashPageId), null);
 }
예제 #15
0
 static void NavigateToHomePage(ITeamExplorer teamExplorer)
 {
     teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
 }
예제 #16
0
        /// <summary>
        ///     Opens up the shelveset details page for the given shelveset
        /// </summary>
        /// <param name="shelveset">The shelveset to be displayed.</param>
        public void ViewShelvesetDetails(Shelveset shelveset)
        {
            ITeamExplorer teamExplorer = this.GetService <ITeamExplorer>();

            teamExplorer?.NavigateToPage(new Guid(TeamExplorerPageIds.ShelvesetDetails), shelveset);
        }
 public override void Execute()
 {
     teamExplorer.NavigateToPage(new Guid(GitOperationsGuids.GitSubmodulesPage), null);
 }