示例#1
0
        void _newServer_OnClientAskForConnection(xConnection conn)
        {
            InvokeOnMainThread(() => {
                var alert = new NSAlert {
                    MessageText = "Connection Request",
                    AlertStyle  = NSAlertStyle.Informational
                };

                alert.AddButton("Allow");
                alert.AddButton("Deny");

                var returnValue = alert.RunModal();

                if (returnValue == 1000)
                {
                    _newServer.SetAuth(true, conn);
                }
                else
                {
                    _newServer.SetAuth(false, conn);
                }
            });
        }
示例#2
0
        void _newServer_OnClientAskForConnection(xConnection conn)
        {
            Console.WriteLine("[FORM] Connection Request");

            this.Invoke((MethodInvoker) delegate
            {
                string address = conn.socket.RemoteEndPoint.ToString();
                address        = address.Remove(address.IndexOf(':'));
                string msg     = "Accept New Connection request from: " + address + " ?";

                DialogResult result1 = MessageBox.Show(msg, "Connection Request", MessageBoxButtons.YesNo);
                if (result1 == System.Windows.Forms.DialogResult.Yes)
                {
                    _newServer.SetAuth(true, conn);
                    ClientUtil.AddClient(new AuthClient {
                        IPaddress = address, HostName = "temp"
                    });
                }
                else
                {
                    _newServer.SetAuth(false, conn);
                }
            });
        }