Example #1
0
        private async void Start()
        {
            try {
                client = new MySocketClient();

                string host = textBox2.Text;

                if (string.IsNullOrEmpty(host))
                {
                    host = "127.0.0.1";
                }

                await client.ConnectAsync(host, 1234);

                client.StartReceive();

                userManager = client.Handlers.GetHandler <UserManager>();

                userManager.Join     += UserManager_Join;
                userManager.GetUsers += UserManager_GetUsers;


                Console.WriteLine("OK");
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
        private async void Start()
        {
            try {
                client = new MySocketClient();
                await client.ConnectAsync(textBox1.Text, 1234);

                client.StartReceive();
                Console.WriteLine("OK");
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Example #3
0
        internal void Init(MySocketClient client, string userid)
        {
            this.client = client;
            this.userid = userid;
            var serviceManager = client.Handlers.GetHandler <ServiceManager>();

            terminalCallbackService = serviceManager
                                      .GetService("terminalCallback") as TerminalCallbackService;

            terminalCallbackService.Error    += TerminalCallbackService_Error;
            terminalCallbackService.Received += TerminalCallbackService_Received;

            terminalServiceProxy = serviceManager
                                   .GetServiceProxy <ITerminalService>("terminal", userid);
        }
Example #4
0
        private async void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Client");
            client         = new MySocketClient();
            client.Closed += (ss, ee) => {
                button1.Enabled = true;
            };
            try {
                await client.ConnectAsync(textBox1.Text, 1234);

                button1.Enabled = false;
            } catch {
                Console.WriteLine("连接失败");
            }
        }
Example #5
0
        internal void Init(MySocketClient client, string userid)
        {
            ServiceManager serviceManager = client.Handlers.GetHandler <ServiceManager>();

            fileService = serviceManager.GetServiceProxy <IFileService>("file", userid);
        }