示例#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);
        }
示例#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;
        }
示例#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, "");
        }