using Device; using EEMSClientCore; using EEMSUIClientCore; using ServiceBase; namespace TestSignalRClient; internal class Program { static void Main(string[] args) { UITest test = new(); test.Test(); Thread.Sleep(-1); } } internal class UITest : IUIProvider { public void Test() { HubBase hubBase = new(); hubBase.Initialize(this); bool b = hubBase.Open("127.0.0.1", 50054, "UIHub"); Console.WriteLine($"Open UI Client {b}"); } public Task InsertNewDevice(DeviceInfo deviceInfo) { Console.WriteLine($"InsertNewDevice {deviceInfo.DeviceName} {deviceInfo.Guid}"); return Task.FromResult(true); } public Task UpdateDevice(DeviceInfo device) { Console.WriteLine($"UpdateDevice {device.DeviceName} {device.Guid}"); return Task.FromResult(true); } public Task UpdateDeviceList(IEnumerable device) { foreach (var deviceInfo in device) { Console.WriteLine($"UpdateDeviceList {deviceInfo.DeviceName} {deviceInfo.Guid}"); } return Task.FromResult(true); } public Task UpdateRealtimeData(Guid guid, Dictionary data) { Console.WriteLine($"UpdateRealtimeData {guid} {data.Count}"); foreach (var item in data) { Console.WriteLine($"UpdateRealtimeData {item.Key} {item.Value}"); } return Task.FromResult(true); } public Task OnlineStatusNotify(Guid guid, bool onlineStatus) { Console.WriteLine($"OnlineStatusNotify {guid} {onlineStatus}"); return Task.FromResult(true); } } internal class ClientTest { public void Test() { IClientBaseProvider baseProvider = new ClientBaseProvider(); ClientCaller hubSender = new(baseProvider); IClientCaller caller = hubSender; hubSender.Initialize(); hubSender.Open("localhost", 50054, "ClientHub"); DeviceInfo deviceInfo = new() { }; Guid guid = caller.RegisterDevice(deviceInfo).Result; Console.WriteLine(guid); } } internal class ClientBaseProvider : IClientBaseProvider { public string? RecipePath { get; set; } public string? ConfigPath { get; set; } string? IClientBaseProvider.RecipePath { get; set; } string? IClientBaseProvider.ConfigPath { get; set; } bool IClientBaseProvider.AllowReceiveFile() { return true; } void IClientBaseProvider.FileReceivedNotify(FileType fileType, string path) { } void IClientBaseProvider.StartFileReceiveNotify(FileType fileType) { } }