ReturnDistanceTextBox() public method

public ReturnDistanceTextBox ( ) : TextBox
return TextBox
示例#1
0
        private void SessionHandler()
        {
            //Send starting chat packet
            PacketChat chat = new PacketChat("Session started...", panel.id.Username, "client", panel.id.Id);

            connection.writePacket(chat);
            if (radioButton_Time.Checked)
            {
                int  tt   = int.Parse(timeTextBox.Text);
                int  min  = tt / 100;
                int  sec  = tt % 100;
                bool flag = true;
                while (flag)
                {
                    //Decrease by 1 second
                    sec--;
                    //Check if seconds are over and minutes should be decreased.
                    if (sec == 0)
                    {
                        if (min == 0)
                        {
                            PacketChat end = new PacketChat("Session ended...", panel.id.Username, "client", panel.id.Id);
                            connection.writePacket(end);
                            flag = false;
                        }

                        sec = 60;
                        min--;
                    }
                    Thread.Sleep(1000);
                }
            }
            else if (radioButton_Distance.Checked)
            {
                bool flag = true;
                while (flag)
                {
                    int distance = int.Parse(panel.ReturnDistanceTextBox().Text);
                    if (distance == 0)
                    {
                        PacketChat end = new PacketChat("Session ended...", panel.id.Username, "client", panel.id.Id);
                        connection.writePacket(end);
                        flag = false;
                    }
                }
            }
        }