Skip to content

Commit ed87359

Browse files
author
Jean-Marie Alfonsi
committed
chore: cleanup of all Xamarin.Forms, fix an exception when inserting task loading states view
1 parent 3c869f4 commit ed87359

File tree

274 files changed

+2919
-34725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+2919
-34725
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Globalization;
2+
3+
namespace Sample.Converters;
4+
5+
public class CyclicLoadingLottieConverter : IValueConverter
6+
{
7+
private int _counter = -1;
8+
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value == null || (value is bool showLoader && !showLoader))
12+
{
13+
return null;
14+
}
15+
16+
_counter = ++_counter > 2 ? 0 : _counter;
17+
switch (_counter)
18+
{
19+
case 0:
20+
return "delorean_grey.json";
21+
case 1:
22+
return "joystick_grey.json";
23+
case 2:
24+
return "cassette_grey.json";
25+
}
26+
27+
return "delorean_grey.json";
28+
}
29+
30+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
31+
{
32+
// One-Way converter only
33+
throw new NotImplementedException();
34+
}
35+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Globalization;
2+
3+
using Sample.Services;
4+
5+
namespace Sample.Converters;
6+
7+
public class ExceptionToErrorMessageConverter : IValueConverter, IMarkupExtension
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
var exception = value as Exception;
12+
13+
if (value == null)
14+
{
15+
return null;
16+
}
17+
18+
return ApplicationExceptions.ToString(exception);
19+
}
20+
21+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22+
{
23+
// One-Way converter only
24+
throw new NotImplementedException();
25+
}
26+
27+
public object ProvideValue(IServiceProvider serviceProvider)
28+
{
29+
return this;
30+
}
31+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.Globalization;
2+
3+
using Sample.Services;
4+
5+
namespace Sample.Converters;
6+
7+
public class ExceptionToImageSourceConverter : IValueConverter, IMarkupExtension
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value == null)
12+
{
13+
return null;
14+
}
15+
16+
string imageName;
17+
18+
switch (value)
19+
{
20+
case ServerException:
21+
imageName = "server.png";
22+
break;
23+
case NetworkException:
24+
imageName = "the_internet.png";
25+
break;
26+
default:
27+
imageName = "richmond.png";
28+
break;
29+
}
30+
31+
return ImageSource.FromFile(imageName);
32+
}
33+
34+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
35+
{
36+
// One-Way converter only
37+
throw new NotImplementedException();
38+
}
39+
40+
public object ProvideValue(IServiceProvider serviceProvider)
41+
{
42+
return this;
43+
}
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+

2+
using System.Globalization;
3+
4+
using Sample.Services;
5+
6+
namespace Sample.Converters;
7+
8+
public class ExceptionToLottieConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
if (value == null)
13+
{
14+
return null;
15+
}
16+
17+
string imageName;
18+
19+
switch (value)
20+
{
21+
case ServerException serverException:
22+
imageName = "server_error.json";
23+
break;
24+
case NetworkException networkException:
25+
imageName = "connection_grey.json";
26+
break;
27+
default:
28+
imageName = "sketch_grey.json";
29+
break;
30+
}
31+
32+
return imageName;
33+
}
34+
35+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
36+
{
37+
// One-Way converter only
38+
throw new NotImplementedException();
39+
}
40+
}

Retronado/Sample/Converters/ListCountToVisibilityConverter.cs renamed to Retronado.Maui/Converters/ListCountToVisibilityConverter.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using System;
2-
using System.Collections;
1+
using System.Collections;
32
using System.Globalization;
4-
using Sample.Infrastructure;
5-
using Sample.Services;
6-
7-
using Xamarin.Forms;
83

94
namespace Sample.Converters
105
{

Retronado/Sample/Converters/StringToImageSourceResourceConverter.cs renamed to Retronado.Maui/Converters/StringToImageSourceResourceConverter.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Globalization;
1+
using System.Globalization;
32
using Sample.Infrastructure;
4-
using Sample.Services;
5-
6-
using Xamarin.Forms;
73

84
namespace Sample.Converters
95
{
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@
77
// </summary>
88
// --------------------------------------------------------------------------------------------------------------------
99

10-
using System;
11-
using System.Linq;
1210
using System.Reflection;
13-
using System.Threading.Tasks;
1411

1512
using Sample.Domain;
1613
using Sample.Infrastructure;
1714
using Sample.Navigation;
1815
using Sample.Navigation.Impl;
1916

20-
using Xamarin.Forms;
21-
2217
namespace Sample
2318
{
2419
/// <summary>
File renamed without changes.

Retronado/Sample/Domain/IGDBRefitClient.cs renamed to Retronado.Maui/Domain/IGDBRefitClient.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Net.Http;
4-
using System.Threading.Tasks;
5-
6-
using IGDB;
1+
using IGDB;
72
using IGDB.Models;
83

94
using Newtonsoft.Json;

0 commit comments

Comments
 (0)