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 WcfAsyncWrapper<TEventArgs, TResult> where TEventArgs : AsyncCompletedEventArgs | |
{ | |
private readonly bool _haveResult; | |
private readonly TaskCompletionSource<TResult> _taskCompletionSource; | |
private EventHandler<TEventArgs> _event; | |
public WcfAsyncWrapper(bool haveResult = true) | |
{ | |
_haveResult = haveResult; | |
_taskCompletionSource = new TaskCompletionSource<TResult>(); |
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 RestSharpExtensions | |
{ | |
public static Task<IRestResponse<T>> ExecuteAsync<T>(this IRestClient client, IRestRequest request) where T : new() | |
{ | |
return client.ExecuteAsync<T>(request, CancellationToken.None); | |
} | |
public static Task<IRestResponse<T>> ExecuteAsync<T>(this IRestClient client, IRestRequest request, CancellationToken token) where T : new() | |
{ |
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 class FbServiceClientAsync | |
{ | |
public static Task<FacebookApiEventArgs> DoGetAsync(this FacebookClient client, string getPath, object parameters = null) | |
{ | |
var tcs = new TaskCompletionSource<FacebookApiEventArgs>(); | |
var obj = new object(); | |
EventHandler<FacebookApiEventArgs> eventHandler = null; | |
eventHandler = (s, a) => | |
{ |
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 MonetaryAmount | |
{ | |
double Amount {get;} | |
} | |
class Report | |
{ | |
MonetaryAmount Ecpm {get;} | |
} |
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 interface IDataController | |
{ | |
Task Load(); | |
Task Save(); | |
} | |
public abstract class AppViewModelBase : ViewModelBase //MVVM Light | |
{ | |
(...) | |
protected abstract void Save(IStorage storage); |
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 interface IDataController | |
{ | |
Task Load(); | |
Task Save(); | |
} | |
public abstract class AppViewModelBase : ViewModelBase //MVVM Light | |
{ | |
(...) | |
protected abstract void Save(IStorage storage); |
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
private ICommand _someCommand; | |
public ICommand SomeCommand | |
{ | |
get | |
{ | |
return _someCommand | |
?? (_someCommand = CreateCommandForUserAction( | |
async () => | |
{ |
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
ExceptionHandlerService.Instance.AddHandler(typeof(ServerErrorException), e => ErrorResources.Error_ServerError); |
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 async Task LoadingSafeRun(Func<Task> func, string loadingMessage, bool startedByUser = false) | |
{ | |
try | |
{ | |
StartLoadingOperation(loadingMessage); | |
await func(); | |
StopLoadingOperation(); | |
} | |
catch (Exception e) | |
{ |
OlderNewer