示例#1
0
文件: initForm.cs 项目: Colarsis/SR2D
        public bool connectToServer()
        {
            string[] values = getServer();

            networkControl = new SR2DNetworkClientControl(int.Parse(values[1]), values[0], database);

            serverConnectForm serverForm = new serverConnectForm();

            DialogResult serverFormBox = serverForm.ShowDialog();

            if (serverFormBox == DialogResult.OK)
            {
                while (true)
                {
                    if (networkControl.connect(serverForm.getUsername(), serverForm.getPassword()))
                    {
                        while (networkControl.client.enteringQueue.Count == 0)
                        {
                        }

                        while (networkControl.client.enteringQueue.Peek().Split(';')[0] != "connect")
                        {
                        }

                        string dequeue = networkControl.client.enteringQueue.Dequeue();

                        if (dequeue.Split(';')[1] != "validate")
                        {
                            serverForm.error = true;

                            serverFormBox = serverForm.ShowDialog();

                            if (serverFormBox != DialogResult.OK)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            networkControl.id = int.Parse(dequeue.Split(';')[2].ToString());

                            return(true);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public userInfosForm(SR2DClassBound cB, userForm cF, DataRow dr)
        {
            InitializeComponent();

            this.cF             = cF;
            this.cB             = cB;
            this.db             = cB.db;
            this.networkControl = cB.networkControler;

            this.dr = dr;

            load();
        }
示例#3
0
        public userForm(MainForm mF, SR2DClassBound cB)
        {
            InitializeComponent();

            this.mF = mF;

            this.cB             = cB;
            this.db             = cB.db;
            this.networkControl = cB.networkControler;

            fillGridView();

            db.Ds.DatasetUpdatedEvent += new SR2DDataset.EventHandler(update);
        }
示例#4
0
        public MainForm(SR2DClassBound cB, initForm iF)
        {
            InitializeComponent();

            this.cB = cB;

            this.database         = cB.db;
            this.networkControler = cB.networkControler;

            database.Ds.DatasetUpdatedEvent += new SR2DDataset.EventHandler(update);

            updateHUD();

            this.iF = iF;
        }
示例#5
0
文件: foodForm.cs 项目: Colarsis/SR2D
        public foodForm(MainForm baseForm, SR2DClassBound cB)
        {
            InitializeComponent();

            this.networkControler = cB.networkControler;

            this.db       = cB.db;
            this.baseForm = baseForm;
            this.cB       = cB;

            this.Height = baseForm.Height - 150;
            this.Width  = baseForm.Width - 200;

            this.CenterToParent();

            db.Ds.DatasetUpdatedEvent += new SR2DDataset.EventHandler(update);

            setServiceMode();

            fillGridView();
        }
示例#6
0
 public SR2DClassBound(SR2DDatabase db, SR2DNetworkClientControl controler, SR2DVars vars)
 {
     this.db = db;
     this.networkControler = controler;
     this.vars             = vars;
 }