Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🎶 You can roam the world with colours, flying high 🎶

Luis Beltran icebeam7

💭
🎶 You can roam the world with colours, flying high 🎶
View GitHub Profile
@icebeam7
icebeam7 / ViewModelClass.cs
Created Jun 13, 2020
ViewModel Class - command code snippet
View ViewModelClass.cs
private ICommand $myCommand$;
public ICommand $MyCommand$ => $myCommand$ ?? ($myCommand$ = new Command(() =>
{
}));
@icebeam7
icebeam7 / ViewModelClass.cs
Created Jun 13, 2020
ViewModel Class - namespaces code snippet
View ViewModelClass.cs
using System.Windows.Input;
using Xamarin.Forms;
@icebeam7
icebeam7 / ViewModelClass.cs
Created Jun 13, 2020
ViewModel Class - properties code snippet
View ViewModelClass.cs
private $type$ $myVar$;
public $type$ $MyProperty$
{
get => $myVar$;
set => SetValue(ref $myVar$, value);
}
@icebeam7
icebeam7 / BaseViewModel.cs
Created Jun 13, 2020
BaseViewModel.cs namespaces code snippet
View BaseViewModel.cs
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@icebeam7
icebeam7 / BaseViewModel.cs
Created Jun 13, 2020
BaseViewModel.cs code snippet
View BaseViewModel.cs
public class BaseViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected void SetValue<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
@icebeam7
icebeam7 / SaveAndroid.cs
Created Apr 10, 2020
Partial implementation of SaveAndroid.cs
View SaveAndroid.cs
public async Task SaveAndView(string fileName, String contentType, MemoryStream stream)
{
//...
if (file.Exists())
{
var path = Android.Net.Uri.FromFile(file);
var extension = MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString());
var mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
@icebeam7
icebeam7 / ProductView.xaml.cs
Created Dec 30, 2019
eliteKit: ProductView.xaml.cs (parcial)
View ProductView.xaml.cs
protected override void OnAppearing()
{
base.OnAppearing();
badge.BadgeView = new Image()
{
Source = ImageSource.FromResource("DemoEliteKit.Images.box.png"),
HeightRequest = 50,
WidthRequest = 50
};
@icebeam7
icebeam7 / App.xaml.cs
Created Dec 30, 2019
eliteKit: App.xaml.cs
View App.xaml.cs
using Xamarin.Forms;
namespace DemoEliteKit
{
public partial class App : Application
{
public App()
{
InitializeComponent();
@icebeam7
icebeam7 / ProductView.xaml
Created Dec 30, 2019
eliteKit: ProductView.xaml
View ProductView.xaml
<?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"
xmlns:ek="clr-namespace:eliteKit.eliteElements;assembly=eliteKit"
xmlns:converters="clr-namespace:DemoEliteKit.Converters"
xmlns:vm="clr-namespace:DemoEliteKit.ViewModels"
x:Class="DemoEliteKit.Views.ProductView"
mc:Ignorable="d">
@icebeam7
icebeam7 / ProductViewModel.cs
Created Dec 30, 2019
eliteKit: ProductViewModel.cs
View ProductViewModel.cs
using System.Windows.Input;
using System.Threading.Tasks;
using Xamarin.Forms;
using Acr.UserDialogs;
namespace DemoEliteKit.ViewModels
{
public class ProductViewModel : BaseViewModel
You can’t perform that action at this time.