Skip to content

Instantly share code, notes, and snippets.

View dylanberry's full-sized avatar
🛠️
Code.Build.Test.Deploy.Monitor.Repeat(); 🥇

dylanberry dylanberry

🛠️
Code.Build.Test.Deploy.Monitor.Repeat(); 🥇
View GitHub Profile
using Microsoft.AspNetCore.Mvc.Filters;
namespace VersionCheck.API.VersionCheck
{
public class MinimumClientVersionFilter : IActionFilter
{
private readonly IVersionCheckService _versionCheckHelper;
public MinimumClientVersionFilter(IVersionCheckService versionCheckHelper)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BSILabs.Controls
{
public class NullableDatePicker : DatePicker
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace XamlOpenUrl.Extensions
{
[ContentProperty(nameof(Url))]
protected override async void OnInitialized()
{
try
{
InitializeComponent();
OneSignal.Current
.StartInit(Secrets.OneSignal)
.HandleNotificationOpened(OnNotificationOpened)
.EndInit();
<?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:XamlFlags"
x:Class="XamlFlags.MainPage"
x:Name="Page">
<ContentPage.BindingContext>
<local:MainPageViewModel />
</ContentPage.BindingContext>
<StackLayout BindableLayout.ItemsSource="{Binding Options}">
<ContentPage>
<StackLayout>
@foreach (var option in Options)
{
<Frame CornerRadius="4" Padding="0">
<StackLayout Orientation="StackOrientation.Horizontal" Padding="5"
BackgroundColor="(option.IsEnabled ? (option.IsSelected ? Color.DarkBlue : Color.White) : Color.DarkGray)"
IsEnabled="option.IsEnabled">
<Button Text="Select" OnClick="(() => OnSelectType(option))" />
<Label Text="✓"
public class AuthenticationService
{
public bool IsUserAuthenticated => !string.IsNullOrWhiteSpace(AccessToken);
public string AccessToken { get; private set; }
private readonly IPublicClientApplication _publicClientApplication;
private readonly string[] _scopes;
private readonly JwtSecurityTokenHandler _jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
public AuthenticationService()
public bool PromptToConfirmExit
{
get
{
bool promptToConfirmExit = false;
if (MainPage is ContentPage)
{
promptToConfirmExit = true;
}
else if (MainPage is Xamarin.Forms.MasterDetailPage masterDetailPage
// Confirm with dialog
public override void OnBackPressed()
{
if (((ConfirmBack.App)App.Current).PromptToConfirmExit)
{
using (var alert = new AlertDialog.Builder(this))
{
alert.SetTitle("Confirm Exit");
alert.SetMessage("Are you sure you want to exit?");
alert.SetPositiveButton("Yes", (sender, args) => { FinishAffinity(); }); // inform Android that we are done with the activity
@dylanberry
dylanberry / StreamNotes-2020-04-11.md
Last active April 11, 2020 22:50
StreamNotes-2020-04-11

Notes From Dan

// This should result in a Tabbed Page with ViewA & ViewB as tabs and ViewB as the selected Tab...
// ViewC should be a Modal over the TabbedPage
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=ViewB&selectedTab=ViewB/ViewC");
// If we're improving things... then this should create a tab with a NavigationPage with the root ViewB and current page as ViewD...
// The select tab should be able to distinguish it by NavigationPage unless more than one tab has a NavigationPage..
// otherwise it should distinguish which tab by either the root or current which ever matches...
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=NavigationPage/ViewB/ViewC/ViewD&selectedTab={NavigationPage|ViewB|ViewD}");
// Second note here that was actually invalid and should not be supported... as the first actual `/` should be treated as an entirely new segment