Exemplo 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);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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, "");
        }