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 class ShowProgressAttribute :MethodInterceptionAspect | |
{ | |
private string _title; | |
public ShowProgressAttribute(string title) | |
{ | |
_title = title; | |
} | |
public override async Task OnInvokeAsync(MethodInterceptionArgs args) | |
{ |
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 class MainPageViewModel | |
{ | |
[DefaultValue("")] | |
public string Name { get; set; } | |
public string WelcomeMsg => $"Hello {Name}"; |
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
[Serializable] | |
public class MainPageViewModelConfiguration : ConfigurationProvider<MainPageViewModel> | |
{ | |
public MainPageViewModelConfiguration() | |
{ |
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 class CommandAsync<T> : IMPCommand | |
{ | |
private readonly Func<T,Task> _executeTask; | |
private readonly Predicate<object> _canExecute; |
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
[Serializable] | |
public class MethodLockedAttribute : MethodInterceptionAspect | |
{ | |
private int maximum_concurrency_number; | |
private static ConcurrentDictionary<int,SemaphoreSlim> SemaphoreSlimRepo=new ConcurrentDictionary<int, SemaphoreSlim>(); | |
public MethodLockedAttribute(int maximumConcurrencyNumber) | |
{ | |
maximum_concurrency_number = maximumConcurrencyNumber; | |
} |
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
[Serializable] | |
public class RequireUserConfirmationAttribute : MethodInterceptionAspect | |
{ | |
private string message; | |
private string cancelText; | |
private string okText; | |
private string title; | |
public RequireUserConfirmationAttribute(string title,string message,string okText, string cancelText) | |
{ |
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
static class LinQToTaskExtensions | |
{ | |
public static async Task<TResult> Select<TSource, TResult>( | |
this Task<TSource> source, Func<TSource, TResult> selector) | |
{ | |
var sourceResult = await source; | |
if (sourceResult == null) | |
return default(TResult); | |
return selector.Invoke(sourceResult); | |
} |
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
static class LinQToTaskExtensions | |
{ | |
public static Func<Task<TResult>> Select<TSource, TResult>( | |
this Task<TSource> source, Func<TSource, TResult> selector) | |
{ | |
return async () => | |
{ | |
var sourceResult = await source; | |
if (sourceResult == null) | |
return default(TResult); |
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 class CommandAsync<T> : ICommand | |
{ | |
private CancellationTokenSource cancellationTokenSource; | |
private readonly Func<T, CancellationToken, Task> _executeTask; | |
private readonly Predicate<T> _canExecute; | |
private bool _locked; |
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 class ObservableCancellationTokenSource<T> : CancellationTokenSource,IDisposable | |
{ | |
private readonly IDisposable _subscription; | |
public ObservableCancellationTokenSource(IObservable<T> observable) | |
{ | |
_subscription = observable.Subscribe(token=>this.Cancel()); | |
} |
OlderNewer