void speechEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            // Speech utterance confidence below which we treat speech as if it hadn't been heard
            const double ConfidenceThreshold = 0.3;

            if (e.Result.Confidence >= ConfidenceThreshold)
            {
                try
                {
                    if (e.Result.Semantics["activator"].Value.ToString() == "Start Listening")
                    {
                        IsListening = true;
                        this.ImNotListeningBox.Visibility = Visibility.Hidden;
                        this.ImListeningBox.Visibility    = Visibility.Visible;
                    }
                    else if (e.Result.Semantics["activator"].Value.ToString() == "Stop Listening")
                    {
                        IsListening = false;
                        this.ImListeningBox.Visibility    = Visibility.Hidden;
                        this.ImNotListeningBox.Visibility = Visibility.Visible;
                    }
                    else if (e.Result.Semantics["activator"].Value.ToString() == "Navigate")
                    {
                        string searchTerm = e.Result.Semantics["where"].Value.ToString();

                        UserControl userControl;

                        switch (searchTerm)
                        {
                        case "Shop":
                            userControl = new Views.Category();
                            break;

                        case "Account":
                            userControl = new Account();
                            break;

                        case "Wishlist":
                            userControl = new Wishlist();
                            break;

                        case "Search":
                            userControl = new Search();
                            break;

                        case "Home":
                            userControl = new LandingPage();
                            break;

                        default:
                            userControl = null;
                            break;
                        }

                        if (userControl != null)
                        {
                            Switcher.Switch(userControl);
                        }
                        else
                        {
                            MessageBox.Show("The Search Term failed (coding error, soz... ignore this bit:) \r\n " + searchTerm + " : " + e.Result.Semantics["activator"].Value.ToString());
                        }
                    }
                    else if (e.Result.Semantics["activator"].Value.ToString() == "Search")
                    {
                        Collector.lastSearchTerm = "";
                        Collector.Search         = new ObservableCollection <Item>();

                        string category = e.Result.Semantics["category"].Value.ToString();
                        string subCategory;
                        try
                        {
                            subCategory = e.Result.Semantics["subcategory"].Value.ToString();
                            //yes subcategory
                            Models.SubCategory subCategoryFound = Collector.GetSubCategory(subCategory, category);
                            if (subCategoryFound != null)
                            {
                                if (!IsSearch)
                                {
                                    Switcher.Switch(new Search());
                                }
                                foreach (Item product in subCategoryFound.Products)
                                {
                                    Collector.Search.Add(product);
                                }
                            }
                            Collector.lastSearchTerm = category.ToUpper() + " " + subCategory.ToUpper();
                        }
                        catch
                        {
                            //no subcategory
                            Models.Category categoryFound = Collector.GetCategory(category);
                            if (categoryFound != null)
                            {
                                if (!IsSearch)
                                {
                                    Switcher.Switch(new Search());
                                }
                                foreach (Models.SubCategory subCat in categoryFound.SubCategories)
                                {
                                    foreach (Item product in subCat.Products)
                                    {
                                        Collector.Search.Add(product);
                                    }
                                }
                            }
                            Collector.lastSearchTerm = category.ToUpper();
                        }
                    }
                    else if (e.Result.Semantics["activator"].Value.ToString() == "Add to Wishlist")
                    {
                        if (!Collector.Wishlist.Contains(Product))
                        {
                            Collector.Wishlist.Add(Product);
                            Switcher.Switch(new Product(Product, Collector.GetSubCategory(Product.ParentSub, Product.ParentCat), Collector.GetCategory(Product.ParentCat)));
                        }
                    }
                    else if (e.Result.Semantics["activator"].Value.ToString() == "Remove from Wishlist")
                    {
                        if (Collector.Wishlist.Contains(Product))
                        {
                            Collector.Wishlist.Remove(Product);
                            Switcher.Switch(new Product(Product, Collector.GetSubCategory(Product.ParentSub, Product.ParentCat), Collector.GetCategory(Product.ParentCat)));
                        }
                    }
                }
                catch
                {
                }
            }
        }
        private static Category GetCategoryFromFile(string fileName)
        {
            /* Get all lines in the file */
            string[] fileText = File.ReadAllLines(fileName);

            Category    newCat      = new Category();
            SubCategory currentSub  = null;
            Item        currentProd = null;

            /* go through all lines, skipping the first 2 */
            for (int i = 2; i <= fileText.Length; i++)
            {
                if (i == fileText.Length)
                {
                    newCat.SubCategories.Add(currentSub);
                    if (newCat.SubCategories.Count > 0)
                    {
                        int rand    = new Random().Next(newCat.SubCategories.Count - 1);
                        int newRand = new Random().Next(newCat.SubCategories[rand].Products.Count - 1);
                        newCat.SamplePicture = newCat.SubCategories[rand].Products[newRand].ProductImage;
                    }
                    break;
                }

                string[] thisLine = fileText[i].Split(new char[] { '|' });

                /* If the cat title isn't blank */
                if (thisLine[0] != "")
                {
                    newCat.Title = thisLine[0];
                }

                /* If the subcategory title isn't blank */
                if (thisLine[1] != "")
                {
                    if (currentSub != null)
                    {
                        newCat.SubCategories.Add(currentSub);
                        if (newCat.SubCategories.Count > 0)
                        {
                            int rand    = new Random().Next(newCat.SubCategories.Count - 1);
                            int newRand = new Random().Next(newCat.SubCategories[rand].Products.Count - 1);
                            newCat.SamplePicture = newCat.SubCategories[rand].Products[newRand].ProductImage;
                        }
                    }

                    currentSub = new SubCategory(thisLine[1]);
                    string newstring = newCat.Title;
                    currentSub.Parent = newstring;
                }

                currentProd = new Item();

                if ((currentSub.Title.ToLower() == "dresses" && (thisLine[2] == "1" || thisLine[2] == "4")) ||
                    currentSub.Title.ToLower() == "tops" && (int.Parse(thisLine[2]) > 4 && int.Parse(thisLine[2]) < 11) ||
                    currentSub.Title.ToLower() == "dresses" && (thisLine[2] == "2" || thisLine[2] == "3" || thisLine[2] == "4" || thisLine[2] == "7" || thisLine[2] == "9"))
                {
                    currentProd.IsThin = true;
                }

                /* Get Image */
                currentProd.ProductImage = System.AppDomain.CurrentDomain.BaseDirectory + "Resources\\ProductImages\\" + thisLine[3];

                /* Get Title */
                currentProd.Title = thisLine[4];

                /* Get Unique ID */
                currentProd.UniqueID = thisLine[5].Replace(" ", "");

                /* Get Price */
                currentProd.Price = double.Parse(thisLine[6].Replace("[POUND]", string.Empty).Replace("£", ""));

                /* Get first bit of description */
                currentProd.Description = thisLine[7].Replace("\"", "");

                for (i = i + 1; i <= fileText.Length; i++)
                {
                    thisLine = fileText[i].Split(new char[] { '|' });

                    /* Add next description */
                    if (thisLine[0] != "" && thisLine[0].Contains("•"))
                    {
                        string temp = "";
                        for (int k = 0; k < thisLine[0].Length; k++)
                        {
                            if (thisLine[0][k] == '•')
                            {
                                temp += "\r\n";
                            }
                            temp += thisLine[0][k];
                        }
                        thisLine[0] = temp;
                    }
                    currentProd.Description += "\r\n" + thisLine[0].Replace("\"", "");

                    /* if end of description */
                    if (thisLine.Length > 1)
                    {
                        /* Add size variants */
                        currentProd.SizeVariants = thisLine[1];

                        /* Add star rating */
                        currentProd.StarRating = thisLine[2] == "No Review" ? 0 : double.Parse(thisLine[2]);

                        /* Add first bit of delivery methods */
                        currentProd.DeliveryMethods = thisLine[3].Replace("\"", "");

                        for (i = i + 1; i <= fileText.Length; i++)
                        {
                            thisLine = fileText[i].Split(new char[] { '|' });

                            /* Add next bit of delivery methods */
                            currentProd.DeliveryMethods += "\r\n" + thisLine[0].Replace("\"", "");

                            if (thisLine[0].Contains("\""))
                            {
                                currentProd.ParentSub = currentSub.Title;
                                currentProd.ParentCat = newCat.Title;
                                currentSub.Products.Add(currentProd);
                                break;
                            }
                        }
                        break;
                    }
                }
            }

            return(newCat);
        }