Skip to content

Instantly share code, notes, and snippets.

View rdelrosario's full-sized avatar

Rendy Del Rosario rdelrosario

View GitHub Profile
public interface IStartupTask
{
Task<bool> CanRunAsync();
Task RunAsync();
}
public sealed class User
{
public User(string firstName)
{
if (firstName == null)
throw new ArgumentNullException(nameof(firstName), "First name cannot be null.");
if (firstName.Length == 0)
throw new ArgumentException("First name cannot be empty.", nameof(firstName));
namespace UberClone.ViewModels
{
public class MapPageViewModel : INotifyPropertyChanged
{
...
public MapPageViewModel()
{
var _stateMachine = new StateMachine<XUberState, XUberTrigger>(XUberState.Initial);
CalculateRouteTrigger = _stateMachine.SetTriggerParameters<GooglePlaceAutoCompletePrediction>(XUberTrigger.CalculateRoute);
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="UberClone.Views.MapPage" >
<Grid RowSpacing="0"
x:Name="layout"
VerticalOptions="FillAndExpand"
RowDefinitions="Auto, *">
...
<local:SearchContentView IsVisible="false"
namespace UberClone.ViewModels
{
public class MapPageViewModel : INotifyPropertyChanged
{
public XUberState State { get; private set; }
public ICommand FireTriggerCommand { get; }
private readonly StateMachine<XUberState, XUberTrigger> _stateMachine;
public class MapPageViewModel : INotifyPropertyChanged
{
public MapPageViewModel()
{
var _stateMachine = new StateMachine<XUberState, XUberTrigger>(XUberState.Initial);
_stateMachine.Configure(XUberState.Initial)
.OnEntry(Initialize)
.OnExit(() => { Places = new ObservableCollection<GooglePlaceAutoCompletePrediction>(RecentPlaces); })
.OnActivateAsync(GetActualUserLocation)
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="VideoPlayerStateMachine.MainPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:VideoPlayerStateMachine.Controls"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:local="clr-namespace:VideoPlayerStateMachine"
xmlns:viewModels="clr-namespace:VideoPlayerStateMachine.ViewModels"
BackgroundColor="Black"
public class MainViewModel : INotifyPropertyChanged
{
public MainViewModel()
{
_videoPlayerStateMachine.Configure(VideoState.Playing)
.OnActivate(OnStateEntry)
.OnEntry(OnStateEntry)
.PermitReentryIf(VideoTrigger.Forward)
.PermitReentryIf(VideoTrigger.Rewind)
.Permit(VideoTrigger.Pause, VideoState.Paused)
public class MainViewModel : INotifyPropertyChanged
{
public MainViewModel()
{
var forwardParamTrigger = _videoPlayerStateMachine.SetTriggerParameters<double>(VideoTrigger.Forward);
var rewindParamTrigger = _videoPlayerStateMachine.SetTriggerParameters<double>(VideoTrigger.Rewind);
...
}
}
public class MainViewModel : INotifyPropertyChanged
{
...
public ICommand ForwardCommand { get; }
public ICommand RewindCommand { get; }
public MainViewModel(){
...
ForwardCommand = new Command<double>((seconds) => {