Exemplo n.º 1
0
        /// <summary>
        /// Needs the reload data.
        /// </summary>
        protected virtual bool IsChangeData(IList <TDataContext> filteringItems)
        {
            // Diff number of element
            if (filteringItems.Count != this.Items.Count)
            {
                return(true);
            }

            // Equal number element but diff inner data
            var listFilteringItemName = filteringItems.Select(n => n.Name).ToList();
            var listCurItemName       = this.Items.Select(n => n.Name).ToList();

            if (VSProjectHelper.Equals(listCurItemName, listFilteringItemName))
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Needs the reload data.
        /// </summary>
        /// <param name="filteringItems">The filtering items.</param>
        /// <returns><c>true</c> if [is change data] [the specified filtering items]; otherwise, <c>false</c>.</returns>
        protected override bool IsChangeData(IList <Nuget> filteringItems)
        {
            Logger.Debug("IsChangeData...");

            // Diff number of element
            if (filteringItems.Count != this.Items.Count)
            {
                Logger.Debug($"IsChangeData...DONE - Result=[{true}]");
                return(true);
            }

            // Equal number element but diff inner data
            var listFilteringItemName = filteringItems.Select(n => n.Name).ToList();
            var listCurItemName       = this.Items.Select(n => n.Name).ToList();

            if (VSProjectHelper.Equals(listCurItemName, listFilteringItemName))
            {
                // Verify child items
                for (var i = 0; i < this.Items.Count; i++)
                {
                    var filterItems   = filteringItems[i].Items.Select(n => n.Name).ToList();
                    var sourceItems   = this.Items[i].Items.Select(n => n.Name).ToList();
                    var compareResult = VSProjectHelper.Equals(sourceItems, filterItems);
                    if (!compareResult)
                    {
                        Logger.Debug($"IsChangeData...DONE - Result=[{true}]");
                        return(true);
                    }
                }
            }
            else // Not equals
            {
                Logger.Debug($"IsChangeData...DONE - Result=[{true}]");
                return(true);
            }
            Logger.Debug($"IsChangeData...DONE - Result=[{false}]");
            return(false);
        }