Skip to content

Instantly share code, notes, and snippets.

View punker76's full-sized avatar
☮️
#PEACE

Jan Karger ツ ☀ punker76

☮️
#PEACE
View GitHub Profile
@punker76
punker76 / gist:62f1f7da69022a82dd515120cd15d710
Created February 25, 2019 09:21
Can't restore with MSBuild.Sdk.Extras and VS 2019 and .NET Core 3.0 preview
https://dev.azure.com/mahapps/MahApps.Metro.IconPacks/_build/results?buildId=36
##[section]Starting: NuGet restore
==============================================================================
Task : NuGet
Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
Version : 2.147.6
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================
public class PackIconControl : ContentControl
{
public PackIconControl()
{
SizeChanged += OnSizeChanged;
}
public static readonly DependencyProperty PackIconKindProperty =
DependencyProperty.Register(nameof(PackIconKind), typeof(object), typeof(PackIconControl),
new PropertyMetadata(default(object), PackIconKindPropertyChangedCallback));
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Ghostly.Utilities
{
// Emoji list borrowed from https://github.com/lunet-io/markdig/blob/25959174d521c7f4458fa7b340d58a4ac136fa30/src/Markdig/Extensions/Emoji/EmojiParser.cs
public static class EmojiReplacer
{
private static Regex _regex;
private static Dictionary<string, string> _lookup;
@punker76
punker76 / convert.cs
Created April 8, 2020 20:13
SkiaSharp Svg to Png
// memoryStream is the stream of the svg url
// imageStream is the converted png which will be converted with Splat.BitmapLoader to an IBitmap
var svg = new SkiaSharp.Extended.Svg.SKSvg();
svg.Load(memoryStream);
var imageInfo = new SKImageInfo((int)desiredSize.Width, (int)desiredSize.Height);
using (var surface = SKSurface.Create(imageInfo))
using (var canvas = surface.Canvas)
{
@punker76
punker76 / MyCustomDialog.cs
Last active April 13, 2020 21:14
Custom Dialog sample with result
/// <summary>
/// Interaction logic for MyCustomDialog.xaml
/// </summary>
public partial class MyCustomDialog : CustomDialog
{
private TaskCompletionSource<bool> tcs;
public MyCustomDialog()
: this(null, null)
{
@punker76
punker76 / MyCustomDialog.cs
Created April 27, 2020 20:11
IncludeRelease
public bool IncludeRelease
{
get { return _includeRelease; }
set
{
if (SetPropertyValue(ref _includeRelease, value))
{
_cts.Cancel();
@punker76
punker76 / MyCustomDialog.cs
Created April 27, 2020 20:34
OwnerCanCloseWithDialog
...
var settings = new MetroDialogSettings { OwnerCanCloseWithDialog = true };
var dataContext = new AdvancedInstallViewModel(_chocolateyService.GetAvailableVersionsForPackageIdAsync(Id), Version);
customDialog.Content = new AdvancedChocolateyDialog { DataContext = dataContext };
await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog, settings);
var result = await dataContext.WaitForClosingAsync();
@punker76
punker76 / App.xaml.cs
Created August 11, 2020 20:48
Use Navy color as theme for MahApps
using System.Windows;
using System.Windows.Media;
using ControlzEx.Theming;
namespace WpfApp3
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
@punker76
punker76 / build.cake
Created January 21, 2021 09:40
Build Delphi projects with Cake
///////////////////////////////////////////////////////////////////////////////
// TOOLS / ADDINS
///////////////////////////////////////////////////////////////////////////////
#tool "nuget:?package=GitVersion.CommandLine&version=5.6.3"
#addin "nuget:?package=Cake.Figlet&version=1.3.1"
#addin "nuget:?package=Cake.Incubator&version=5.1.0"
#addin "nuget:?package=Cake.FileHelpers&version=3.3.0"
///////////////////////////////////////////////////////////////////////////////