Skip to content

Instantly share code, notes, and snippets.

View alexshikov's full-sized avatar

Alexey Shikov alexshikov

  • Diversido
  • Kiev, Ukraine
View GitHub Profile
@alexshikov
alexshikov / gist:3ece7abbd2779077158a
Last active August 29, 2015 14:20
Simple APNs registration
[Register ("AppDelegate")]
public partial class AppDelegate : ApplicationDelegate
{
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// common logic here
SetupPushNotifications (options);
return true;
}
@alexshikov
alexshikov / DroidPresenter.cs
Last active December 16, 2015 15:08
Show fragment as screen in MvvmCross
public class DroidPresenter : MvxAndroidViewPresenter
{
private readonly IMvxViewModelLoader _viewModelLoader;
private readonly IFragmentTypeLookup _fragmentTypeLookup;
private IFilterSliderHost _filterSliderHost;
private TaskCompletionSource<IFragmentHost> _taskSource;
private WeakReference<MvxDialogFragment> _lastDialog;
@alexshikov
alexshikov / Example.cs
Last active June 11, 2019 01:57
MvxBundle extension to pass objects between ViewModel
public void OpenDetails ()
{
var bundle = new MvxBundle ();
bundle.WriteByTypeAsync (Place); // object type name is used as a stored key
bundle.WriteBoolAsync(IsInMyGuides); // "System.Boolean" is used as a key
ShowViewModel<PlaceViewModel>(bundle);
}
protected async override void InitFromBundle (IMvxBundle parameters)
@alexshikov
alexshikov / Setup.cs
Last active April 6, 2016 17:07
Custom plugin loading
public class Setup : MvxAndroidSetup
{
// ...
protected override IMvxPluginManager CreatePluginManager()
{
return new MyPluginManager(".Droid", ".dll");
}
private class MyPluginManager: MvxFilePluginManager
@alexshikov
alexshikov / README.md
Last active April 11, 2016 11:51
A script to exchange all MvvmCross or/and MvvmCross-Plugins NuGet dependencies on local binaries

How to use

Let's assume we want to test local changes of MvvmCross in one of MvvmCross-Samples projects.

Steps:

  1. Clone MvvmCross and MvvmCross-Samples into a folder
  2. Make changes to MvvmCross and rebuild all in Debug mode
  3. Assuming we want to test changes on ValueConvertion project, copy use_loca_mvx.fsx into MvvmCross-Samples/ValueConvertion folder
  4. Execute fsharpi use_local_mvx.fsx
@alexshikov
alexshikov / FusedLocationPluginBootstrap.cs.pp
Created April 20, 2016 12:57
Mvx Fused Location Plugin NuSpec
using MvvmCross.Platform.Plugins;
namespace $rootnamespace$.Bootstrap
{
public class LocationPluginBootstrap
: MvxPluginBootstrapAction<MvvmCross.Plugins.Location.PluginLoader, MvvmCross.Plugins.Location.Fused.Droid.Plugin>
{
}
}
@alexshikov
alexshikov / LocationService.cs
Last active April 25, 2016 19:56
Example of Task based LocationService implementation using Mvx Location Plugin
public interface ILocationService
{
Coordinates GetLastSeenLocation();
Task<Coordinates> GetCurrentLocation ();
}
public class LocationService : ILocationService
{
private const string Tag = "LocationService";
@alexshikov
alexshikov / TilingTexture.shader
Last active April 18, 2018 04:32
Tiling shader for Unity3D 5.3.x (material tiling is broken in 5.3.4f1 for some reason)
Shader "Unlit/Tiling Texture"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Tiling ("Tiling", Vector) = (1, 1, 0, 0)
}
SubShader
{
Tags
@alexshikov
alexshikov / MainMasterDetailPage.cs
Last active March 11, 2019 17:48
Shadow for side menu using Xamarin.Forms MasterDetailPage
public class MainMasterDetailPage : MasterDetailPage
{
public MainMasterDetailPage ()
{
Detail = new ShadowNavigationPage();
}
}
@alexshikov
alexshikov / FixedNavigationRenderer.cs
Last active May 23, 2018 13:43
Fix to NavigationPageRenderer constructor crash
using System;
using Android.Runtime;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.AppCompat;
[assembly: ExportRenderer (typeof (NavigationPage), typeof (MyApp.Droid.Renderers.FixedNavigationRenderer))]
namespace MyApp.Droid.Renderers
{
// WARNING
// There is a crash happens for unknown reason: