diff --git a/Source/TeamMate/Controls/TileCollectionView.xaml b/Source/TeamMate/Controls/TileCollectionView.xaml
index 0126f1a..746085a 100644
--- a/Source/TeamMate/Controls/TileCollectionView.xaml
+++ b/Source/TeamMate/Controls/TileCollectionView.xaml
@@ -37,6 +37,16 @@
CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}"
Visibility="{Binding IsDefaultBackgroundColor, Converter={x:Static fw:Converters.InverseVisibility}}"
CommandParameter="{Binding}" />
+
+
+
@@ -69,7 +79,17 @@
Command="{x:Static tmr:TeamMateCommands.ResetTileBackgroundColor}"
CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}"
Visibility="{Binding IsDefaultBackgroundColor, Converter={x:Static fw:Converters.InverseVisibility}}"
- CommandParameter="{Binding}" />
+ CommandParameter="{Binding}" />
+
+
+
diff --git a/Source/TeamMate/Controls/TileView.xaml b/Source/TeamMate/Controls/TileView.xaml
index 2c3efa6..75aa86b 100644
--- a/Source/TeamMate/Controls/TileView.xaml
+++ b/Source/TeamMate/Controls/TileView.xaml
@@ -43,7 +43,7 @@
Margin="6"
VerticalAlignment="Top"
FontSize="18"
- Foreground="White"
+ Foreground="{Binding TileInfo.FontColor}"
Text="{Binding TileInfo.Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
diff --git a/Source/TeamMate/Model/ProjectContextSerializer.cs b/Source/TeamMate/Model/ProjectContextSerializer.cs
index fc7c53d..7f82b6f 100644
--- a/Source/TeamMate/Model/ProjectContextSerializer.cs
+++ b/Source/TeamMate/Model/ProjectContextSerializer.cs
@@ -56,6 +56,8 @@ private TileInfo ReadTile(XElement e)
throw new NotSupportedException(String.Format("Tile type {0} is not supported", tileInfo.Type));
}
+ tileInfo.FontColor = e.GetAttribute(Schema.FontColor);
+
return tileInfo;
}
@@ -120,6 +122,8 @@ private XElement WriteTile(TileInfo tile)
throw new NotSupportedException(String.Format("Tile type {0} is not supported", tile.Type));
}
+ e.SetAttribute(Schema.FontColor, tile.FontColor);
+
return e;
}
@@ -385,6 +389,7 @@ private static class Schema
public const string LastUpdated = "LastUpdated";
public const string OrderByFieldName = "OrderByFieldName";
public const string FilterByFieldName = "FilterByFieldName";
+ public const string FontColor = "FontColor";
// Work Item Stuff
public static readonly XName WorkItemQueryInfo = "WorkItemQueryInfo";
diff --git a/Source/TeamMate/Model/TileInfo.cs b/Source/TeamMate/Model/TileInfo.cs
index f9671e3..43a4eba 100644
--- a/Source/TeamMate/Model/TileInfo.cs
+++ b/Source/TeamMate/Model/TileInfo.cs
@@ -66,7 +66,6 @@ public BuiltInTileType BuiltInTileType
set { SetProperty(ref this.builtInTileType, value); }
}
-
private bool includeInItemCountSummary;
public bool IncludeInItemCountSummary
@@ -98,6 +97,13 @@ public string BackgroundColor
set { SetProperty(ref this.backgroundColor, value); }
}
+ private string fontColor;
+ public string FontColor
+ {
+ get { return this.fontColor; }
+ set { SetProperty(ref this.fontColor, value); }
+ }
+
// TODO: KLUDGE, don't make this public, refactor or cleanup
public void FireChanged()
{
diff --git a/Source/TeamMate/Resources/TeamMateCommands.cs b/Source/TeamMate/Resources/TeamMateCommands.cs
index 8a02f65..cc2c9a3 100644
--- a/Source/TeamMate/Resources/TeamMateCommands.cs
+++ b/Source/TeamMate/Resources/TeamMateCommands.cs
@@ -60,6 +60,8 @@ public static class TeamMateCommands
public static ICommand ModifyTile { get { return commands.Create(); } }
public static ICommand SelectTileBackgroundColor { get { return commands.Create(); } }
public static ICommand ResetTileBackgroundColor { get { return commands.Create(); } }
+ public static ICommand SelectTileFontColor { get { return commands.Create(); } }
+ public static ICommand ResetTileFontColor { get { return commands.Create(); } }
public static ICommand RetryConnectToVsts { get { return commands.Create(); } }
}
}
\ No newline at end of file
diff --git a/Source/TeamMate/Services/WindowService.cs b/Source/TeamMate/Services/WindowService.cs
index 8df213b..d18ae81 100644
--- a/Source/TeamMate/Services/WindowService.cs
+++ b/Source/TeamMate/Services/WindowService.cs
@@ -305,7 +305,7 @@ public PullRequestQueryInfo ShowPullRequestQueryEditorDialog(ViewModelBase owner
public string ShowColorPickerDialog(ViewModelBase ownerViewModel, string initialColor)
{
WindowsForms.ColorDialog colorPicker = new WindowsForms.ColorDialog();
- // Sets the initial color select to the current tile background color.
+
colorPicker.Color = ColorTranslator.FromHtml(initialColor);
// If the user clicks OK, return that color, otherwise return initial color
diff --git a/Source/TeamMate/ViewModels/HomePageViewModel.cs b/Source/TeamMate/ViewModels/HomePageViewModel.cs
index 181edb4..651c7da 100644
--- a/Source/TeamMate/ViewModels/HomePageViewModel.cs
+++ b/Source/TeamMate/ViewModels/HomePageViewModel.cs
@@ -32,6 +32,8 @@ public void RegisterBindings(CommandBindingCollection commands)
commands.Add(TeamMateCommands.ModifyTile, ModifyTile);
commands.Add(TeamMateCommands.SelectTileBackgroundColor, SelectBackgroundColor);
commands.Add(TeamMateCommands.ResetTileBackgroundColor, ResetBackgroundColor);
+ commands.Add(TeamMateCommands.SelectTileFontColor, SelectFontColor);
+ commands.Add(TeamMateCommands.ResetTileFontColor, ResetFontColor);
}
public Session Session
@@ -145,6 +147,19 @@ public void SelectBackgroundColor(TileViewModel tile)
}
}
+ public void SelectFontColor(TileViewModel tile)
+ {
+ Assert.ParamIsNotNull(tile, nameof(tile));
+
+ string selectedColor = this.WindowService.ShowColorPickerDialog(this, tile.TileInfo.FontColor);
+
+ // Update the text box color if the user selected a different color
+ if (!string.Equals(selectedColor, tile.TileInfo.FontColor, System.StringComparison.OrdinalIgnoreCase))
+ {
+ tile.FontColor = selectedColor;
+ }
+ }
+
public void ResetBackgroundColor(TileViewModel tile)
{
Assert.ParamIsNotNull(tile, nameof(tile));
@@ -152,5 +167,11 @@ public void ResetBackgroundColor(TileViewModel tile)
// Assigning null will clear out any overridden background color, returning to default
tile.BackgroundColor = null;
}
+ public void ResetFontColor(TileViewModel tile)
+ {
+ Assert.ParamIsNotNull(tile, nameof(tile));
+
+ tile.ResetFontColor();
+ }
}
}
diff --git a/Source/TeamMate/ViewModels/TileViewModel.cs b/Source/TeamMate/ViewModels/TileViewModel.cs
index cbb7940..430da5c 100644
--- a/Source/TeamMate/ViewModels/TileViewModel.cs
+++ b/Source/TeamMate/ViewModels/TileViewModel.cs
@@ -32,6 +32,9 @@ public TileInfo TileInfo
this.includeInItemCountSummary = (this.TileInfo != null) ? this.tileInfo.IncludeInItemCountSummary : false;
this.backgroundColor = this.GetBackgroundColor();
this.isDefaultBackgroundColor = this.IsDefaultBackColor();
+ this.fontColor = this.GetFontColor();
+ this.tileInfo.FontColor = this.fontColor;
+ this.isDefaultFontColor = this.IsDefaultTextFontColor();
this.Query = (this.TileInfo != null) ? CreateQueryViewModel(this.TileInfo) : null;
@@ -103,6 +106,19 @@ public bool IsDefaultBackgroundColor
}
}
+ private bool isDefaultFontColor;
+ public bool IsDefaultFontColor
+ {
+ get
+ {
+ return this.isDefaultFontColor;
+ }
+ set
+ {
+ SetProperty(ref this.isDefaultFontColor, value);
+ }
+ }
+
private string backgroundColor;
///
/// Holds the hex code for the background color of the tile.
@@ -157,6 +173,53 @@ public string GetDefaultBackgroundColor()
return DefaultBackgroundColor;
}
+ protected const string DefaultFontColor = "White";
+
+ private string fontColor = DefaultFontColor;
+ ///
+ /// Holds the hex code for the background color of the tile.
+ /// Defaults to a predefined color based on the type of the tile, if no color is explicitly selected for it.
+ ///
+ public string FontColor
+ {
+ get { return this.fontColor; }
+ set
+ {
+ this.TileInfo.FontColor = value;
+ this.TileInfo.FireChanged();
+
+ SetProperty(ref this.fontColor, this.GetFontColor());
+ this.IsDefaultFontColor = this.IsDefaultTextFontColor();
+ }
+ }
+
+ private string GetFontColor()
+ {
+ if (this.TileInfo != null && !string.IsNullOrEmpty(this.TileInfo.FontColor))
+ {
+ return this.TileInfo.FontColor;
+ }
+ return this.GetDefaultFontColor();
+ }
+ public void ResetFontColor()
+ {
+ this.FontColor = DefaultFontColor;
+ }
+
+ private bool IsDefaultTextFontColor()
+ {
+ return string.Equals(this.FontColor, this.GetDefaultFontColor(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ ///
+ /// Get the default foreground color for the tile based on its type
+ ///
+ /// Hex value of the default color for the tile
+ public string GetDefaultFontColor()
+ {
+ return DefaultFontColor;
+ }
+
public QueryViewModelBase Query
{
get { return this.query; }