Ejemplo n.º 1
0
        private async void ParesSelectionButton_Click(object sender, EventArgs e)
        {
            string selection = await RecipePreview.EvaluateJavaScriptAsync("(function(){return window.getSelection().toString()})()");

            ParseRecipePage parseRecipePage = new ParseRecipePage {
                BindingContext = selection
            };
            await Navigation.PushAsync(parseRecipePage);
        }
    public void UpdateText()
    {
        for (int i = 0; i < Recipe_Prefab_GameObject.Count; i++)
        {
            RecipePreview preview = Recipe_Prefab_GameObject[i].GetComponent <RecipePreview>();

            preview.GUI_Text_Sell_Value.text = "$"
                                               + data[currentIndex].recipe.SellValue
                                               * data[currentIndex].AmountSellMuiltplyer;

            preview.GUI_Text_Item.text = StringBuilder(data[currentIndex]);
        }
    }
Ejemplo n.º 3
0
    public List <RecipePreview> GetRecipePreviews()
    {
        //List<Recipe> currentListOfRecipes = (List<Recipe>)HttpContext.Current.Application["recipes"];
        List <RecipePreview> currentListOfRecipePreviews = new List <RecipePreview>();

        foreach (Recipe recipe in (List <Recipe>)HttpContext.Current.Application["recipes"])
        {
            RecipePreview newRecipePreview = new RecipePreview
            {
                NameRecipe  = recipe.NameRecipe,
                SubmittedBy = recipe.SubmittedBy,
                PrepareTime = recipe.PrepareTime
            };
            currentListOfRecipePreviews.Add(newRecipePreview);
        }
        return(currentListOfRecipePreviews);
    }
    public void CreatePrefab(RecipeData recipe)
    {
        GameObject recipe_preview_prefab = Instantiate(Recipe_Prefab_Preview);

        recipe_preview_prefab.transform.SetParent(Recipe_Parent);
        recipe_preview_prefab.transform.localScale = new Vector3(1, 1, 1);
        recipe_preview_prefab.transform.position   = Recipe_Parent.position;
        Recipe_Prefab_GameObject.Add(recipe_preview_prefab);

        RecipePreview recipe_preview_data = recipe_preview_prefab.GetComponent <RecipePreview>();

        recipe_preview_prefab.name     = recipe.recipe.Name + "_Prefab";
        recipe_preview_data.Name       = recipe.recipe.Name;
        recipe_preview_data.Item       = StringBuilder(recipe);
        recipe_preview_data.Sell_Value = recipe.recipe.SellValue.ToString();
        recipe_preview_data.SetText();
        UpdateText();

        RecipePreview.Add(recipe_preview_data);
    }
Ejemplo n.º 5
0
        private async void IngredientsButton_Click(object sender, EventArgs e)
        {
            string substring = await RecipePreview.EvaluateJavaScriptAsync("(function(){return window.getSelection().toString()})()");

            if (substring == null)
            {
                return;
            }

            htmlSource.Html = htmlSource.Html.Replace(substring, "");
            string[] all = substring.Split(new string[] { "\n", "\\n", @"\\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string s in all)
            {
                Ingredient ingr = new Ingredient();
                if (!ingr.TryToParseFromString(s))
                {
                    ingr.Unparsed = s;
                }
                Ingredients.Add(ingr);
            }
            IngredientsView.ItemsSource = Ingredients;
        }
Ejemplo n.º 6
0
        private async void ExtractTitleButton_Click(object sender, EventArgs e)
        {
            TitleEdit.Text = await RecipePreview.EvaluateJavaScriptAsync("(function(){return window.getSelection().toString()})()");

            htmlSource.Html = htmlSource.Html.Replace(TitleEdit.Text, "");
        }