Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{
public sealed class BooleanReverseVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
var returnValue = value is bool visible && !visible;
return returnValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
//return value is bool visible && visible ? true : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
public sealed class BooleanVisibilityConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is bool visible && visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
//return value is bool visible && !visible;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public sealed class BrushToBlackWhiteConverter : IValueConverter
public Color White { get; set; } = Color.White;
public Color Black { get; set; } = Color.Black;

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
Color opposite = Color.Black;
if (value is SolidColorBrush color)
Expand All @@ -17,7 +17,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return opposite;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public sealed class BrushToLightForgroundConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is SolidColorBrush color)
{
Expand All @@ -16,7 +16,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public sealed class ColorToBlackWhiteConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
Color opposite = Color.Black;
if (value is Color color)
Expand All @@ -14,7 +14,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return opposite;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace AndreasReitberger.Shared.XForm.Core.Converters
public sealed class ColorToLightForgroundConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is Color color)
{
Expand All @@ -18,7 +18,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public sealed class ColorToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is Color color)
{
Expand All @@ -11,7 +11,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return string.Empty;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public sealed class DoubleHoursToTimeSpanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
try
{
Expand All @@ -15,9 +15,9 @@
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
TimeSpan ts = (TimeSpan)value;

Check warning on line 20 in src/SharedXFormCoreLibrary/Converters/DoubleHoursToTimeSpanConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.

Check warning on line 20 in src/SharedXFormCoreLibrary/Converters/DoubleHoursToTimeSpanConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.
if (ts == null)
return 0;
return ts.TotalHours;
Expand Down
4 changes: 2 additions & 2 deletions src/SharedXFormCoreLibrary/Converters/IsMoreThanConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
public sealed class IsMoreThanConverter : IValueConverter
{
public double Limit { get; set; } = 0;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
double val = System.Convert.ToDouble(value);
double limit = parameter != null ? System.Convert.ToDouble(parameter) : Limit;
return (val > limit);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
public sealed class LongToGigaByteConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
long bytes = System.Convert.ToInt64(value);
double factor = 1073741824;
double gigaBytes = (double)Math.Round((double)(bytes / factor), 2);
return gigaBytes;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{
public class SwipingBoolToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if ((bool)value)

Check warning on line 7 in src/SharedXFormCoreLibrary/Converters/SwipingBoolToImageConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.

Check warning on line 7 in src/SharedXFormCoreLibrary/Converters/SwipingBoolToImageConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.
return ImageSource.FromResource("SfListViewSample.Images.Favorites1.png");
else
return ImageSource.FromResource("SfListViewSample.Images.InboxIcon.png");
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Source: https://github.com/AndreasReitberger/SharedMauiCoreLibrary/blob/main/source/SharedMauiCoreLibrary/SharedMauiCoreLibrary/Converters/UnixDateToDateTimeConverter.cs
public sealed class UnixDateToDateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
try
{
Expand All @@ -18,7 +18,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
public sealed class UnixDoubleHoursToTimeSpanConverter : IValueConverter
{
public bool WithMiliSeconds { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
try
{
Expand All @@ -19,9 +19,9 @@
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
TimeSpan ts = (TimeSpan)value;

Check warning on line 24 in src/SharedXFormCoreLibrary/Converters/UnixDoubleHoursToTimeSpanConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.

Check warning on line 24 in src/SharedXFormCoreLibrary/Converters/UnixDoubleHoursToTimeSpanConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Unboxing a possibly null value.
return ts.TotalSeconds;
}
}
Expand Down