JsonDistServiceClient.cs 1.16 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13
using FLY.OBJComponents.IService;
using FLY.OBJComponents.OBJ_INTERFACE;
using FObjBase;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.OBJComponents.Client
{
14
    public class JsonDistServiceClient : FObjBase.Reflect.Reflect_SeviceClient, IJsonDistService
潘栩锋's avatar
潘栩锋 committed
15
    {
16 17
        protected override Type InterfaceType => typeof(IJsonDistService);

潘栩锋's avatar
潘栩锋 committed
18

19 20 21
        public JsonDistServiceClient(UInt32 serviceId) : base(serviceId) { }
        
        public JsonDistServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
潘栩锋's avatar
潘栩锋 committed
22 23


24
        public event EventHandler ValueChanged;
潘栩锋's avatar
潘栩锋 committed
25 26


27
        public void Trigger_ValueChanged(JsonDistValueChangedEventArgs e)
潘栩锋's avatar
潘栩锋 committed
28
        {
29
            ValueChanged?.Invoke(this, e);
潘栩锋's avatar
潘栩锋 committed
30 31
        }

32
        public void GetValue(string key, AsyncCBHandler asyncDelegate, object asyncContext)
潘栩锋's avatar
潘栩锋 committed
33
        {
34
            Call(nameof(GetValue), new { key }, asyncDelegate, asyncContext);
潘栩锋's avatar
潘栩锋 committed
35 36
        }

37
        public void SetValue(string key, JObject value)
潘栩锋's avatar
潘栩锋 committed
38
        {
39
            Call(nameof(SetValue), new { key, value });
潘栩锋's avatar
潘栩锋 committed
40 41 42
        }
    }
}