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
| //Your code you are testing: | |
| public IAsyncCommand SignInCommand { get; private set; } | |
| public ctor() | |
| { | |
| SignInCommand = new AwaitableDelegateCommand(Login); | |
| } | |
| private async Task Login() | |
| { |
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.Linq; | |
| using System.Text.RegularExpressions; | |
| using System.Windows; | |
| using System.Windows.Controls; | |
| using System.Windows.Input; | |
| using CCWin.Core.Extensions; | |
| namespace CCWin.App.Infrastructure.Behaviours | |
| { |
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
| var save = new ButtonExtras(ButtonType.Custom, "Save", "Saves this modified post to your blog"); | |
| var saveAs = new ButtonExtras(ButtonType.Custom, "Save As", "Saves this blog post as a local markdown file"); | |
| var publish = new ButtonExtras(ButtonType.Custom, "Publish As", "Publishes this post to another blog, or as another post"); | |
| dialogService.ShowConfirmationWithCancel("Markpad", "What do you want to do?", "", save, saveAs, publish); | |
| if (save.WasClicked) | |
| return base.Publish(); | |
| if (saveAs.WasClicked) | |
| return SaveAs(); | |
| if (publish.WasClicked) |
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 Retry | |
| { | |
| public const int WindowWaitDefault = 30; | |
| public const int ElementWaitDefault = 10; | |
| private const int RetryIntervalInMs = 200; | |
| public static Window ForDefault(Func<Window> getMethod) | |
| { | |
| return For(getMethod, WindowWaitDefault); | |
| } |
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
| //In generic.xaml | |
| <Style TargetType="{x:Type Scaffolding:SearchScaffold}"> | |
| <Setter Property="BorderThickness" | |
| Value="0" /> | |
| <Setter Property="Template"> | |
| <Setter.Value> | |
| <ControlTemplate TargetType="{x:Type Scaffolding:SearchScaffold}"> | |
| <Controls:MetroContentControl> |
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
| /// <summary> | |
| /// Handles JsonP requests when requests are fired with text/javascript | |
| /// </summary> | |
| public class JsonpFormatter : JsonMediaTypeFormatter | |
| { | |
| public JsonpFormatter() | |
| { | |
| SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); | |
| SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/javascript")); |
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 PredicateBuilder | |
| { | |
| public static Expression<Func<T, bool>> True<T>() | |
| { | |
| return Expression.Lambda<Func<T, bool>>(Expression.Constant(true), Expression.Parameter(typeof(T))); | |
| } | |
| public static Expression<Func<T, bool>> False<T>() | |
| { |
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
| var predicate = PredicateBuilder.True<Person>(); | |
| if (filderOptions.FirstName != null) | |
| predicate = predicate.AndAlso(p=>p.FirstName == "Alex"); | |
| if (filderOptions.SomeNullable.HasValue) | |
| predicate = predicate.AndAlso(p=>p.SomeProp == filterOptions.SomeNullable.Value); | |
| var where = queryable.Where(predicate); | |
| // will create an expresion which looks like this: p => true && p.FirstName == "Alex" && p.SomeProp == filterOptions.SomeNullable.Value) |
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
| # Auto detect text files and perform LF normalization | |
| * text=auto | |
| # Custom for Visual Studio | |
| *.cs diff=csharp | |
| *.sln merge=union | |
| *.csproj merge=union | |
| *.vbproj merge=union | |
| *.fsproj merge=union | |
| *.dbproj merge=union |
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
| //Need http://nuget.org/packages/Microsoft.Bcl.Async | |
| internal static class WebRequestExtensions | |
| { | |
| internal static Task<WebResponse> GetResponseAsync(this WebRequest request, TimeSpan timeout) | |
| { | |
| var asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null); | |
| var timeoutTask = TaskEx.Delay(timeout); | |
| return TaskEx.WhenAny(asyncTask, timeoutTask) |