Skip to content

Instantly share code, notes, and snippets.

View juucustodio's full-sized avatar

Juliano Custódio juucustodio

View GitHub Profile
@juucustodio
juucustodio / MainViewModel.cs
Created July 27, 2019 18:06
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using MVVMCoffee.ViewModels;
using Xamarin.Forms;
namespace Sample.ViewModels
{
public class MainViewModel : BaseViewModel
{
public Command PushAsyncToFormCommand { get; }
public Command SetRootFormCommand { get; }
public MainViewModel()
@juucustodio
juucustodio / FormViewModel.cs
Created July 27, 2019 18:06
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using System;
using MVVMCoffee.ViewModels;
using Sample.Models;
using Xamarin.Forms;
namespace Sample.ViewModels
{
public class FormViewModel : BaseViewModel
{
public Command PopAsyncCommand { get; }
@juucustodio
juucustodio / FormPage.xaml
Created July 27, 2019 17:48
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
<?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="Sample.Views.FormPage"
Title="{Binding TitlePage}">
<ContentPage.Content>
<StackLayout Margin="20">
<StackLayout>
<Label Text="Example of Customer object for demonstrate using interface INotifyPropertyChanged"
HorizontalTextAlignment="Center"/>
@juucustodio
juucustodio / MainPage.xaml
Created July 27, 2019 17:46
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Sample.MainPage"
Title="{Binding TitlePage}">
<StackLayout Margin="20" VerticalOptions="Center">
@juucustodio
juucustodio / App.xaml.cs
Created July 27, 2019 17:42
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using Xamarin.Forms;
namespace Sample
{
public partial class App : Application
{
public App()
{
InitializeComponent();
@juucustodio
juucustodio / MainViewModel.cs
Created July 25, 2019 03:18
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using MVVMCoffee.ViewModels;
namespace Sample.ViewModels
{
public class MainViewModel : BaseViewModel
{
public MainViewModel()
{
}
@juucustodio
juucustodio / MainPage.xaml.cs
Created July 25, 2019 03:08
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using System.ComponentModel;
using Sample.ViewModels;
using Xamarin.Forms;
namespace Sample
{
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
private MainViewModel ViewModel => BindingContext as MainViewModel;
@juucustodio
juucustodio / Customer.cs
Created July 25, 2019 03:02
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
using MVVMCoffee.Models;
namespace Sample.Models
{
public class Customer : BaseModel
{
public string Name
{
get { return _name; }
set { SetProperty(ref _name, value); }
@juucustodio
juucustodio / MainActivity.cs
Created July 22, 2019 17:46
Solicitar permissão para acessar o Bluetooth no Android - http://julianocustodio.com/bluetooth
using Android;
using Android.App;
using Android.Content.PM;
using Android.OS;
namespace DemoBluetooth.Droid
{
[Activity(Label = "DemoBluetooth", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
@juucustodio
juucustodio / AndroidManifest.xml
Created July 22, 2019 17:43
Permissão para acessar o Bluetooth no Android - http://julianocustodio.com/bluetooth
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.DemoBluetooth" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.LOCATION_HARDWARE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />