This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string SignES256(string privateKey, string header, string payload) | |
{ | |
CngKey key = CngKey.Import( | |
Convert.FromBase64String(privateKey), | |
CngKeyBlobFormat.Pkcs8PrivateBlob); | |
using (ECDsaCng dsa = new ECDsaCng(key)) | |
{ | |
dsa.HashAlgorithm = CngAlgorithm.Sha256; | |
var unsignedJwtData = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#iOS Setup | |
// In Appdelegate override OpenUrl (UIApplication app, NSUrl url, NSDictionary options) and add | |
return SimpleAuth.Native.OpenUrl(app, url, options); | |
//#Android | |
//In Activity override OnCreate and add | |
SimpleAuth.Providers.Google.Init(this.Application); | |
//In Activity override OnActivityResult(int requestCode, Result resultCode, Intent data) and add | |
SimpleAuth.Native.OnActivityResult (requestCode,resultCode,data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static string GetString(string defaultValue = "",[CallerMemberName] string memberName = "") | |
{ | |
return AppSettings.GetValueOrDefault(memberName,defaultValue); | |
} | |
static void SetString (string value,[CallerMemberName] string memberName = "") | |
{ | |
AppSettings.AddOrUpdateValue<string>(memberName, value); | |
} | |
static int GetInt(int defaultValue = 0, [CallerMemberName] string memberName = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VectorImageViewRenderer : ImageRenderer | |
{ | |
static readonly NGraphics.IPlatform Platform = new AndroidPlatform(); | |
protected override void OnElementChanged(ElementChangedEventArgs<Image> e) | |
{ | |
base.OnElementChanged(e); | |
if (e.OldElement == null) | |
{ | |
this.DrawImage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.IO; | |
using Android.Graphics.Drawables; | |
using System.Threading.Tasks; | |
using Xamarin.Forms.Platform.Android; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using UIKit; | |
namespace NGraphics | |
{ | |
public static class NGraphicsExtensions | |
{ | |
static readonly IPlatform Platform = new ApplePlatform(); | |
static readonly double Scale = (double) UIScreen.MainScreen.Scale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
public static class ResourceLoader | |
{ | |
public static Stream GetEmbeddedResourceStream(string resourceFileName) | |
{ | |
var assembly = typeof(ResourceLoader).GetTypeInfo().Assembly; | |
return GetEmbeddedResourceStream(assembly, resourceFileName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using NGraphics; | |
namespace UIKit | |
{ | |
public static class NGraphicsExtensions | |
{ | |
static readonly IPlatform Platform = new ApplePlatform(); | |
static readonly double Scale = (double)UIScreen.MainScreen.Scale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unexpected character encountered while parsing value: . Path '', line 0, position 0. (Newtonsoft.Json.JsonReaderException) | |
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002c2] in <filename unknown>:0 | |
at Newtonsoft.Json.JsonTextReader.ReadInternal () [0x00043] in <filename unknown>:0 | |
at Newtonsoft.Json.JsonTextReader.Read () [0x00007] in <filename unknown>:0 | |
at Amazon.CloudDrive.CloudDriveApi+<GetChanges>c__asyncD.MoveNext () [0x001bc] in /Users/Clancey/Projects/AmazonCloudDriveApi/src/AmazonCloudDriveApi/AmazonCloudDriveApi.Shared/CloudDrive/CloudDriveApi.cs:210 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void EnsureInvokedOnMainThread(Action action) | |
{ | |
if (NSThread.Current.IsMainThread) | |
{ | |
action(); | |
return; | |
} | |
BeginInvokeOnMainThread (action ); | |
} |