Esempio n. 1
0
 private void GetNextProduct()
 {
     if (count >= 10)
     {
         arrowPicBox.Show();
     }
     countLabel.Text = count.ToString();
     count++;
     tmp = rnd.Next(0, User.list_p2.Count);
     pictureBox.ImageLocation = @"pics\" + User.list_p2[tmp].Name.Replace("-", " ") + ".jpg";
     productName.Text         = User.list_p2[tmp].Name.Replace("-", " ");
     User.list_p2.Remove(User.list_p2[tmp]);
     if (User.list_p2.Count == 0)
     {
         Inform.SendSome("0");
         try
         {
             speechrec.Enabled = false;
         }
         catch (Exception) { }
         likeButton.Hide();
         unlikeButton.Hide();
         arrowPicBox.Show();
         microPicBox.Hide();
     }
 }
Esempio n. 2
0
 private void unlikeButton_Click(object sender, EventArgs e)
 {
     response += "-" + rnd.Next(1, 12);
     Inform.SendSome(response.Length.ToString());
     Inform.SendSome(response);
     response = "";
     GetNextProduct();
 }
Esempio n. 3
0
 void speechrec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
 {
     if (e.Result.Text == "yes")
     {
         response += rnd.Next(1, 12).ToString();
         Inform.SendSome(response.Length.ToString());
         Inform.SendSome(response);
         response = "";
         GetNextProduct();
     }
     else
     {
         response += "-" + rnd.Next(1, 12);
         Inform.SendSome(response.Length.ToString());
         Inform.SendSome(response);
         response = "";
         GetNextProduct();
     }
 }
Esempio n. 4
0
        private void FoodTinder_p3_Load(object sender, EventArgs e)
        {
            Inform.SendSome("0");
            nameOfProduct = Inform.RecieveMessage();
            Inform.CloseConn();
            if (nameOfProduct.ToString().Replace("\0", "").Length == 3)
            {
                gotCategory = Convert.ToInt32(nameOfProduct[0].ToString() + "" + nameOfProduct[1].ToString());
            }
            else if (nameOfProduct.ToString().Replace("\0", "").Length == 2)
            {
                gotCategory = Convert.ToInt32(nameOfProduct[0].ToString());
            }
            var result = User.list_p2.Select(x => x).Where(x => x.typeOfProduct == gotCategory).ToList();
            int tmp    = result.Count();

            tmp           = rnd.Next(0, tmp);
            User.finalEat = result[tmp];
        }
Esempio n. 5
0
 private void FoodTinder_p2_Load(object sender, EventArgs e)
 {
     DataBase.openConnection();
     DataBase.SendFirstQuery();
     DataBase.closeConnection();
     try
     {
         speechrec = new SpeechRecognizer();
     }
     catch (Exception) { }
     Inform.SendSome("1");
     try
     {
         var choices = new Choices();
         choices.Add("yes");
         choices.Add("no");
         var gb = new GrammarBuilder(choices);
         var g  = new Grammar(gb);
         speechrec.LoadGrammar(g);
     }
     catch (Exception) { }
     arrowPicBox.Hide();
     GetNextProduct();
 }
Esempio n. 6
0
 private void StartPage_Load(object sender, EventArgs e)
 {
     Inform.OpenConn();
     Inform.SendSome("0");
     User.ID = Convert.ToInt32(Inform.RecieveMessage());
 }