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

            var removeMethod = checkinEventInfo.GetRemoveMethod(true);

            removeMethod.Invoke(_pendingChangesViewModel, new[] { _checkinDelegate });
        }
예제 #2
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 });
        }
예제 #4
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);
        }