IJsonDistService.cs 1.09 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1
using FObjBase;
2
using FObjBase.Reflect;
潘栩锋's avatar
潘栩锋 committed
3 4 5 6 7 8 9 10 11 12 13 14
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
    {
15 16 17 18
        [Call(typeof(DistCell))]
        void GetValue(string key, AsyncCBHandler asyncDelegate, object asyncContext);


潘栩锋's avatar
潘栩锋 committed
19 20
        void SetValue(string key, JObject value);

21 22 23 24
        //event JsonDistValueChangedEventHandler ValueChanged;

        [Push(typeof(JsonDistValueChangedEventArgs))]
        event EventHandler ValueChanged;
潘栩锋's avatar
潘栩锋 committed
25 26 27 28 29 30 31 32 33 34 35 36
    }
    public class DistCell 
    {
        public string Key;
        public DateTime Time;
        public JObject Value;
        public override string ToString()
        {
            return $"[{Key}]={Newtonsoft.Json.JsonConvert.SerializeObject(Value)}";
        }
    }

37
    public delegate void JsonDistValueChangedEventHandler(object sender, JsonDistValueChangedEventArgs e);
潘栩锋's avatar
潘栩锋 committed
38

39
    public class JsonDistValueChangedEventArgs: EventArgs
潘栩锋's avatar
潘栩锋 committed
40 41 42 43
    {
        public string key;
    }
}