Skip to content

Instantly share code, notes, and snippets.

@mallibone
mallibone / BuildDirCleanup.fsx
Created June 10, 2021 17:24
.NET build output cleanup script
#time
open System.IO
open System.Globalization
let EnumerateDirectories path =
Directory.EnumerateDirectories(path) |> Seq.toList
let isObjOrBinFolder (folderName:string) =
folderName.EndsWith("obj", true, CultureInfo.InvariantCulture) || folderName.EndsWith("bin", true, CultureInfo.InvariantCulture)
public class AwareNavigationController : UINavigationController
{
public event EventHandler PoppedViewController;
public AwareNavigationController():base() {}
public AwareNavigationController(UIViewController rootViewController):base(rootViewController){}
public AwareNavigationController(IntPtr intPtr) : base(intPtr) { }
public AwareNavigationController(NSCoder coder) : base(coder) { }
public AwareNavigationController(NSObjectFlag t) : base(t) { }
public AwareNavigationController(string nibName, NSBundle bundle) : base(nibName, bundle ) { }
public LoginPage ()
{
InitializeComponent ();
BindingContext = ViewModel;
UsernameEntry.Completed += (sender, args) => { PasswordEntry.Focus(); };
PasswordEntry.Completed += (sender, args) => { ViewModel.AuthenticateCommand.Execute(null); };
}
protected override void OnAppearing()
{
if (!App.IsUserLoggedIn)
{
App.NavigationService.NavigateModalAsync(PageNames.LoginPage, false);
}
base.OnAppearing();
}
protected override bool OnBackButtonPressed()
{
return true;
}
private void Logout()
{
_navigationService.NavigateModalAsync(PageNames.LoginPage);
}
using System.ComponentModel;
using System.Windows.Input;
using LoginViewSample.Core.Services;
using Xamarin.Forms;
namespace LoginViewSample.Core.ViewModels
{
public class LoginViewModel : INotifyPropertyChanged
{
private string _username;
<?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="LoginViewSample.Core.Views.LoginPage">
<ContentPage.Content>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
await _navigationService.NavigateAsync("PushNavigationPage", "simple string parameter");
public partial class App : Application
{
public App()
{
InitializeComponent();
NavigationService.Configure("MainPage", typeof(Views.MainPage));
NavigationService.Configure("ModalNavigationPage", typeof(Views.ModalNavigationPage));
NavigationService.Configure("PushNavigationPage", typeof(Views.PushNavigationPage));
var mainPage = ((ViewNavigationService) NavigationService).SetRootPage("MainPage");