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 class ObservableCollectionAndItems<TModel> where TModel : INotifyPropertyChanged | |
{ | |
private readonly ObservableCollection<TModel> collection = new(); | |
public event EventHandler<EventArgs>? ItemChanged; | |
public event EventHandler<NotifyCollectionChangedEventArgs>? CollectionChanged; | |
public ObservableCollectionAndItems() | |
{ | |
collection.CollectionChanged += Collection_CollectionChanged; |
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
[a-zA-Z]+\/[0-9.]+\s?([(][a-zA-Z ;0-9.,]+[)])? |
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 std::string date_format(boost::posix_time::ptime const& datetime) { | |
using namespace boost; | |
std::ostringstream ss; | |
auto output_facet = new boost::posix_time::time_facet(); | |
ss.imbue(std::locale(std::locale::classic(), output_facet)); | |
output_facet->format("%Y-%m-%d %H:%M:%s%Q"); | |
ss.str(""); |
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
using System; | |
using System.Reflection; | |
using Android.Content; | |
using Android.Support.Design.Widget; | |
using Android.Support.V4.View; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.Android; | |
using AWidget = Android.Widget; | |
using ATabbedRenderer = Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer; | |
using System.Collections.Specialized; |
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
[Route("api/[controller]")] | |
[ApiController] | |
public class MonitorController : Controller | |
{ | |
private readonly IActionDescriptorCollectionProvider _provider; | |
public MonitorController(IActionDescriptorCollectionProvider provider) | |
{ | |
_provider = provider; | |
} |
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 Observable | |
{ | |
private object actionCollection = null!; | |
private MethodInfo? methodInfo; | |
public ActionCollection<TModel> From<TModel>(TModel target) where TModel : INotifyPropertyChanged | |
{ | |
RegisterPropertyChanged(target); | |
return BuildActionCollection<TModel>(); | |
} |
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 LoggingInterceptor : HttpClientHandler | |
{ | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
Debug.Log("Request {0}", request.RequestUri.PathAndQuery); | |
if (request.Content != null) | |
{ | |
var contentRequest = await request.Content.ReadAsStringAsync(); | |
} |
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 Configuration : IConfiguration | |
{ | |
private readonly string assemblyResourceFile; | |
private AutoDisposeJsonDocument? smartJsonDocument; | |
public Configuration(string assemblyResourceFile) | |
{ | |
this.assemblyResourceFile = assemblyResourceFile; | |
} |
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 void ScheduleDisposeResourceStreams() | |
{ | |
_ = Task.Factory.StartNew(async () => | |
{ | |
await Task.Delay(TimeSpan.FromMinutes(1)); | |
// `stream` creation happens right after the invocation of this | |
// They are in the same thread so no lock needed | |
jsonStream?.Dispose(); | |
jsonDocument?.Dispose(); | |
jsonStream = 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 async Task<T?> GetValue<T>(string path, JsonSerializerOptions? options, CancellationToken cancellationToken) | |
{ | |
using var stream = GetStream(); | |
using var jsonDocument = await JsonDocument.ParseAsync(stream, cancellationToken: cancellationToken); | |
var root = jsonDocument.RootElement; | |
var jsonPath = JsonPath.Parse(path); | |
var pathResult = jsonPath.Evaluate(root); | |
if (pathResult.Error != null) | |
throw new InvalidOperationException(pathResult.Error); |