Skip to content

Commit

Permalink
Add toOld text color style + change silver icon position
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Aug 8, 2019
1 parent 33ccb91 commit 7cc6380
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 46 deletions.
56 changes: 48 additions & 8 deletions StatisticsAnalysisTool/StatisticsAnalysisTool/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
<Color x:Key="Color.Button.Second">#ff57b6e0</Color>
<Color x:Key="Color.Button.Third">#ff3da2ca</Color>

<!-- Text colors -->
<Color x:Key="Color.Text.Normal">#FFDCDCDC</Color>
<Color x:Key="Color.Text.ToOldFirst">#FF9898A5</Color>
<Color x:Key="Color.Text.ToOldSecond">#FF81818C</Color>
<Color x:Key="Color.Text.ToOldThird">#FF696972</Color>
<Color x:Key="Color.Text.NoValue">#FF525259</Color>

<SolidColorBrush x:Key="SolidColorBrush.Foreground.First" Color="Gainsboro"/>
<SolidColorBrush x:Key="SolidColorBrush.Foreground.Second" Color="#B4B4B4"/>
<SolidColorBrush x:Key="SolidColorBrush.Background.First" Color="{StaticResource Background.First}" />
Expand All @@ -48,6 +55,11 @@
<SolidColorBrush x:Key="SolidColorBrush.Item.Level.Color.1" Color="{StaticResource Item.Level.Color.1}"/>
<SolidColorBrush x:Key="SolidColorBrush.Item.Level.Color.2" Color="{StaticResource Item.Level.Color.2}"/>
<SolidColorBrush x:Key="SolidColorBrush.Item.Level.Color.3" Color="{StaticResource Item.Level.Color.3}"/>
<SolidColorBrush x:Key="Solid.Color.Text.Normal" Color="{StaticResource Color.Text.Normal}"/>
<SolidColorBrush x:Key="Solid.Color.Text.ToOldFirst" Color="{StaticResource Color.Text.ToOldFirst}"/>
<SolidColorBrush x:Key="Solid.Color.Text.ToOldSecond" Color="{StaticResource Color.Text.ToOldSecond}"/>
<SolidColorBrush x:Key="Solid.Color.Text.ToOldThird" Color="{StaticResource Color.Text.ToOldThird}"/>
<SolidColorBrush x:Key="Solid.Color.Text.NoValue" Color="{StaticResource Color.Text.NoValue}"/>

<SolidColorBrush x:Key="SolidColorBrush.City.Caerleon" Color="{StaticResource Color.City.Caerleon}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.Thetford" Color="{StaticResource Color.City.Thetford}"/>
Expand Down Expand Up @@ -192,9 +204,9 @@

<!-- ListView grid stackPanel item price -->
<Style TargetType="StackPanel" x:Key="ListView.Grid.StackPanel.Item.Price">
<Setter Property="Width" Value="92"/>
<Setter Property="Width" Value="90"/>
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0"/>
</Style>
Expand All @@ -209,19 +221,48 @@
<!-- ListView grid stackPanel item icon -->
<Style TargetType="StackPanel" x:Key="ListView.Grid.StackPanel.Item.Icon">
<Setter Property="Orientation" Value="Horizontal"></Setter>
<Setter Property="HorizontalAlignment" Value="Right"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
<Setter Property="Margin" Value="0,2,0,0"></Setter>
</Style>

<!-- ListView grid label date -->
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date">
<!-- ListView grid stackPanel label date -->
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date.Normal">
<Setter Property="Width" Value="120"></Setter>
<Setter Property="Foreground" Value="{StaticResource SolidColorBrush.Foreground.First}"></Setter>
<Setter Property="Foreground" Value="{StaticResource Solid.Color.Text.Normal}"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
</Style>
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date.ToOldFirst">
<Setter Property="Width" Value="120"></Setter>
<Setter Property="Foreground" Value="{StaticResource Solid.Color.Text.ToOldFirst}"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
</Style>
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date.ToOldSecond">
<Setter Property="Width" Value="120"></Setter>
<Setter Property="Foreground" Value="{StaticResource Solid.Color.Text.ToOldSecond}"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
</Style>
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date.ToOldThird">
<Setter Property="Width" Value="120"></Setter>
<Setter Property="Foreground" Value="{StaticResource Solid.Color.Text.ToOldThird}"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
</Style>
<Style TargetType="Label" x:Key="ListView.Grid.Label.Date.NoValue">
<Setter Property="Width" Value="120"></Setter>
<Setter Property="Foreground" Value="{StaticResource Solid.Color.Text.NoValue}"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Margin" Value="0"></Setter>
</Style>


<!-- ListView grid stackPanel label price -->
<Style TargetType="Label" x:Key="ListView.Grid.StackPanel.Label.Price">
Expand All @@ -231,7 +272,6 @@
<Setter Property="MinWidth" Value="100"/>
</Style>


<!-- Primary Window -->
<Style x:Key="PrimaryWindow" TargetType="Window">
<Setter Property="BorderThickness" Value="1,1,1,1" />
Expand Down
8 changes: 4 additions & 4 deletions StatisticsAnalysisTool/StatisticsAnalysisTool/ItemWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Style="{StaticResource ListView.Grid.Item.Date}">
<Label Style="{StaticResource ListView.Grid.Label.Date}" Content="{Binding SellPriceMinDate}"/>
<Label Style="{Binding SellPriceMinDateStyle}" Content="{Binding SellPriceMinDate}"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand All @@ -75,7 +75,7 @@
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Style="{StaticResource ListView.Grid.Item.Date}">
<Label Style="{StaticResource ListView.Grid.Label.Date}" Content="{Binding SellPriceMaxDate}"/>
<Label Style="{Binding SellPriceMaxDateStyle}" Content="{Binding SellPriceMaxDate}"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand All @@ -98,7 +98,7 @@
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Style="{StaticResource ListView.Grid.Item.Date}">
<Label Style="{StaticResource ListView.Grid.Label.Date}" Content="{Binding BuyPriceMinDate}"/>
<Label Style="{Binding BuyPriceMinDateStyle}" Content="{Binding BuyPriceMinDate}"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand All @@ -122,7 +122,7 @@
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Style="{StaticResource ListView.Grid.Item.Date}">
<Label Style="{StaticResource ListView.Grid.Label.Date}" Content="{Binding BuyPriceMaxDate}"/>
<Label Style="{Binding BuyPriceMaxDateStyle}" Content="{Binding BuyPriceMaxDate}"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand Down
34 changes: 0 additions & 34 deletions StatisticsAnalysisTool/StatisticsAnalysisTool/ItemWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,40 +255,6 @@ private void SetDifferenceCalculationText(List<MarketResponseTotal> statsPricesT
$"{LanguageController.Translation("PROFIT")} {string.Format(LanguageController.DefaultCultureInfo, "{0:n0}", diffPrice)}";
}

private SolidColorBrush DateTimeToOld(DateTime dateTime)
{
// ReSharper disable once PossibleNullReferenceException
var textColorNormal = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFDCDCDC"));
// ReSharper disable once PossibleNullReferenceException
var textColorToOldFirst = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF9898A5"));
// ReSharper disable once PossibleNullReferenceException
var textColorToOldSecond = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF81818C"));
// ReSharper disable once PossibleNullReferenceException
var textColorToOldThird = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF696972"));
// ReSharper disable once PossibleNullReferenceException
var textColorNoValue = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF525259"));

if (dateTime.Date == DateTime.MinValue.Date)
return textColorNoValue;

var currentDateTime = DateTime.Now.ToUniversalTime();

if (dateTime.AddHours(6) < currentDateTime.AddHours(-1))
{
return textColorToOldThird;
} else if (dateTime.AddHours(4) < currentDateTime.AddHours(-1))
{
return textColorToOldSecond;
} else if (dateTime.AddHours(2) < currentDateTime.AddHours(-1))
{
return textColorToOldFirst;
}
else
{
return textColorNormal;
}
}

private void Hotbar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,30 @@ public Style BuyPriceMaxStyle {
}
}

private Style GetStyleByTimestamp(DateTime value)
{
if (value.Date == DateTime.MinValue.Date)
return Application.Current.FindResource("ListView.Grid.Label.Date.NoValue") as Style;

if (value.AddHours(8) < DateTime.Now.ToUniversalTime().AddHours(-1))
return Application.Current.FindResource("ListView.Grid.Label.Date.ToOldFirst") as Style;

if (value.AddHours(4) < DateTime.Now.ToUniversalTime().AddHours(-1))
return Application.Current.FindResource("ListView.Grid.Label.Date.ToOldSecond") as Style;

if (value.AddHours(2) < DateTime.Now.ToUniversalTime().AddHours(-1))
return Application.Current.FindResource("ListView.Grid.Label.Date.ToOldThird") as Style;

return Application.Current.FindResource("ListView.Grid.Label.Date.Normal") as Style;
}

public Style SellPriceMinDateStyle => GetStyleByTimestamp(SellPriceMinDate);

public Style SellPriceMaxDateStyle => GetStyleByTimestamp(SellPriceMaxDate);

public Style BuyPriceMinDateStyle => GetStyleByTimestamp(BuyPriceMinDate);

public Style BuyPriceMaxDateStyle => GetStyleByTimestamp(BuyPriceMaxDate);

}
}

0 comments on commit 7cc6380

Please sign in to comment.