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
// Don't | |
public void DoSomething() | |
{ | |
if (startsWithOneThing) | |
{ | |
if (iDontKnowWhy) | |
{ | |
if (itDoesntEvenMatter && howHardItry) | |
{ |
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 void DoSomething() | |
{ | |
if (!startsWithOneThing) | |
return; | |
if (iDontKnowWhy) | |
{ | |
IDontKnowWhy(1); | |
} | |
else if (itDoesEvenMatter) |
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 List<TimeSpan> queueForward = new List<TimeSpan>(); | |
private CancellationTokenSource ctsForward; | |
private void Forward() | |
{ | |
var steps = TimeSpan.FromSeconds(StepsInSeconds); | |
queueForward.Add(entry); | |
try | |
{ | |
ctsForward?.Cancel(); |
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 User | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public string DisplayName { get; set; } | |
private void DoSomething() | |
{ | |
if (string.IsNullOrEmpty(FirstName)) | |
DisplayName = string.Empty; |
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
// Don't | |
public class FileImageSource | |
{ | |
public string File { get; set; } | |
} | |
var source = new FileImageSource(); | |
source.File = "ic_about"; |
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
// Don't | |
private void DoSomething() | |
{ | |
var a=1+1/2-3; | |
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 async Task<DataResponse<TResult>> HandleNonSuccessStatusCodes<TResult>(HttpResponseMessage response) | |
{ | |
return response.StatusCode switch | |
{ | |
HttpStatusCode.BadRequest => await OnBadRequest(response), | |
HttpStatusCode.NotFound => await OnNotFound(response), | |
_ => 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 EventSourcingPageViewModel : ViewModel | |
{ | |
private readonly IEventSourcing eventSourcing; | |
private readonly IToastService toastService; | |
// Below is the usual approach | |
// where we add each services. | |
// but since we're using EventSourcing, we don't need it anymore | |
// private readonly IAccountService; |
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 ISourceEventArgs<out T> | |
{ | |
string EventName { get; } | |
EventSourceStatus Status { get; set; } | |
PreferredSourceType Type { get; set; } | |
DateTimeOffset Timestamp { get; } | |
T Data { get; } | |
bool IsSuccess { 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
private async Task StreamDeserialize(HttpResponseMessage response, Guid id, CancellationToken cancellationToken) | |
{ | |
// TODO dynamically change the buffer size base on device specification and connection status | |
var content = response.Content; | |
long contentLength = content.Headers.ContentLength ?? 0; | |
DownloadProgress?.Invoke(this, new DownloadEventArgs(id, SerializeState.Pending)); | |
using var stream = await content.ReadAsStreamAsync().ConfigureAwait(false); | |
var totalBytesRead = 0; | |
var buffer = new byte[DownloadBufferSize]; | |
var bytesRead = 0; |