Add ability to show image markers.
This commit is contained in:
@@ -1,19 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Avalonia.Data.Converters;
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.Utils;
|
||||
|
||||
namespace PortfolioManager.UIUtils
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// If the OS is not Window then multiply the first parameter.
|
||||
/// For example: "30|.5" would multiply 30 * .5 if the OS is not Windows and return 15 as the result. Otherwise (if Windows) it will return 30
|
||||
/// I am doing this because I need to adjust image sizes across Windows and Unix platforms where Unix images appear quite larger than Windows
|
||||
/// </summary>
|
||||
public class OSValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
String[] parameters = parameter.ToString().Split('|');
|
||||
double valueItem = double.Parse(parameters[0]);
|
||||
double multiplier = double.Parse(parameters[1]);
|
||||
|
||||
if (Utility.IsOSWindows())
|
||||
{
|
||||
return (int)valueItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)(valueItem * multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class RMultipleValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
double doubleValue = (double)value;
|
||||
if (double.IsNaN(doubleValue) || double.IsInfinity(doubleValue)) return Constants.CONST_DASHES;
|
||||
return Utility.FormatNumber(doubleValue,2)+"R";
|
||||
return Utility.FormatNumber(doubleValue, 2) + "R";
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user