private void FilterEntities()
        {
            List <object> list = new List <object>();

            foreach (var entity in _game.Entities)
            {
                var tags     = entity.Value.Tags.Select(GetTagKeyValue).Aggregate((c, n) => c + " | " + n);
                var card     = GameV2.GetCardFromId(entity.Value.CardId);
                var cardName = card != null ? card.Name : "";
                var name     = string.IsNullOrEmpty(entity.Value.Name) ? cardName : entity.Value.Name;
                list.Add(new { Name = name, entity.Value.CardId, Tags = tags });
            }

            var firstNotSecond = list.Except(_previous).ToList();
            var secondNotFirst = _previous.Except(list).ToList();

            if (firstNotSecond.Any() || secondNotFirst.Any())
            {
                DataGridProperties.ItemsSource = list;
                DataGridProperties.UpdateLayout();
                foreach (var item in firstNotSecond)
                {
                    var row = DataGridProperties.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
                    if (row != null)
                    {
                        row.Background = new SolidColorBrush(Color.FromArgb(50, 0, 205, 0));
                    }
                }
                _previous = list;
            }
        }
        private void FilterGame()
        {
            List <object> list  = new List <object>();
            var           props = typeof(GameV2).GetProperties().OrderBy(x => x.Name);

            foreach (var prop in props)
            {
                if (prop.Name == "HSLogLines" || prop.Name == "Entities")
                {
                    continue;
                }
                string val     = "";
                var    propVal = prop.GetValue(_game, null);
                if (propVal != null)
                {
                    var enumerable = propVal as IEnumerable <object>;
                    var collection = propVal as ICollection;
                    if (enumerable != null)
                    {
                        enumerable = enumerable.Where(x => x != null);
                        if (enumerable.Any())
                        {
                            val = enumerable.Select(x => x.ToString()).Aggregate((c, n) => c + ", " + n);
                        }
                    }
                    else if (collection != null)
                    {
                        var objects = collection.Cast <object>().Where(x => x != null);
                        if (objects.Any())
                        {
                            val = objects.Select(x => x.ToString()).Aggregate((c, n) => c + ", " + n);
                        }
                    }
                    else
                    {
                        val = propVal.ToString();
                    }
                }
                list.Add(new { Property = prop.Name, Value = val });
            }
            var firstNotSecond = list.Except(_previous).ToList();
            var secondNotFirst = _previous.Except(list).ToList();

            if (firstNotSecond.Any() || secondNotFirst.Any())
            {
                DataGridProperties.ItemsSource = list;
                DataGridProperties.UpdateLayout();
                foreach (var item in firstNotSecond)
                {
                    var row = DataGridProperties.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
                    if (row != null)
                    {
                        row.Background = new SolidColorBrush(Color.FromArgb(50, 0, 205, 0));
                    }
                }
                _previous = list;
            }
        }
        private static bool GetElementSpecificControlProperties(DependencyObject element, out string controlId,
                                                                out string currentText, out string controlType, out string parentDialogName)
        {
            parentDialogName = null;

            switch (element)
            {
            case RibbonTab ribbonTab:
            {
                controlId   = ribbonTab.Name;
                currentText = ribbonTab.Header as string;
                controlType = typeof(RibbonTab).Name;
                break;
            }

            case RibbonGroup ribbonGroup:
            {
                controlId   = ribbonGroup.Name;
                currentText = ribbonGroup.Header as string;
                controlType = typeof(RibbonGroup).Name;
                break;
            }

            case TabItem tabItem:
            {
                controlId   = tabItem.Name;
                currentText = tabItem.Header as string;
                controlType = typeof(TabItem).Name;

                break;
            }

            case RibbonButton ribbonButton:
            {
                controlId   = ribbonButton.Name;
                currentText = ribbonButton.Content as string;
                controlType = typeof(RibbonButton).Name;
                break;
            }

            case Label label:
            {
                controlId   = label.Name;
                currentText = label.Content as string;
                controlType = typeof(Label).Name;
                break;
            }

            case Button button:
            {
                controlId   = button.Name;
                currentText = button.Content as string;
                controlType = typeof(Button).Name;
                break;
            }

            case RadioButton radioButton:
            {
                controlId   = radioButton.Name;
                currentText = radioButton.Content as string;
                controlType = typeof(RadioButton).Name;
                break;
            }

            case CheckBox checkBox:
            {
                controlId   = checkBox.Name;
                currentText = checkBox.Content as string;
                controlType = typeof(CheckBox).Name;
                break;
            }

            case TextBlock textBox:
            {
                controlId   = textBox.Name;
                currentText = textBox.Text;
                controlType = typeof(TextBlock).Name;
                break;
            }

            case DataGridColumnHeader columnHeader:
            {
                controlId   = DataGridProperties.GetName(columnHeader.Column);
                currentText = columnHeader.Content as string;
                controlType = typeof(DataGridColumn).Name;
                break;
            }

            case DataGridColumn column:
            {
                controlId   = DataGridProperties.GetName(column);
                currentText = column.Header as string;
                controlType = typeof(DataGridColumn).Name;
                try
                {
                    //column itself is not in the VisualTree, since it isn't a Visual.
                    parentDialogName = GetParentDialogName(LogicalTreeUtils.GetDataGridParent(column));
                }
                catch
                {
                    Logger.Log(LogLevel.Debug, "Unable to find parent of DataGridColumn.");
                }

                break;
            }

            default:
            {
                controlId   = null;
                currentText = null;
                controlType = null;
                Logger.Log(LogLevel.Trace,
                           $"GetControlProperties was called for non translatable type ({element.GetType()}).");

                return(false);
            }
            }

            return(true);
        }