Exemplo n.º 1
0
        /// <summary>
        /// update based on 'things happening' via svn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SvnManagerOnSvnStatusUpdatedEvent(object sender, SvnStatusUpdatedEventArgs e)
        {
            var status = _svnManager.Status(e.FullFilePath);

            if (status.IsFile)
            {
                var existingItem = FileStatus.FirstOrDefault(x => x.Path == e.FullFilePath);
                if (null != existingItem)
                {
                    if (status.IsAdded || status.IsModified)
                    {
                        existingItem.Status = status.Status.CombinedStatus.ToString();
                    }
                    else
                    {
                        FileStatus.Remove(existingItem);
                    }
                }
                else
                {
                    if (status.IsAdded || status.IsModified)
                    {
                        FileStatus.Add(new PendingChange()
                        {
                            Path   = status.FullPath,
                            Status = status.Status.CombinedStatus.ToString()
                        });
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="svnStatusUpdatedEventArgs"></param>
        private void SvnManagerOnSvnStatusUpdatedEvent(object sender, SvnStatusUpdatedEventArgs svnStatusUpdatedEventArgs)
        {
            Host.BeginInvoke(() =>
            {
                //GetStudioWindows() is in NationalInstruments.Restricted.Shell and may not always be publicly exposed.
                //This call may need to change at a later date, but should work for now.
                var studioWindows = StudioWindow.GetStudioWindows(Host); //Get all of the StudioWindows
                foreach (StudioWindow studioWindow in studioWindows)     // use each StudioWindow's EditSite to refresh the appropriate icon
                {
                    var editSite = studioWindow.GetEditSite();
                    if (null != editSite) // check editSite != null just in case
                    {
                        var projectExplorerViewModel = editSite?.GetProjectExplorerViewModelFromEditSite();
                        var projectItem = projectExplorerViewModel?.FindProjectItemByFullPath(svnStatusUpdatedEventArgs.FullFilePath);
                        projectItem?.RefreshIcon();
                    }
                }
            });
            var handler = SvnStatusUpdatedEvent;

            handler?.Invoke(this, svnStatusUpdatedEventArgs);
        }