Пример #1
0
        static void Main(string[] args)
        {
            WriteLine($"Client is starting on {Constants.Url}");

            var hubConnection = new HubConnection(Constants.Url);

            Write("Enter username:"******"null", Color = (ConsoleColor)Enum.ToObject(typeof(ConsoleColor), new Random().Next(1, 15))
                }
            };

            hubService.ConfigureProxy(hubConnection).Wait();
            hubService.Connect().Wait();
            while (true)
            {
                string message = ReadLine();
                if (message != null && message.Contains("_exit_"))
                {
                    hubService.Disconnect().Wait();
                    break;
                }
                if (string.IsNullOrWhiteSpace(message))
                {
                    continue;
                }
                hubService.SendData(message).Wait();
            }
        }