Commit 1250e820 authored by francesco.carraro's avatar francesco.carraro
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+1.31 MiB

File added.

No diff preview for this file type.

+26 −0
Original line number Diff line number Diff line
using System;
using System.Threading.Tasks;

using Newtonsoft.Json;

namespace INAF.Apps.Uwp.SLabDataManager.Core.Helpers
{
    public static class Json
    {
        public static async Task<T> ToObjectAsync<T>(string value)
        {
            return await Task.Run<T>(() =>
            {
                return JsonConvert.DeserializeObject<T>(value);
            });
        }

        public static async Task<string> StringifyAsync(object value)
        {
            return await Task.Run<string>(() =>
            {
                return JsonConvert.SerializeObject(value);
            });
        }
    }
}
+19 −0
Original line number Diff line number Diff line
using System;
using System.Collections.Concurrent;

namespace INAF.Apps.Uwp.SLabDataManager.Core.Helpers
{
    public static class Singleton<T>
        where T : new()
    {
        private static ConcurrentDictionary<Type, T> _instances = new ConcurrentDictionary<Type, T>();

        public static T Instance
        {
            get
            {
                return _instances.GetOrAdd(typeof(T), (t) => new T());
            }
        }
    }
}
+15 −0
Original line number Diff line number Diff line
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RootNamespace>INAF.Apps.Uwp.SLabDataManager.Core</RootNamespace>
  </PropertyGroup>

   <ItemGroup>
    <Folder Include="Models\" />
  </ItemGroup>

   <ItemGroup>
     <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
   </ItemGroup>
</Project>
+13 −0
Original line number Diff line number Diff line
using System;
using System.Collections.ObjectModel;

namespace INAF.Apps.Uwp.SLabDataManager.Core.Models
{
    // TODO WTS: This is used by the Sample Chart Data. Remove this once your chart page is displaying real data.
    public class DataPoint
    {
        public double Value { get; set; }

        public string Category { get; set; }
    }
}
Loading