Esempio n. 1
0
        /// <summary>
        /// The function creates the folder tree node header
        /// </summary>
        /// <param name="repoItemFolder">the Repository Folder Base</param>
        /// <param name="imageType">Only if need different icon than default one then require to provide it</param>
        /// <returns></returns>
        protected StackPanel NewTVItemFolderHeaderStyle(RepositoryFolderBase repoItemFolder, eImageType imageType = eImageType.Null)
        {
            //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(repoItemFolder, nameof(RepositoryFolderBase.SourceControlStatus));
                sourceControlImage.Width  = 8;
                sourceControlImage.Height = 8;
                sourceControlImage.Margin = new Thickness(0, 0, 2, 0);
                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(() =>
                {
                    repoItemFolder.RefreshFolderSourceControlStatus();
                });
            }

            // Add Item Image
            ImageMakerControl NodeImageType = new ImageMakerControl();

            if (imageType == eImageType.Null)
            {
                GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(NodeImageType, ImageMakerControl.ImageTypeProperty, repoItemFolder, nameof(RepositoryFolderBase.FolderImageType), BindingMode: System.Windows.Data.BindingMode.OneWay);
            }
            else
            {
                NodeImageType.ImageType = imageType;
            }

            NodeImageType.Width  = 16;
            NodeImageType.Height = 16;
            stack.Children.Add(NodeImageType);

            // Add Item header text
            Label itemHeaderLabel = new Label();

            itemHeaderLabel.BindControl(repoItemFolder, "DisplayName");
            stack.Children.Add(itemHeaderLabel);


            return(stack);
        }
Esempio n. 2
0
        protected StackPanel NewTVItemStyle(RepositoryItemBase RI, eImageType imageType, string NameProperty)
        {
            RI.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(RI, nameof(RepositoryItemBase.SourceControlStatus));
                sourceControlImage.Width  = 10;
                sourceControlImage.Height = 10;
                stack.Children.Add(sourceControlImage);
            }

            // Add Item Image
            ImageMakerControl NodeImageType = new ImageMakerControl();

            NodeImageType.ImageType = imageType;
            NodeImageType.Width     = 16;
            NodeImageType.Height    = 16;
            stack.Children.Add(NodeImageType);

            // Add Item header text
            Label itemHeaderLabel = new Label();

            itemHeaderLabel.BindControl(RI, NameProperty);
            stack.Children.Add(itemHeaderLabel);

            // add icon of dirty status
            ImageMakerControl dirtyStatusImage = new ImageMakerControl();

            dirtyStatusImage.BindControl(RI, 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);
        }
Esempio n. 3
0
        /// <summary>
        /// The function creates the folder tree node header
        /// </summary>
        /// <param name="repoItemFolder">the Repository Folder Base</param>
        /// <param name="imageType">Only if need different icon than default one then require to provide it</param>
        /// <returns></returns>
        protected StackPanel NewTVItemFolderHeaderStyle(RepositoryFolderBase repoItemFolder, eImageType imageType = eImageType.Null)
        {
            //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(repoItemFolder, nameof(RepositoryFolderBase.SourceControlStatus));
                repoItemFolder.RefreshFolderSourceControlStatus();
                sourceControlImage.Width  = 8;
                sourceControlImage.Height = 8;
                sourceControlImage.Margin = new Thickness(0, 0, 2, 0);
                stack.Children.Add(sourceControlImage);
            }

            // Add Item Image
            ImageMakerControl NodeImageType = new ImageMakerControl();

            if (imageType == eImageType.Null)
            {
                BindingLib.ControlsBinding.ObjFieldBinding(NodeImageType, ImageMakerControl.ImageTypeProperty, repoItemFolder, nameof(RepositoryFolderBase.FolderImageType), BindingMode: System.Windows.Data.BindingMode.OneWay);
            }
            else
            {
                NodeImageType.ImageType = imageType;
            }

            NodeImageType.Width  = 16;
            NodeImageType.Height = 16;
            stack.Children.Add(NodeImageType);

            // Add Item header text
            Label itemHeaderLabel = new Label();

            itemHeaderLabel.BindControl(repoItemFolder, "DisplayName");
            stack.Children.Add(itemHeaderLabel);


            return(stack);
        }
Esempio n. 4
0
        /// <summary>
        /// Used to set the tree node header with Icon + Title + SourceControlState Icon + ModifiedIndicator
        /// </summary>
        /// <param name="itemObj">The object which the tree node represent</param>
        /// <param name="itemObjTitleProperty">The object title/name field name to bind the node title to</param>
        /// <param name="itemIcon">The ImageMaker icon type to show as the node icon</param>
        /// <param name="itemSourceControlStateIcon">The ImageMaker icon type to show as the SourceControlState icon</param>
        /// <param name="addItemModifiedIndication">Define is to show Change/Modified/Dirty indication or not</param>
        /// <param name="objItemModifiedIndicationBoolPropertyName">The obj Bool field name which reflect if the obj is Dirty/Changed or not- to be used for binding</param>
        /// <returns></returns>
        public static StackPanel NewRepositoryItemTreeHeader(Object itemObj, string itemObjTitleProperty, eImageType itemIcon, eImageType itemSourceControlStateIcon, bool addItemModifiedIndication = false, string objItemModifiedIndicationBoolPropertyName = "")
        {
            StackPanel headerStack = new StackPanel();

            headerStack.Orientation = Orientation.Horizontal;

            //Add icon
            if (itemIcon != eImageType.Null)
            {
                try
                {
                    ImageMakerControl icon = new ImageMakerControl();
                    icon.ImageType = itemIcon;
                    icon.Height    = 16;
                    icon.Width     = 16;
                    headerStack.Children.Add(icon);
                }
                catch (Exception e)
                {
                    Reporter.ToLog(eLogLevel.ERROR, e.StackTrace);
                }
            }

            //Add source control icon
            if (itemSourceControlStateIcon != eImageType.Null)
            {
                try
                {
                    ImageMakerControl sourceControlIcon = new ImageMakerControl();
                    sourceControlIcon.BindControl((RepositoryFolderBase)itemObj, nameof(RepositoryFolderBase.SourceControlStatus));
                    ((RepositoryFolderBase)itemObj).RefreshFolderSourceControlStatus();
                    sourceControlIcon.Height = 10;
                    sourceControlIcon.Width  = 10;
                    headerStack.Children.Add(sourceControlIcon);
                }
                catch (Exception ex)
                {
                    // TODO: write to log
                    Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}");
                }
            }

            //Add Item Title
            try
            {
                Label itemTitleLbl = new Label();
                if (itemObj != null)
                {
                    BindingLib.ControlsBinding.ObjFieldBinding(itemTitleLbl, Label.ContentProperty, itemObj, itemObjTitleProperty);
                }
                else
                {
                    itemTitleLbl.Content = itemObjTitleProperty;
                }
                headerStack.Children.Add(itemTitleLbl);
            }
            catch
            {
            }

            //Add Modified icon
            if (addItemModifiedIndication == true)
            {
                try
                {
                    ImageMakerControl modifiedIcon = new ImageMakerControl();
                    modifiedIcon.ImageType = eImageType.ItemModified;
                    modifiedIcon.Height    = 6;
                    modifiedIcon.Width     = 6;
                    modifiedIcon.SetAsFontImageWithSize = 6;
                    modifiedIcon.Foreground             = Brushes.OrangeRed;
                    modifiedIcon.VerticalAlignment      = VerticalAlignment.Top;
                    modifiedIcon.Margin  = new Thickness(0, 10, 10, 0);
                    modifiedIcon.ToolTip = "This item was modified";
                    if (string.IsNullOrEmpty(objItemModifiedIndicationBoolPropertyName) == false)
                    {
                        BindingLib.ControlsBinding.ObjFieldBinding(modifiedIcon, ImageMakerControl.VisibilityProperty, itemObj, objItemModifiedIndicationBoolPropertyName, BindingMode: BindingMode.OneWay, bindingConvertor: new System.Windows.Controls.BooleanToVisibilityConverter());
                    }
                    headerStack.Children.Add(modifiedIcon);
                }
                catch
                {
                }
            }

            return(headerStack);
        }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        /// <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);
        }