예제 #1
0
        public Form1()
        {
            ReadBytesV2.ObjFormatType    = BuffFormatType.MsgPack;
            BufferFormatV2.ObjFormatType = BuffFormatType.MsgPack;

            if (SocketManager.client.ConnectionTo(RConfig.ReadString("Host"), RConfig.ReadInt("Port"))) //连接到服务器
            {
                logon = new LogOn();

                logon.ShowDialog(); //显示登入界面

                if (!logon.Logins)  //如果登入界面关闭那么检查是否登入成功如果没有登入成功 则关闭程序
                {
                    Close();
                }

                SocketManager.Disconnection += new ExceptionDisconnection(client_Disconnection); //注册断开事件
                SocketManager.DataInput     += new DataOn(client_DataOn);                        //注册数据包输入事件
                InitializeComponent();
            }
            else
            {
                MessageBox.Show("无法连接服务器"); //无法连接 提示 并关闭
                Close();
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: gezidan/ZYSOCKET
        public Form1()
        {
            ReadBytesV2.ObjFormatType = BuffFormatType.MsgPack;
            BufferFormatV2.ObjFormatType = BuffFormatType.MsgPack;

            if (SocketManager.client.ConnectionTo(RConfig.ReadString("Host"), RConfig.ReadInt("Port"))) //连接到服务器
            {
                logon = new LogOn();

                logon.ShowDialog(); //显示登入界面

                if (!logon.Logins) //如果登入界面关闭那么检查是否登入成功如果没有登入成功 则关闭程序
                {
                    Close();
                }

                SocketManager.Disconnection += new ExceptionDisconnection(client_Disconnection); //注册断开事件
                SocketManager.DataInput += new DataOn(client_DataOn);//注册数据包输入事件
                InitializeComponent();

            }
            else
            {
                MessageBox.Show("无法连接服务器"); //无法连接 提示 并关闭
                Close();
            }
        }
예제 #3
0
        private void WinMain_Load(object sender, EventArgs e)
        {
            BufferFormatV2.ObjFormatType = BuffFormatType.protobuf;
            ReadBytesV2.ObjFormatType    = BuffFormatType.protobuf;


            LogOn logon = new LogOn();

            logon.ShowDialog();

            if (!logon.IsLogOn)
            {
                Close();
                return;
            }

            Path = logon.Path;

            SocketManager.BinaryInput += new ZYSocket.ClientB.ClientBinaryInputHandler(SocketManager_BinaryInput);
            SocketManager.Disconnet   += new ZYSocket.ClientB.ClientMessageInputHandler(SocketManager_Disconnet);


            LoadingDiskInfo();

            this.WindowState = FormWindowState.Minimized;
        }
예제 #4
0
 private void WinMain_Load(object sender, EventArgs e)
 {
     LogAction.LogOut += LogAction_LogOut;
     if (ClientManager.Connect("127.0.0.1", 3775))
     {
         ClientManager.Client.Install(this);
         LogOn tmp = new LogOn();
         tmp.ShowDialog();
     }
     else
     {
         MessageBox.Show("Not Connect Server");
         this.Close();
     }
 }
예제 #5
0
파일: WinMain.cs 프로젝트: lanicon/ZYNet
        private async void WinMain_Load(object sender, EventArgs e)
        {
            var client = Dependency.Container.Resolve <CloudClient>();

            if (await client.InitAsync("127.0.0.1", 3775))
            {
                client.Install(this);
                LogOn tmp = new LogOn();
                tmp.ShowDialog();
            }
            else
            {
                MessageBox.Show("Not Connect Server");
                this.Close();
            }
        }
예제 #6
0
        private async void LogOn()
        {
            LogOn logOnWin = new LogOn();

            logOnWin.ShowDialog();

            if (logOnWin.OK)
            {
                var fiberRw = await client.GetFiberRw();

                fiberRw.Write(1000);
                fiberRw.Write(logOnWin.UserName);
                fiberRw.Write(logOnWin.PassWord);
                await fiberRw.Flush();
            }
            else
            {
                this.Close();
            }
        }
예제 #7
0
        private void WinMain_Load(object sender, EventArgs e)
        {
            BufferFormatV2.ObjFormatType = BuffFormatType.XML;
            ReadBytesV2.ObjFormatType    = BuffFormatType.XML;


            LogOn logon = new LogOn();

            logon.ShowDialog();

            if (!logon.IsLogOn)
            {
                Close();
                return;
            }

            SocketManager.BinaryInput += new ZYSocket.ClientB.ClientBinaryInputHandler(SocketManager_BinaryInput);
            SocketManager.Disconnet   += new ZYSocket.ClientB.ClientMessageInputHandler(SocketManager_Disconnet);



            LoadingDiskInfo();
        }