Skip to content

Instantly share code, notes, and snippets.

View icebeam7's full-sized 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 June 13, 2020 17:38
ViewModel Class - command code snippet
private ICommand $myCommand$;
public ICommand $MyCommand$ => $myCommand$ ?? ($myCommand$ = new Command(() =>
{
}));
@icebeam7
icebeam7 / ViewModelClass.cs
Created June 13, 2020 17:35
ViewModel Class - namespaces code snippet
using System.Windows.Input;
using Xamarin.Forms;
@icebeam7
icebeam7 / ViewModelClass.cs
Created June 13, 2020 17:25
ViewModel Class - properties code snippet
private $type$ $myVar$;
public $type$ $MyProperty$
{
get => $myVar$;
set => SetValue(ref $myVar$, value);
}
@icebeam7
icebeam7 / BaseViewModel.cs
Created June 13, 2020 17:22
BaseViewModel.cs namespaces code snippet
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@icebeam7
icebeam7 / BaseViewModel.cs
Created June 13, 2020 17:10
BaseViewModel.cs code snippet
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 April 10, 2020 23:57
Partial implementation of 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 December 30, 2019 12:24
eliteKit: ProductView.xaml.cs (parcial)
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 December 30, 2019 12:21
eliteKit: App.xaml.cs
using Xamarin.Forms;
namespace DemoEliteKit
{
public partial class App : Application
{
public App()
{
InitializeComponent();
@icebeam7
icebeam7 / ProductView.xaml
Created December 30, 2019 12:21
eliteKit: 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 December 30, 2019 12:06
eliteKit: ProductViewModel.cs
using System.Windows.Input;
using System.Threading.Tasks;
using Xamarin.Forms;
using Acr.UserDialogs;
namespace DemoEliteKit.ViewModels
{
public class ProductViewModel : BaseViewModel