Skip to content

Instantly share code, notes, and snippets.

View Axemasta's full-sized avatar

Axemasta

View GitHub Profile
@Axemasta
Axemasta / ExampleUserControl.cs
Last active December 16, 2019 13:29
WPF Custom Properties User Control
public class ExampleUserControl : UserControl
{
#region Properties
#region - Bindable Property Declaration
public static readonly DependencyProperty ExampleTextProperty =
DependencyProperty.Register(
nameof(ExampleText),
typeof(string),
@Axemasta
Axemasta / Orientation.cs
Last active May 31, 2019 09:59
Orientation Aware Content Page
/// <summary>
/// Device Orientation.
/// </summary>
public enum Orientation
{
/// <summary>
/// Portrait Orientation.
/// </summary>
Portrait,
@Axemasta
Axemasta / SectionHandler.cs
Created March 7, 2019 09:39
Custom App Config Sections
using System.Collections.Generic;
using System.Configuration;
using System.Xml;
public class ExcludeKeywordSection : IConfigurationSectionHandler
{
public object Create(object parent, object configContext, XmlNode section)
{
List<string> myConfigObject = new List<string>();
@Axemasta
Axemasta / ClassTemplates.cs
Created January 20, 2019 20:14
My C# Class Templates
public class ClassName
{
#region Properties
#endregion Properties
public ClassName()
{
}
@Axemasta
Axemasta / XamarinIosModel
Created January 9, 2019 17:14
Converts the iphone model strong (using GetSystemLibraryProperty("hw.machine") from a device code to a device model. Xamarin Essentials returns the code iPhone1,1 instead of iPhone 1, this method will convert it.
/// <summary>
/// Gets the device model from model code.
/// https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios
/// </summary>
/// <returns>The device model.</returns>
/// <param name="modelCode">Model code.</param>
private string GetDeviceModel(string modelCode)
{
switch (modelCode)
{
@Axemasta
Axemasta / ViewModelAsyncLoad.cs
Created December 10, 2018 21:27
Demonstrates how api data can be fetched from a webservice when a viewmodel is initially loaded.
public class ExampleViewModel : INotifyPropertyChanged
{
private readonly IDataObjectService _dataObjectService;
ObservableCollection<DataObject> _bindedList;
ObservableCollection<DataObject> BindedList
{
get { return _bindedList; }
}
@Axemasta
Axemasta / TestGist1.cs
Created August 14, 2018 13:25
Test Gist
var lol = "hello world";
@Axemasta
Axemasta / AndroidCornerRadiusRenderer.cs
Created July 25, 2018 08:41
Xamarin Android Corner Radius
protected override bool DrawChild(Canvas canvas, Android.Views.View child, long drawingTime)
{
float cornerRadius = child.Height / 2;
var path = new Path();
path.AddRoundRect(new RectF(0, 0, child.Width, child.Height), cornerRadius, cornerRadius, Path.Direction.Cw);
canvas.ClipPath(path);
return base.DrawChild(canvas, child, drawingTime);
}
@Axemasta
Axemasta / Options.cs
Created May 14, 2018 16:12
Command Line Parser Demo
class Options
{
// Omitting long name, defaults to name of property, ie "--verbose"
[Option(Default = false, HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
}
/// <summary>
/// The class map of the object you want to parse (The csv column headers)
/// <summary>
sealed class c : ClassMap<ParseUser>
{
/// <summary>
/// CSV Definition Map For <ParseUser>
/// </summary>
public ParseUserDefinitionMap()
{