This file contains hidden or 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.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Media; | |
/// <summary> | |
/// Adorner for the watermark | |
/// </summary> | |
internal class WatermarkAdorner : Adorner |
This file contains hidden or 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.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
//http://social.msdn.microsoft.com/Forums/en-US/163ef755-ff7b-4ea5-b226-bbe8ef5f4796/is-there-a-pattern-for-calling-an-async-method-synchronously?forum=async | |
namespace ACME | |
{ | |
public static class AsyncHelpers | |
{ |
This file contains hidden or 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
// http://www.informit.com/articles/article.aspx?p=1231461 | |
public sealed class LockHolder<T> : IDisposable where T : class | |
{ | |
private T handle; | |
private bool holdsLock; | |
public LockHolder(T handle, int milliSecondTimeout) | |
{ | |
this.handle = handle; |
This file contains hidden or 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.Collections.Generic; | |
using System.Diagnostics.CodeAnalysis; | |
using Windows.Foundation; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Input; | |
using Windows.UI.Xaml.Media; | |
using Windows.UI.Xaml.Media.Animation; | |
namespace SharpGIS.Metro.Controls |
This file contains hidden or 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
rundll32 dfshim CleanOnlineAppCache |
This file contains hidden or 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 DateTime GetNetworkTime() | |
{ | |
//default Windows time server | |
const string ntpServer = "time.windows.com"; | |
// NTP message size - 16 bytes of the digest (RFC 2030) | |
var ntpData = new byte[48]; | |
//Setting the Leap Indicator, Version Number and Mode values | |
ntpData[0] = 0x1B; //LI = 0 (no warning), VN = 3 (IPv4 only), Mode = 3 (Client Mode) |
This file contains hidden or 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
git gc --prune=now --aggressive |
This file contains hidden or 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
// THIS SOFTWARE COMES "AS IS", WITH NO WARRANTIES. THIS | |
// MEANS NO EXPRESS, IMPLIED OR STATUTORY WARRANTY, INCLUDING | |
// WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY OR FITNESS | |
// FOR A PARTICULAR PURPOSE OR ANY WARRANTY OF TITLE OR | |
// NON-INFRINGEMENT. | |
// | |
// MICROSOFT WILL NOT BE LIABLE FOR ANY DAMAGES RELATED TO | |
// THE SOFTWARE, INCLUDING DIRECT, INDIRECT, SPECIAL, | |
// CONSEQUENTIAL OR INCIDENTAL DAMAGES, TO THE MAXIMUM EXTENT | |
// THE LAW PERMITS, NO MATTER WHAT LEGAL THEORY IT IS |
This file contains hidden or 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
private T FindVisualChild<T>(DependencyObject obj) | |
where T : DependencyObject | |
{ | |
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) | |
{ | |
DependencyObject child = VisualTreeHelper.GetChild(obj, i); | |
if (child != null && child is T) | |
return (T) child; | |
else |
This file contains hidden or 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 AttachedCommands | |
{ | |
public static readonly DependencyProperty ControlTappedCommandProperty = | |
DependencyProperty.RegisterAttached("ControlTappedCommand", | |
typeof(ICommand), typeof(AttachedCommands), | |
new PropertyMetadata(null, new PropertyChangedCallback(AttachOrRemoveUIElementTappedEvent))); | |
public static ICommand GetControlTappedCommand(DependencyObject obj) | |
{ | |
return (ICommand)obj.GetValue(ControlTappedCommandProperty); |
NewerOlder