IJsonDistService.cs 1.09 KB
using FObjBase;
using FObjBase.Reflect;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.OBJComponents.IService
{
    public interface IJsonDistService
    {
        [Call(typeof(DistCell))]
        void GetValue(string key, AsyncCBHandler asyncDelegate, object asyncContext);


        void SetValue(string key, JObject value);

        //event JsonDistValueChangedEventHandler ValueChanged;

        [Push(typeof(JsonDistValueChangedEventArgs))]
        event EventHandler ValueChanged;
    }
    public class DistCell 
    {
        public string Key;
        public DateTime Time;
        public JObject Value;
        public override string ToString()
        {
            return $"[{Key}]={Newtonsoft.Json.JsonConvert.SerializeObject(Value)}";
        }
    }

    public delegate void JsonDistValueChangedEventHandler(object sender, JsonDistValueChangedEventArgs e);

    public class JsonDistValueChangedEventArgs: EventArgs
    {
        public string key;
    }
}