Skip to content

Instantly share code, notes, and snippets.

View Axemasta's full-sized avatar

Axemasta

View GitHub Profile
@Axemasta
Axemasta / RandomColor.cs
Created February 24, 2023 10:29
Get a random color in Xamarin
private static Random random = new Random();
private Color GetRandomColor()
{
var r = (double)random.Next(1, 256);
var g = (double)random.Next(1, 256);
var b = (double)random.Next(1, 256);
r = r / 255;
g = g / 255;
@Axemasta
Axemasta / PathBuilder.cs
Created March 30, 2022 10:08
Prism Tabbed Page Builder
private string GetTabbedPagePath()
{
string path = nameof(Views.MainTabbedPage);
var children = new List<string>()
{
$"createTab={nameof(Views.TabAPage)}",
$"createTab={nameof(Views.TabBPage)}",
$"createTab={nameof(Views.TabCPage)}"
};
@Axemasta
Axemasta / NavigationServiceExtensons.cs
Created December 1, 2021 10:19
INavigationService Extensions for thread safe + error handled navigation
using System;
using System.Threading.Tasks;
using Prism;
using Prism.Navigation;
using Xamarin.Forms;
using Xamarin.Essentials.Interfaces;
using Xamarin.Essentials.Implementation;
public static class NavigationServiceExtensions
{
@Axemasta
Axemasta / ClearButtonColorEffect.android.cs
Created June 3, 2021 17:28
Entry CreateButtonColor Effect
public class AndroidClearButtonColorEffect : PlatformEffect
{
private EditText _textField;
private readonly Context _context;
ClearButtonColorEffect _formsEffect
{
get
{
@Axemasta
Axemasta / app.xaml.cs
Created May 24, 2021 15:48
Global Logging
namespace Global.Logging
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class App : PrismApplication
{
protected override async void OnInitialized()
{
InitializeComponent();
@Axemasta
Axemasta / App.xaml.cs
Created May 24, 2021 14:13
Update Profile After Login
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using ShellDemo.Services;
using ShellDemo.Views;
namespace ShellDemo
{
public partial class App : Application
{
@Axemasta
Axemasta / FormattedButton.cs
Last active December 9, 2020 15:50
Xamarin Forms Button With FormattedText
public class FormattedButton : Button
{
#region Properties
#region - Bindable Property Declaration
/// <summary>
/// Formatted Text Property
/// </summary>
public static readonly BindableProperty FormattedTextProperty = BindableProperty.Create(nameof(FormattedText), typeof(FormattedString), typeof(FormattedButton), default(FormattedString));
@Axemasta
Axemasta / attributedbuttons.cs
Last active December 9, 2020 13:07
Attributed UIButtons
using System;
using CoreGraphics;
using CoreText;
using Foundation;
using UIKit;
namespace RainbowButtons.iOS
{
public partial class ViewController : UIViewController
{
@Axemasta
Axemasta / SqlHelper.cs
Created February 2, 2020 00:31
SqlHelper Class
public static class SqlHelper
{
#region Methods
#region - Public Methods
/// <summary>
/// Replace * In SQL Statement With Object Properties
/// </summary>
/// <typeparam name="T"></typeparam>
@Axemasta
Axemasta / FilePicker.cs
Last active December 18, 2019 11:51
WPF File/Folder Picker
//https://user-images.githubusercontent.com/33064621/71083553-31544b00-218b-11ea-97af-74280ecaef96.png
using System;
using System.Windows;
using System.Windows.Controls;
//Requires NuGet Package: "https://www.nuget.org/packages/Microsoft.WindowsAPICodePack-Shell"
using Microsoft.WindowsAPICodePack.Dialogs;
public class FilePicker : UserControl