private void TriggerSourceControlIconChanged(List <SourceControlFileInfo> selectedFiles) { parentFolders = new List <string>(); foreach (SourceControlFileInfo fi in selectedFiles) { FileAttributes attr; if (fi.Status != SourceControlFileInfo.eRepositoryItemStatus.Deleted) { attr = File.GetAttributes(fi.Path); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { RepositoryFolderBase repoFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(fi.Path); if (repoFolder != null) { repoFolder.RefreshFolderAndChildElementsSourceControlStatus(); } AddToParentFoldersToRefresh(Directory.GetParent(fi.Path).FullName); } else { RepositoryItemBase repoItem = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByPath(fi.Path); if (repoItem != null) { repoItem.RefreshSourceControlStatus(); } AddToParentFoldersToRefresh(Path.GetDirectoryName(fi.Path)); } } else { AddToParentFoldersToRefresh(Directory.GetParent(fi.Path).FullName); } } //refresh parent folders foreach (string folder in parentFolders) { WorkSpace.Instance.SolutionRepository.RefreshParentFoldersSoucerControlStatus(folder); } }
/// <summary> /// The function creates the tree node item header /// </summary> /// <param name="repoItem">The repository item which the tree nodes represents</param> /// <param name="imageType">The image type which associated with the repository item- should be pulled from the repoItem</param> /// <param name="NameProperty">The field of the item which holds the item name or static name in case the repository item is null</param> /// <returns></returns> protected StackPanel NewTVItemHeaderStyle(RepositoryItemBase repoItem, eImageType imageType = eImageType.Null, string NameProperty = "") { //The new item style with Source control StackPanel stack = new StackPanel(); stack.Orientation = Orientation.Horizontal; if (WorkSpace.Instance.SourceControl != null) { // Source control image ImageMakerControl sourceControlImage = new ImageMakerControl(); sourceControlImage.BindControl(repoItem, nameof(RepositoryItemBase.SourceControlStatus)); sourceControlImage.Width = 8; sourceControlImage.Height = 8; stack.Children.Add(sourceControlImage); // Since it might take time to get the item status from SCM server // we run it on task so update will happen when status come back and we do not block the UI Task.Factory.StartNew(() => { repoItem.RefreshSourceControlStatus(); }); } // Add Item Image ImageMakerControl NodeImageType = new ImageMakerControl(); if (imageType == eImageType.Null) { NodeImageType.ImageType = repoItem.ItemImageType; } else { NodeImageType.ImageType = imageType; } NodeImageType.Width = 16; NodeImageType.Height = 16; stack.Children.Add(NodeImageType); // Add Item header text Label itemHeaderLabel = new Label(); string nameFieldProperty; if (string.IsNullOrEmpty(NameProperty)) { nameFieldProperty = repoItem.ItemNameField; } else { nameFieldProperty = NameProperty; } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(itemHeaderLabel, Label.ContentProperty, repoItem, nameFieldProperty, BindingMode: System.Windows.Data.BindingMode.OneWay); stack.Children.Add(itemHeaderLabel); // add icon of dirty status ImageMakerControl dirtyStatusImage = new ImageMakerControl(); dirtyStatusImage.BindControl(repoItem, nameof(RepositoryItemBase.DirtyStatusImage)); dirtyStatusImage.Width = 6; dirtyStatusImage.Height = 6; dirtyStatusImage.VerticalAlignment = VerticalAlignment.Top; dirtyStatusImage.Margin = new Thickness(0, 10, 10, 0); stack.Children.Add(dirtyStatusImage); return(stack); }
/// <summary> /// The function creates the tree node item header /// </summary> /// <param name="repoItem">The repository item which the tree nodes represents</param> /// <param name="imageType">The image type which associated with the repository item- should be pulled from the repoItem</param> /// <param name="NameProperty">The field of the item which holds the item name or static name in case the repository item is null</param> /// <returns></returns> protected StackPanel NewTVItemHeaderStyle(RepositoryItemBase repoItem, eImageType imageType = eImageType.Null, string NameProperty = "") { //TODO: Move to biz flow page? repoItem.StartDirtyTracking(); //The new item style with Source control StackPanel stack = new StackPanel(); stack.Orientation = Orientation.Horizontal; if (WorkSpace.Instance.SourceControl != null) { // Source control image ImageMakerControl sourceControlImage = new ImageMakerControl(); sourceControlImage.BindControl(repoItem, nameof(RepositoryItemBase.SourceControlStatus)); repoItem.RefreshSourceControlStatus(); sourceControlImage.Width = 8; sourceControlImage.Height = 8; stack.Children.Add(sourceControlImage); } // Add Item Image ImageMakerControl NodeImageType = new ImageMakerControl(); if (imageType == eImageType.Null) { NodeImageType.ImageType = repoItem.ItemImageType; } else { NodeImageType.ImageType = imageType; } NodeImageType.Width = 16; NodeImageType.Height = 16; stack.Children.Add(NodeImageType); // Add Item header text Label itemHeaderLabel = new Label(); string nameFieldProperty; if (string.IsNullOrEmpty(NameProperty)) { nameFieldProperty = repoItem.ItemNameField; } else { nameFieldProperty = NameProperty; } BindingLib.ControlsBinding.ObjFieldBinding(itemHeaderLabel, Label.ContentProperty, repoItem, nameFieldProperty, BindingMode: System.Windows.Data.BindingMode.OneWay); stack.Children.Add(itemHeaderLabel); // add icon of dirty status ImageMakerControl dirtyStatusImage = new ImageMakerControl(); dirtyStatusImage.BindControl(repoItem, nameof(RepositoryItemBase.DirtyStatusImage)); dirtyStatusImage.Width = 6; dirtyStatusImage.Height = 6; dirtyStatusImage.VerticalAlignment = VerticalAlignment.Top; dirtyStatusImage.Margin = new Thickness(0, 10, 10, 0); stack.Children.Add(dirtyStatusImage); return(stack); }