Example #1
0
 private void UnitPlacementColorButton_Click(object sender, RoutedEventArgs e)
 {
     ColorSwatch swatch = new ColorSwatch();
     swatch.Owner = this;
     swatch.Closing += PlacementSwatch_Closing;
     TileUnitPlacement unitPlacement = (sender as Button).DataContext as TileUnitPlacement;
     swatch.DataContext = unitPlacement;
     if (unitPlacement.TileColor != null)
     {
         swatch.HSVColorSwatch.Red = unitPlacement.TileColor.R;
         swatch.HSVColorSwatch.Green = unitPlacement.TileColor.G;
         swatch.HSVColorSwatch.Blue = unitPlacement.TileColor.B;
         swatch.HSVColorSwatch.Alpha = unitPlacement.TileColor.A;
     }
     swatch.Show();
 }
Example #2
0
 private void TileTypeColorButton_Click(object sender, RoutedEventArgs e)
 {
     ColorSwatch swatch = new ColorSwatch();
     swatch.Owner = this;
     swatch.Closing += Swatch_Closing;
     TileType type = (sender as Button).DataContext as TileType;
     swatch.DataContext = type;
     if (type.TileColor != null)
     {
         swatch.HSVColorSwatch.Red = type.TileColor.R;
         swatch.HSVColorSwatch.Green = type.TileColor.G;
         swatch.HSVColorSwatch.Blue = type.TileColor.B;
         swatch.HSVColorSwatch.Alpha = type.TileColor.A;
     }
     swatch.Show();
 }