This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.Serialization.Json; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Windows.Storage; | |
using Windows.Web.Http; | |
public static class Extensions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Prep | |
Update-ExecutionPolicy Unrestricted | |
Disable-UAC | |
#Win Config | |
Set-TaskbarOptions -Size Small -Lock -Dock Top | |
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions | |
Disable-InternetExplorerESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObservableDictionary<K, V> : INotifyCollectionChanged, IEnumerable<KeyValuePair<K, V>> | |
{ | |
private Dictionary<K, V> _dictionary = new Dictionary<K, V>(); | |
private void RaiseChanged(NotifyCollectionChangedAction action, params K[] keys) | |
{ | |
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(action, keys)); | |
DictionaryChanged?.Invoke(this, new NotifyDictionaryChangedEventArgs(action, keys)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(new DateTimeOffset(DateTime.Now)); | |
foreach (var item in Enumerable.Range(1, 10)) | |
{ | |
var date = new DateTime(2018, 8, 16); | |
var offset = TimeSpan.FromHours(-item); | |
var now = new DateTimeOffset(date, offset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class HolidayHelper | |
{ | |
public static DateTime NewYears => new DateTime(DateTime.Now.Year, 1, 1).Date; | |
public static DateTime Christmas => new DateTime(DateTime.Now.Year, 12, 25).Date; | |
public static DateTime GoodFriday => GetEaster(DateTime.Now.Year).AddDays(-2); | |
public static DateTime Easter => GetEaster(DateTime.Now.Year); | |
public static class Canada | |
{ | |
public static DateTime LabourDay => new DateTime(DateTime.Now.Year, 5, 1).Date; | |
public static DateTime Independence => new DateTime(DateTime.Now.Year, 7, 1).Date; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ContentProperty(Name = nameof(LiteralContent))] | |
public sealed class AppBarLiteral : AppBarSeparator | |
{ | |
public AppBarLiteral() | |
{ | |
DefaultStyleKey = typeof(AppBarLiteral); | |
} | |
public object LiteralContent | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task<string> ScaleImageAsync(string path, uint height = 32, uint width = 32, StorageFile output_file = null) | |
{ | |
// open file from path | |
var input_file = default(StorageFile); | |
try | |
{ | |
input_file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(path)); | |
} | |
catch (FileNotFoundException) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed partial class App : Application | |
{ | |
public App() | |
{ | |
InitializeComponent(); | |
Suspending += (s, e) => Helpers.ShowToast("Suspending"); | |
Resuming += (s, e) => Helpers.ShowToast("Resuming"); | |
Helpers.SetupExSession( | |
allowed: () => Helpers.ShowToast("Allowed"), | |
denied: () => Helpers.ShowToast("Denied"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Test("pass"); | |
Test("password"); | |
Test("Password"); | |
Test("P@ssword"); | |
Test("P@ssw0rd"); | |
Test("P@ssW0rD"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. | |
//See LICENSE in the project root for license information. | |
using System; | |
using System.Diagnostics; | |
using System.Net.Http.Headers; | |
using System.Net.Http; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Windows.Security.Authentication.Web; |