private void 开始骑行ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (id == 0)
            {
                MessageBox.Show("用户尚未登录,无法骑行");
            }
            else
            {
                WindowsFormsApplication1.Form1 ff1 = new WindowsFormsApplication1.Form1();
                //  ff1.uuid = id;
                // WindowsFormsApplication1.Form2 ff2 = new WindowsFormsApplication1.Form2();
                WindowsFormsApplication1.Form2.fa = id;

                ff1.Show();
            }
        }
Exemple #2
0
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     WindowsFormsApplication1.Form1 obj_Form1 = new WindowsFormsApplication1.Form1();
     obj_Form1.ShowDialog();
 }
Exemple #3
0
        private async void BTN_A4_Click(object sender, EventArgs e)
        {
            if (BTN_A4.Text == lisi[c])
            {
                BTN_A4.BackColor = Color.Green;

                Win += 1;
                if (Win == WinC)
                {
                    timer1.Stop();
                    gamewin.Play();
                    MessageBox.Show("YOU WIN!\nYour Score:" + Win + "/10", "Victory!");
                    //------------------------------//WIN_GO_TO
                    Form1 temp = new Form1();
                    temp.Region = this.Region;
                    temp.Show();
                    temp.Location = this.Location;
                    this.Close();
                    //------------------------------//
                }
                else
                {
                    correct.Play();
                }
            }
            else
            {
                BTN_A4.BackColor = Color.Red;
                wrong.Play();
            }

            //=====================================//END ASK:start
            if (Win != WinC && s == WinC)
            {
                timer1.Stop();
                gameover.Play();
                MessageBox.Show("Nice Try!\nYour Score:" + Win + "/10", "Try Again!");
                //------------------------------//WIN_GO_TO
                Form1 temp = new Form1();
                temp.Region = this.Region;
                temp.Show();
                temp.Location = this.Location;
                this.Close();
                //------------------------------//
            }
            //=====================================//END ASK:stop

            if (counter < 9)
            {
                counter += 1;
            }

            BTN_A1.Enabled = false;
            BTN_A2.Enabled = false;
            BTN_A3.Enabled = false;
            BTN_A4.Enabled = false;

            await Task.Delay(2000);

            BTN_A4.BackColor = Color.LightSeaGreen;


            BTN_A1.Enabled = true;
            BTN_A2.Enabled = true;
            BTN_A3.Enabled = true;
            BTN_A4.Enabled = true;



            //----------------------------------------------Randomize/start
            int counter2 = 0;

            var R_ans     = new Random();
            var R_ans_num = Enumerable.Range(0, 4).ToList();
            var R_apotel  = R_ans_num.OrderBy(R_arithm => R_ans.Next()).Take(4).ToArray();

            foreach (var R_arithm in R_apotel)
            {
                arr2[counter2] = R_arithm;   counter2 += 1;
            }

            counter2 = 0;
            r1       = arr2[0];  r2 = arr2[1];  r3 = arr2[2];  r4 = arr2[3];
            //----------------------------------------------Randomize/stop



            c           = arr[counter];
            ASK_T.Text  = questions[c];
            BTN_A1.Text = answers[c, r1];
            BTN_A2.Text = answers[c, r2];
            BTN_A3.Text = answers[c, r3];
            BTN_A4.Text = answers[c, r4];

            s          = s + 1;
            LBL_Q.Text = "Question: " + s + " of 10";
        }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form1 f = new Form1();

            MessageBox.Show("" + f.playername);
        }
Exemple #5
0
 public Form2(Form1 parentForm)
 {
     InitializeComponent();
     baseForm = parentForm;
 }
Exemple #6
0
 public SavedProxy(Form1 form1)
 {
     InitializeComponent();
     this.form1 = form1;
 }
    public static string FilterMessageFromUbiquitiRadio(byte[] msgData)
    {
        string   result = "";
        DateTime dt;

        /**/
        switch (msgData[1])
        {
        case (byte)RadioCommands.GET_TEXT:                                          //display text

            result = System.Text.Encoding.ASCII.GetString(msgData.Skip(2).ToArray()).Replace("-", " ");
            return(result + "\r\n");

        case (byte)RadioCommands.GET_DATE:                                          //format date

            if (weekdays.ContainsKey((RtcDayOfWeek)msgData[2]))
            {
                result += weekdays[(RtcDayOfWeek)msgData[2]] + ", ";
            }
            else
            {
                result += "?, ";
            }

            result += msgData[3].ToString() + " ";

            if (months.ContainsKey((RtcMonth)msgData[4]))
            {
                result += months[(RtcMonth)msgData[4]] + " ";
            }
            else
            {
                result += "? ";
            }

            result += "20" + (msgData[5] >> 4).ToString() + (msgData[5] & 0x0F).ToString();

            if (!DateTime.TryParse(result, out dt))
            {
                result += " : the date is invalid";
            }

            return(result + "\r\n");

        case (byte)RadioCommands.GET_TIME:                                          //format time

            result = ByteTohexString(msgData[2]) + ":" + ByteTohexString(msgData[3]) + ":" + ByteTohexString(msgData[4]);
            if (!DateTime.TryParse(result, out dt))
            {
                result += " : the time is invalid";
            }
            else
            {
                DateTime time = new DateTime(2000, 1, 1, (msgData[2] >> 4) * 10 + (msgData[2] & 0x0F), (msgData[3] >> 4) * 10 + (msgData[3] & 0x0F), (msgData[4] >> 4) * 10 + (msgData[4] & 0x0F));
                result = time.ToLongTimeString();
            }

            return(result + "\r\n");


        case (byte)RadioCommands.GET_CURRENT:                                          //format time

            if (4 == msgData.Length)
            {
                Int16 tmp;

                tmp = (Int16)((msgData[2] << 8) | msgData[3]);

                result  = "device current: ";
                result += (tmp * 1.25).ToString();
                return(result + " ma\r\n");
            }
            break;

        case (byte)RadioCommands.GET_TEMP:
        case (byte)RadioCommands.RX_MESSAGE:

            msgData = msgData.Skip(1).ToArray();
            break;

        case (byte)RadioCommands.GET_PICTURE:                                          //get picture command confirmation from the camera

            if (null != WindowsFormsApplication1.Form1.FsPicture)
            {
                WindowsFormsApplication1.Form1.FsPicture.Close();
            }

            WindowsFormsApplication1.Form1.FsPicture = new FileStream("pic.jpg", FileMode.OpenOrCreate, FileAccess.Write);
            return("opened file pic.jpg \r\n");

        case (byte)RadioCommands.PICTURE_DATA:                                          //next picture data packet received from the camera

            WindowsFormsApplication1.Form1 form1 = (WindowsFormsApplication1.Form1)Application.OpenForms["Form1"];

            result = ByteTohexString(msgData[3]) + " " + ByteTohexString(msgData[2]) + " CKSUM exp: " + ByteTohexString(msgData[msgData.Length - 2]);

            byte i, sum = 0;
            for (i = 2; i < msgData.Length - 2; i++)
            {
                sum += msgData[i];
            }

            result += " CKSUM calc: " + ByteTohexString(sum);
            if (sum != msgData[msgData.Length - 2])                                                     //verify the checksum
            {
                result += " mismatch! " + BitConverter.ToString(msgData).Replace("-", " ");
                form1.SendToComPort(ref form1.SerialPortUbiquiti, new byte[] { 0xFA, 0x01 });           //request packet resend
            }
            else
            {
                WindowsFormsApplication1.Form1.FsPicture.Write(msgData, 6, msgData.Length - 8);         //store data to file
                form1.SendToComPort(ref form1.SerialPortUbiquiti, new byte[] { 0xFA, 0x00 });           //request next packet
            }

            return(result + "\r\n");


        case (byte)RadioCommands.END_PICTURE:

            WindowsFormsApplication1.Form1.FsPicture.Close();
            System.Diagnostics.Process.Start(@"pic.jpg");
            return("picture transfer complete \r\n");

        default:
            break;
        }

        return(BitConverter.ToString(msgData.Skip(1).ToArray()).Replace("-", " ") + "\r\n");
    }
Exemple #8
0
 public Form2(Form1 formFrm)
 {
     form1 = formFrm;
     InitializeComponent();
 }
Exemple #9
0
 public DumpWalker(Form1 form)
 {
     Form  = form;
     Level = 0;
 }