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 MouseEnterIntent | |
{ | |
public static readonly DependencyProperty CommandProperty = | |
DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(MouseEnterIntent), new PropertyMetadata(OnSetCommandCallback)); | |
public static readonly DependencyProperty CommandParameterProperty = | |
DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(MouseEnterIntent), new PropertyMetadata(OnSetCommandParameterCallback)); | |
public static readonly DependencyProperty MouseEnterIntentCommandBehaviorProperty = | |
DependencyProperty.RegisterAttached("HoverIntentCommandBehavior", typeof(MouseEnterIntentCommandBehavior), typeof(MouseEnterIntent), null); |
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 DragOverControlToCommandBehavior : CommandBehaviorBase<Control> | |
{ | |
public DragOverControlToCommandBehavior(Control element) | |
: base(element) | |
{ | |
element.AllowDrop = true; | |
element.DragOver += ElementDragOver; | |
} | |
private void ElementDragOver(object sender, DragEventArgs e) |
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
[Export(typeof(ICommandHandlerFactory))] | |
public class CommandHandlerFactory : ICommandHandlerFactory | |
{ | |
private readonly IEnumerable<ICommandHandler> _commandHandlers; | |
[ImportingConstructor] | |
public CommandHandlerFactory([ImportMany]IEnumerable<ICommandHandler> commandHandlers) | |
{ | |
_commandHandlers = commandHandlers; | |
} |
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 LogInterceptor : IInterceptor | |
{ | |
public void Intercept(IInvocation invocation) | |
{ | |
if(invocation.TargetType.GetCustomAttributes(typeof(LogMethodCallsAttribute), true).Length > 0) | |
{ | |
var loggerFacade = MefInstanceProvider.Container.GetExportedValue<ILoggerFacade>(); | |
loggerFacade.Log(FormatMethodCall(invocation, ApplicationStates.Started), Category.Info, Priority.Low); | |
invocation.Proceed(); |
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 Literal | |
{ | |
private static string GetMemberName(Expression expression) | |
{ | |
switch (expression.NodeType) | |
{ | |
case ExpressionType.MemberAccess: | |
var memberExpression = (MemberExpression)expression; | |
var supername = GetMemberName(memberExpression.Expression); |
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 UnitOfWorkBehaviorAttribute : Attribute, IContractBehavior, IContractBehaviorAttribute | |
{ | |
public void Validate(ContractDescription contractDescription, ServiceEndpoint endpoint) | |
{ } | |
public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime) | |
{ | |
foreach(var operation in dispatchRuntime.EndpointDispatcher.DispatchRuntime.Operations) | |
{ | |
operation.CallContextInitializers.Add(new PCMUnitOfWorkCallContextInitializer()); |
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
namespace MSTestContrib.Specifications | |
{ | |
public static class BDDExtensions | |
{ | |
public static ThenGrammar Then(this WhenGrammar whenGrammar, string description, Action<SpecificationContext> implementation) | |
{ | |
Func<SpecificationContext, bool> implementationWithReturnTrue = (x) => | |
{ | |
implementation(x); | |
return true; |
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 virtual ActionResult PdfDownloadTravel() | |
{ | |
var reader = new PdfReader(Server.MapPath("~/pdf/travel_insurance_card.pdf")); | |
var outputPdfStream = new MemoryStream(); | |
var stamper = new PdfStamper(reader, outputPdfStream) { FormFlattening = true, FreeTextFlattening=true }; | |
var form = stamper.AcroFields; | |
form.SetField("Name", ""); | |
form.SetField("number", "500-0000324"); |
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
<#@ template language="C#" debug="true" hostSpecific="true" #> | |
<#@ output extension=".cs" #> | |
<#@ Assembly Name="System.Core.dll" #> | |
<#@ assembly name="EnvDTE" #> | |
<#@ Assembly Name="System.Windows.Forms.dll" #> | |
<#@ Assembly name="System.Configuration"#> | |
<#@ import namespace="System" #> | |
<#@ import namespace="System.IO" #> | |
<#@ import namespace="System.Diagnostics" #> | |
<#@ import namespace="System.Linq" #> |
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 IISExpress | |
{ | |
private static readonly List<string> sites = new List<string>(); | |
private static readonly List<string> paths = new List<string>(); | |
public static void StartIISExpress(string site, int port = 7329) | |
{ | |
if(!sites.Contains(site.ToLower())) | |
sites.Add(site.ToLower()); | |
else return; |
OlderNewer