Beispiel #1
0
 public override void initEvent(string clientUUID, ServerEventPrx serverEvent, Current current)
 {
     clients.Add(((ServerEventPrxHelper)serverEvent));
     eventService.DoClientConnect(clientUUID).Wait();
     current.con.setCloseCallback(async(con) =>
     {
         await Task.Yield();
         logger.LogInformation($"{serverEvent.GetHashCode()}");
         clients.Remove((ServerEventPrxHelper)serverEvent);
         await eventService.DoClientDisConnect(clientUUID);
     });
     // var service = lib.Provider.serviceProvider.GetRequiredService<Service.EventService>();
     // var task = service.DoTreeListUpdate();
     // Task.Run(async () =>
     // {
     //     while (true)
     //     {
     //         try
     //         {
     //             ((ServerEventPrxHelper)serverEvent).TreeListUpdate();
     //             await Task.Delay(6000);
     //         }
     //         catch (Exception ex)
     //         {
     //             logger.LogError(ex.Message);
     //             throw ex;
     //         }
     //     }
     // });
     logger.LogInformation($"{serverEvent.GetHashCode()}");
 }
Beispiel #2
0
        public async Task Connect(string[] args)
        {
            await Task.Yield();

            communicator = Ice.Util.initialize(ref args);
            Ice.Identity id    = new Ice.Identity();
            var          proxy = communicator.stringToProxy("Server:default -h localhost -p 10000");

            _server = ServerPrxHelper.checkedCast(proxy);
            adapter = communicator.createObjectAdapterWithEndpoints("TreeDiagramClient", "default -p 10008");
            adapter.activate();
            serverEvent = ServerEventPrxHelper.uncheckedCast(
                adapter.addWithUUID(
                    lib.Provider.serviceProvider.GetRequiredService <lib.IceBridge.ServerEvent>()));
            _server.initEvent(uuid, serverEvent);
        }