Skip to content

Instantly share code, notes, and snippets.

View olexale's full-sized avatar
🎯
Focusing

Oleksandr Leushchenko olexale

🎯
Focusing
View GitHub Profile
public class AnimationNavigationControllerDelegate : UINavigationControllerDelegate
{
private TransitionAnimator _animator = new TransitionAnimator();
private int _id;
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForOperation(UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromViewController, UIViewController toViewController)
{
if (operation == UINavigationControllerOperation.Push)
{
var image = fromViewController.View.ViewWithTag(_id);
namespace BeatlesApp
{
public class TagEffect : RoutingEffect
{
public TagEffect() : base("BeatlesApp.TagEffect") {}
public static readonly BindableProperty TagProperty =
BindableProperty.CreateAttached("Tag", typeof(int), typeof(TagEffect), 0, propertyChanged: OnTagChanged);
public static int GetTag(BindableObject view)
[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]
namespace BeatlesApp.iOS
{
public class AnimationNavigationRenderer : Xamarin.Forms.Platform.iOS.NavigationRenderer
{
private AnimationNavigationControllerDelegate _delegate;
public override void ViewDidLoad()
{
base.ViewDidLoad();
public class AnimationNavigationControllerDelegate : UINavigationControllerDelegate
{
private TransitionAnimator _animator = new TransitionAnimator();
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForOperation(UINavigationController navigationController, UINavigationControllerOperation operation, UIViewController fromViewController, UIViewController toViewController)
{
return _animator;
}
}
public class TransitionAnimator : UIViewControllerAnimatedTransitioning
{
private const double _duration = 0.5;
public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
{
var containerView = transitionContext.ContainerView;
var toView = transitionContext.GetViewFor(UITransitionContext.ToViewKey);
containerView.AddSubview(toView);
class CounterStore : INotifyPropertyChanged
{
private readonly CounterReducer reducer = new CounterReducer();
private CounterState state;
public CounterStore(CounterState initialState)
{
state = initialState;
}
class CounterReducer
{
public CounterState Reduce(CounterState state, object action)
{
switch (action)
{
case IncrementAction i:
return ProcessIncrement(state);
case DecrementAction d:
return ProcessDecrement(state);
class IncrementAction { }
class DecrementAction { }
class CounterState
{
public CounterState(int count) { Count = count; }
public int Count { get; }
}
@olexale
olexale / cmvx.snippet
Created October 28, 2013 13:44
MvvmCross snippets for Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>MvvmCross command</Title>
<Shortcut>cmvx</Shortcut>
<Description>Code snippet for MvvmCross command</Description>
</Header>