Skip to content

Instantly share code, notes, and snippets.

View LanceMcCarthy's full-sized avatar
💾
Bashing __(ง'̀-'́)ง__ bugs

Lance McCarthy LanceMcCarthy

💾
Bashing __(ง'̀-'́)ง__ bugs
View GitHub Profile
@LanceMcCarthy
LanceMcCarthy / ThemeModel.cs
Created September 22, 2016 20:38
Custom Themeing model for Xamarin Forms' DynamicResource
[DataContract]
public class ThemeModel : INotifyPropertyChanged
{
private Color backgroundColor;
private Color textColor;
private Color buttonBackgroundColor;
private Color buttonTextColor;
private Color accentColor;
private Color headerColor;
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml
Last active January 10, 2017 23:17
ManipulatedDrawer XAML
<Page x:Class="DetailsDrawer.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DetailsDrawer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:DetailsDrawer.ViewModels"
mc:Ignorable="d">
<Page.DataContext>
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml.cs
Created January 10, 2017 23:18
ManipulationDrawer demo main page code behind
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
namespace DetailsDrawer
{
public sealed partial class MainPage : Page
{
public MainPage()
@LanceMcCarthy
LanceMcCarthy / MainViewModel.cs
Created January 10, 2017 23:19
ManiulationDrawer demo view model and model
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using DetailsDrawer.Annotations;
namespace DetailsDrawer.ViewModels
{
public class MainPageViewModel : INotifyPropertyChanged
{
private ObservableCollection<RouteStep> routeSteps;
@LanceMcCarthy
LanceMcCarthy / ItemViewModel.cs
Created December 2, 2017 22:23
FlyoutPresenter with Acrylic Brush Background
public class ItemViewModel
{
public string Title { get; set; }
public string ThumbnailUrl { get; set; }
public List<string> Details { get; set; }
}
@LanceMcCarthy
LanceMcCarthy / CustomTheme.xaml
Created February 19, 2018 19:57
Custom Theme for UI for Xamarin
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TelerikXamarinApp1.Portable.Themes.CustomTheme">
<!-- Chart -->
<Color x:Key="ChartAxisColor">#919191</Color>
<Color x:Key="ChartGridLinesColor">#D9D9D9</Color>
<!-- ListView -->
<Color x:Key="ListViewItemBorderColor">Azure</Color>
@LanceMcCarthy
LanceMcCarthy / ThemeHelper.cs
Created February 19, 2018 20:00
Helper class to change theme resources at runtime
using Telerik.XamarinForms.Common;
using Xamarin.Forms;
namespace YourAwesomeApp.Helpers
{
public static class ThemeHelper
{
public static void ChangeTheme(string themeName)
{
if(Application.Current.Resources != null)
<?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:dataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
xmlns:input="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
x:Class="TelerikXamarinApp1.Portable.StartPage">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
public class DateRangeChangedEventArgs : System.EventArgs
{
public DateRangeChangedEventArgs(DateTime startDate, DateTime endDate)
{
StartDate = startDate;
EndDate = endDate;
}
public DateTime StartDate { get; set; }
@LanceMcCarthy
LanceMcCarthy / Program.cs
Last active August 28, 2018 17:37
Brotli Compression Test
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using static System.Console;
namespace BrotliTest