Skip to content

Instantly share code, notes, and snippets.

View 15mgm15's full-sized avatar

Mario 15mgm15

  • Colima, Colima, México
View GitHub Profile
"phoneNumbers": [
{
"number": "+1 555-555-5555",
"day": "",
"month": "",
"dayOfWeek": "",
"startTime": "",
"endTime": "",
"title": "Primary",
"international": false
@15mgm15
15mgm15 / CarouselIndicators.cs
Last active September 4, 2018 10:51
Xamarin.Forms Carousel View Indicators
public class CarouselIndicators : Grid
{
private ImageSource UnselectedImageSource = null;
private ImageSource SelectedImageSource = null;
private readonly StackLayout _indicators = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand };
public CarouselIndicators()
{
this.HorizontalOptions = LayoutOptions.CenterAndExpand;
this.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:InfiniteListView"
x:Class="InfiniteListView.InfiniteListViewPage"
Title="Infinite Scrolling List"
xmlns:scroll="clr-namespace:Xamarin.Forms.Extended;assembly=Xamarin.Forms.Extended.InfiniteScrolling">
<ListView
CachingStrategy="RecycleElement"
public class InfiniteListViewViewModel : INotifyPropertyChanged
{
public InfiniteScrollCollection<DataItem> Items { get; }
bool _isLoadingMore;
bool IsLoadingMore
{
get
{
return _isLoadingMore;
public partial class InfiniteListViewPage : ContentPage
{
public InfiniteListViewPage()
{
InitializeComponent();
BindingContext = new InfiniteListViewViewModel();
}
}
[TestFixture]
public class Test
{
[Test]
public void TestCase()
{
Assert.IsTrue(true);
}
}
public class DependencyServiceStub : IDependencyService
{
readonly Dictionary<Type, object> registeredServices = new Dictionary<Type, object>();
public void Register<T>(object impl)
{
registeredServices[typeof(T)] = impl;
}
public T Get<T>() where T : class
public interface IDependencyService
{
T Get<T>() where T : class;
}
public class DependencyServiceWrapper : IDependencyService
{
public T Get<T>() where T : class
{
// The wrapper will simply pass everything through to the real Xamarin.Forms DependencyService class when not unit testing
public class UnitTestViewModel
{
public Command LoadDataCommand { get; set; }
public string Data { get; set; }
public UnitTestViewModel()
{
LoadDataCommand = new Command(async () => await LoadData());
}
public class UnitTestViewModel
{
public Command LoadDataCommand { get; set; }
public string Data { get; set; }
readonly IDependencyService _dependencyService;
public UnitTestViewModel() : this(new DependencyServiceWrapper())
{
}