Exemple #1
0
 protected override void OnPageChanged(ITeamExplorerPage page)
 {
     if (IsEnabled)
     {
         ExtendChangesetDetailPage(page);
     }
 }
Exemple #2
0
        private async void ExtendChangesetDetailPage(ITeamExplorerPage page)
        {
            await Task.Delay(1000);

            Check.TryCatch <Exception>(() =>
            {
                var grid = ((dynamic)ExposedObject.From(TeamExplorer.CurrentPage.PageContent)).Content as Grid;
                if (grid != null)
                {
                    var header = grid.FindDescendants <FlowDocumentScrollViewer>(viewer => viewer.Uid == "changesetPageHeader").FirstOrDefault();
                    if (header != null)
                    {
                        var changeset = page.FindChangesetFromTeamExplorerPage();

                        if (changeset != null)
                        {
                            header.Visibility = Visibility.Collapsed;

                            var stackPanel = new StackPanel {
                                Orientation = Orientation.Vertical, Margin = new Thickness(2, 3, 0, 3)
                            };
                            stackPanel.Children.Add(new TextBox
                            {
                                Text            = string.Format("Changeset {0}", changeset.ChangesetId),
                                IsReadOnly      = true,
                                Background      = System.Windows.Media.Brushes.Transparent,
                                BorderThickness = new Thickness(0),
                                FontWeight      = FontWeights.SemiBold,
                                FontSize        = 16
                            });
                            var stackPanel2 = new StackPanel {
                                Orientation = Orientation.Horizontal, Margin = new Thickness(0, 0, 0, 3)
                            };
                            stackPanel2.Children.Add(new TextLink
                            {
                                Margin           = new Thickness(4, 5, 0, 4),
                                Text             = string.Format(changeset.CommitterDisplayName),
                                Background       = System.Windows.Media.Brushes.Transparent,
                                BorderThickness  = new Thickness(0),
                                Command          = StaticCommands.UserInfoCommand,
                                CommandParameter = changeset.Committer
                            });
                            stackPanel2.Children.Add(new TextBox
                            {
                                Margin          = new Thickness(2, 4, 0, 4),
                                Text            = string.Format(changeset.CreationDate.ToString(CultureInfo.CurrentCulture)),
                                Background      = System.Windows.Media.Brushes.Transparent,
                                BorderThickness = new Thickness(0),
                                IsReadOnly      = true
                            });
                            stackPanel.Children.Add(stackPanel2);
                            grid.Children.Add(stackPanel);
                            Grid.SetColumn(stackPanel, 0);
                        }
                    }
                }
            });
        }
        protected override async void OnPageChanged(ITeamExplorerPage page)
        {
            if (IsEnabled)
            {
                await WaitForLoad();

                if (IsCurrentPageInSectionPlacement())
                {
                    ExtendUI();
                }
            }
        }
Exemple #4
0
        protected Guid ShowNotificationOnPage(string message, NotificationType type, ITeamExplorerPage page, ICommand command = null)
        {
            var teamExplorer = GetService <ITeamExplorer>();

            if (teamExplorer != null)
            {
                Guid guid = Guid.NewGuid();
                TeamExplorerUtils.Instance.ShowNotification(ServiceProvider, message, type, NotificationFlags.None, command, guid, page);
                return(guid);
            }

            return(Guid.Empty);
        }
        protected override async void OnPageChanged(ITeamExplorerPage page)
        {
            page?.OnChange(() => page.IsBusy, b => UpdateCanExecute(), true);
            UpdateCanExecute();
            if (IsEnabled)
            {
                await WaitForLoad();

                if (IsCurrentPageInSectionPlacement())
                {
                    ExtendUI();
                }
            }
        }
Exemple #6
0
        internal static void UpdateSectionIncluded(ITeamExplorerPage teamExplorerPage)
        {
            var pageAttribute = teamExplorerPage?.GetType().GetAttributes <TeamExplorerPageAttribute>(true).FirstOrDefault();

            if (!string.IsNullOrEmpty(pageAttribute?.Id))
            {
                var pageId = pageAttribute.Id;
                foreach (var section in teamExplorerPage.GetSections())
                {
                    if (section != null)
                    {
                        var pageInfo = new PageInfo(pageId, 0, section.GetType().Name);
                        SetSectionIsIncluded(section, pageInfo.IsIncluded);
                    }
                }
            }
        }
        private void SubscribeCheckinComleted()
        {
            var pendingChangesPage = GetPendingChangesPage(SectionContent as DependencyObject);

            _pendingChangesViewModel = pendingChangesPage.ViewModel;

            var checkinEventInfo = _pendingChangesViewModel.GetType()
                                   .BaseType.GetEvent("CheckinCompleted", BindingFlags.NonPublic | BindingFlags.Instance);

            Action <object, object> handler = OnCheckinCompleted;

            _checkinDelegate = Delegate.CreateDelegate(checkinEventInfo.EventHandlerType, handler.Target, handler.Method);

            var addMethod = checkinEventInfo.GetAddMethod(true);

            addMethod.Invoke(_pendingChangesViewModel, new[] { _checkinDelegate });
        }
Exemple #8
0
        public static Changeset FindChangesetFromTeamExplorerPage(this ITeamExplorerPage page)
        {
            PropertyInfo property = page.GetType().GetProperty("ViewModel");

            if (property != null)
            {
                var changesetDetailsPageViewModel = property.GetValue(page);
                if (changesetDetailsPageViewModel != null)
                {
                    var changeSetprop = changesetDetailsPageViewModel.GetType().GetProperty("Changeset");
                    if (changeSetprop != null)
                    {
                        var changeset = changeSetprop.GetValue(changesetDetailsPageViewModel) as Changeset;
                        return(changeset);
                    }
                }
            }
            return(null);
        }
        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);
            //}
        }
 /// <summary>
 ///     Shows the warning message in the team explorer.
 /// </summary>
 /// <param name="warningMessage">The warning message.</param>
 /// <param name="teamExplorerPage">
 ///     The team explorer page. If none / [null] is provided, it will be displayed on the
 ///     <see cref="CurrentTeamExplorerPage">currently active page</see>.
 /// </param>
 /// <param name="commandToExecuteOnClick">
 ///     The command to execute on click. Use [null] for no command / action to perform on
 ///     click.
 /// </param>
 /// <param name="notificationId">
 ///     The notification identifier. Optional, if one is provided it can either be used in
 ///     <see cref="IsNotificationVisibleInTeamExplorer" /> or <see cref="HideNotificationInTeamExplorer" />.
 /// </param>
 protected void ShowWarningInTeamExplorer(string warningMessage, ITeamExplorerPage teamExplorerPage = null, ICommand commandToExecuteOnClick = null, Guid notificationId = default(Guid))
 {
     ShowNotificationInTeamExplorer(warningMessage, NotificationType.Warning, teamExplorerPage, commandToExecuteOnClick, notificationId);
 }
 /// <summary>
 ///     Shows the (information) message in the team explorer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="teamExplorerPage">
 ///     The team explorer page. If none / [null] is provided, it will be displayed on the
 ///     <see cref="CurrentTeamExplorerPage">currently active page</see>.
 /// </param>
 /// <param name="commandToExecuteOnClick">
 ///     The command to execute on click. Use [null] for no command / action to perform on
 ///     click.
 /// </param>
 /// <param name="notificationId">
 ///     The notification identifier. Optional, if one is provided it can either be used in
 ///     <see cref="IsNotificationVisibleInTeamExplorer" /> or <see cref="HideNotificationInTeamExplorer" />.
 /// </param>
 protected void ShowMessageInTeamExplorer(string message, ITeamExplorerPage teamExplorerPage = null, ICommand commandToExecuteOnClick = null, Guid notificationId = default(Guid))
 {
     ShowNotificationInTeamExplorer(message, NotificationType.Information, teamExplorerPage, commandToExecuteOnClick, notificationId);
 }
        /// <summary>
        ///     Shows a notification in the team explorer.
        /// </summary>
        /// <param name="message">The message to display.</param>
        /// <param name="notificationType">The notification type.</param>
        /// <param name="teamExplorerPage">
        ///     The team explorer page. If none / [null] is provided, it will be displayed on the
        ///     <see cref="CurrentTeamExplorerPage">currently active page</see>.
        /// </param>
        /// <param name="commandToExecuteOnClick">
        ///     The command to execute on click. Use [null] for no command / action to perform on
        ///     click.
        /// </param>
        /// <param name="notificationId">
        ///     The notification identifier. Optional, if one is provided it can either be used in
        ///     <see cref="IsNotificationVisibleInTeamExplorer" /> or <see cref="HideNotificationInTeamExplorer" />.
        /// </param>
        /// <param name="notificationFlags">The notification flags.</param>
        protected void ShowNotificationInTeamExplorer(string message, NotificationType notificationType = NotificationType.Information, ITeamExplorerPage teamExplorerPage = null, ICommand commandToExecuteOnClick = null, Guid notificationId = default(Guid), NotificationFlags notificationFlags = NotificationFlags.None)
        {
            Debug.Assert(!string.IsNullOrWhiteSpace(message), "No empty notifications, please.");

            TeamExplorerUtils.Instance.ShowNotification(ServiceProvider, message, notificationType, notificationFlags, commandToExecuteOnClick, notificationId == default(Guid) ? Guid.NewGuid() : notificationId, teamExplorerPage);
        }
 /// <summary>
 ///     Shows the error message in the team explorer.
 /// </summary>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="teamExplorerPage">
 ///     The team explorer page. If none / [null] is provided, it will be displayed on the
 ///     <see cref="CurrentTeamExplorerPage">currently active page</see>.
 /// </param>
 /// <param name="commandToExecuteOnClick">
 ///     The command to execute on click. Use [null] for no command / action to perform on
 ///     click.
 /// </param>
 /// <param name="notificationId">
 ///     The notification identifier. Optional, if one is provided it can either be used in
 ///     <see cref="IsNotificationVisibleInTeamExplorer" /> or <see cref="HideNotificationInTeamExplorer" />.
 /// </param>
 protected void ShowErrorInTeamExplorer(string errorMessage, ITeamExplorerPage teamExplorerPage = null, ICommand commandToExecuteOnClick = null, Guid notificationId = default(Guid))
 {
     ShowNotificationInTeamExplorer(errorMessage, NotificationType.Error, teamExplorerPage, commandToExecuteOnClick, notificationId);
 }
 /// <summary>
 ///     Clears any notifications in the team explorer.
 /// </summary>
 /// <param name="teamExplorerPage">
 ///     The team explorer page. If none is provided, the <see cref="CurrentTeamExplorerPage" />
 ///     will be used.
 /// </param>
 protected void ClearNotificationsInTeamExplorer(ITeamExplorerPage teamExplorerPage = null)
 {
     TeamExplorerUtils.Instance.ClearNotifications(ServiceProvider, teamExplorerPage);
 }
 void ITeamExplorer.ClosePage(ITeamExplorerPage page)
 {
     throw new NotImplementedException();
 }
 void ITeamExplorer.ClosePage(ITeamExplorerPage page)
 {
     throw new NotImplementedException();
 }
Exemple #17
0
 protected virtual void OnPageChanged(ITeamExplorerPage obj)
 {
 }