Beispiel #1
0
        public FactionGroupValueViewModel(SSFactionGroup factionGroup)
        {
            FactionGroup           = factionGroup;
            SSDisplayName          = new MonitoredValueViewModel(FactionGroup?.DisplayName);
            DisplayNameWithArticle = new MonitoredValueViewModel(FactionGroup?.DisplayNameWithArticle);
            ShipNamePrefix         = new MonitoredValueViewModel(FactionGroup?.ShipNamePrefix);
            Color       = new MonitoredColorViewModel(FactionGroup?.Color);
            BaseUIColor = new MonitoredColorViewModel(FactionGroup?.BaseUIColor)
            {
                ReplacementSource = FactionGroup?.Color
            };
            DarkUIColor = new MonitoredColorViewModel(FactionGroup?.DarkUIColor)
            {
                ReplacementSource = FactionGroup?.Color,
                ReplacementSourceTransformation = delegate(JsonArray a)
                {
                    JsonArray  result = new JsonArray();
                    List <int> number = (from JsonToken j in a.Values
                                         select Convert.ToInt32(((JsonValue)j).Content)).ToList();

                    result.Values.Add(new JsonValue(number[0] * 0.4));
                    result.Values.Add(new JsonValue(number[1] * 0.4));
                    result.Values.Add(new JsonValue(number[2] * 0.4));
                    JsonValue alpha = new JsonValue(175);
                    result.Values.Add(alpha);
                    return(result);
                }
            };
            SecondaryUIColor = new MonitoredColorViewModel(FactionGroup?.SecondaryUIColor)
            {
                ReplacementSource = FactionGroup?.Color
            };
            SecondarySegments    = new MonitoredValueViewModel(FactionGroup?.SecondarySegments);
            FleetCircleViewModel = new FactionGroupFleetCircleViewModel(Color, SecondaryUIColor, SecondarySegments);
        }
 public FactionGroupFleetCircleViewModel(MonitoredColorViewModel color, MonitoredColorViewModel secondaryColor, MonitoredValueViewModel secondarySegment)
 {
     this.Color            = color;
     this.SecondaryColor   = secondaryColor;
     this.SecondarySegment = secondarySegment;
     binding.Add(SecondarySegment.Bind(x => x.Value, (sender, eventarg) => { NotifyOfPropertyChange(nameof(Segments1)); NotifyOfPropertyChange(nameof(Segments2)); }));
 }