Beispiel #1
0
        public ThemeStateViewModel(ThemeState state, ThemePartViewModel parent)
        {
            this.state = state;
            Parent     = parent;

            properties.AddRange(state.Properties.Select(x => new OwnedThemePropertyViewModel(x)));
        }
        public ThemePartComparisonViewModel Compare(
            ThemePartViewModel oldPart, ThemePartViewModel newPart)
        {
            var cmpModel = new ThemePartComparisonViewModel(oldPart, newPart);

            if (oldPart != null && newPart != null)
            {
                var items = MatchItems(oldPart.States, newPart.States, (l, r) => l.Id.CompareTo(r.Id));
                foreach (var tuple in items)
                {
                    var cmp = Compare(tuple.Item1, tuple.Item2);
                    if (cmp != null)
                    {
                        cmpModel.States.Add(cmp);
                    }
                }

                cmpModel.Properties = Compare(oldPart.Properties, newPart.Properties);

                if (cmpModel.States.Count == 0 && cmpModel.Properties.Count == 0)
                {
                    return(null);
                }
            }

            return(cmpModel);
        }
 public ThemePartComparisonViewModel(
     ThemePartViewModel oldPart, ThemePartViewModel newPart)
 {
     OldPart     = oldPart;
     NewPart     = newPart;
     Comparison  = ComparisonUtils.GetResult(oldPart != null, newPart != null);
     DisplayName = NewPart?.DisplayName ?? OldPart?.DisplayName;
 }
        public void AddInheritedProperties(ThemePartViewModel basePart)
        {
            foreach (var inherited in basePart.Properties)
            {
                if (properties.All(x => x.PropertyId != inherited.PropertyId))
                {
                    properties.Add(new InheritedThemePropertyViewModel(inherited));
                }
            }

            foreach (var baseState in basePart.States)
            {
                var state = AddState(baseState.Id);
                state.AddInheritedProperties(baseState);
            }
        }