Skip to content

Instantly share code, notes, and snippets.

@brunoportess
brunoportess / MainActivity.cs
Created August 31, 2017 21:19
Exemplo de BroadcastReceiver
[Activity(Label = "Cronometro", MainLauncher = true)]
public class MainActivity : Activity
{
Receiver1 receiver;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
<?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:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
xmlns:forms="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
x:Class="QrCodeSample.Views.VerificaQrCode">
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<forms:ZXingScannerView IsScanning="{Binding IsScanning}" IsAnalyzing="{Binding IsAnalyzing}" Result="{Binding Result, Mode=TwoWay}" ScanResultCommand="{Binding QRScanResultCommand}"></forms:ZXingScannerView>
<forms:ZXingDefaultOverlay TopText="QCLUB - Leitor QrCode" BottomText="Passe o leitor sobre o QrCode" ShowFlashButton="False" Opacity="0.9"></forms:ZXingDefaultOverlay>
</Grid>
//ESSA É A CONTROLLER DA API QUE RECEBE OS DADOS (ASPNET CORE)
[Produces("application/json")]
[Route("api/cupons/[action]")]
public class CuponsController : Controller
{
private readonly CupomDAO _cupomDao;
private readonly ClienteDAO _clienteDao;
public class MaskMoney : Behavior<Entry>
{
protected override void OnAttachedTo(Entry bindable)
{
bindable.TextChanged += onTextChanged;
base.OnAttachedTo(bindable);
}
protected override void OnDetachingFrom(Entry bindable)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cliente.Models.Entities
{
public class Orcamento
{
@brunoportess
brunoportess / View.xaml
Created November 4, 2017 13:13
Meu switch tem o Toogle na propriedade EnviaOrcamento do meu objeto e essa propriedade é booleana (bool)
<?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:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
x:Class="Cliente.Views.Orcamento.OrcamentoEmpresas"
Title="Enviar para...">
<ListView
x:Name="ListCompanies"
CachingStrategy="RecycleElement"
ItemsSource="{Binding ListCompanies}"
@brunoportess
brunoportess / ISQLiteConf.cs
Created November 6, 2017 13:32
Exemplo implementação sqlite em xamarin forms. Foi usado o nuget package sqlite-net-pcl
using SQLite;
namespace NOME_SOLUCAO.SQLite
{
//PCL
public interface ISQLiteConf
{
SQLiteConnection GetConnection();
string DiretorioDB { get; }
@brunoportess
brunoportess / AndroidManifest.xml
Created December 7, 2017 16:44
Xamarin Forms Maps - Android Settings
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="PACKAGE_NAME" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<!--
Generated template for the AtendidasPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<button ion-button menuToggle showWhen="android">
<ion-icon name="menu"></ion-icon>
@brunoportess
brunoportess / Chat.xaml
Created February 8, 2018 13:04
Base para criar chat com template similar ao whatsApp
<ScrollView>
<Grid RowSpacing="0" ColumnSpacing="0" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ListView
x:Name="MessagesListView"
ItemTemplate="{StaticResource MessageTemplateSelector}"