Beispiel #1
0
        private async void RunDomInputQuery(DomClickModel clickModel)
        {
            await RunDomInputQuery();

            // handle output for buttons
            if (clickModel.targetType == "button")
            {
                HandleButtonClick(clickModel);
            }
        }
Beispiel #2
0
        private void HandleButtonClick(DomClickModel clickModel)
        {
            //if (clickModel.targetType != "button") return;
            // TODO: need to ensure that there is a unique id for each button, even when users
            // are not using the id/name feature correctly. for now we loop over all the possible buttons
            IEnumerable <DomInputModel> clickedButtons = _domInputModels.Where(m => m.type == clickModel.targetType);

            clickedButtons = clickedButtons.Where(m => m.id == clickModel.targetId || m.name == clickModel.targetName);
            foreach (DomInputModel domInput in clickedButtons)
            {
                domInput.value = "true";
            }
        }
Beispiel #3
0
        /// <summary>
        /// What to do when the listener script returns a value.
        /// </summary>
        private void OnWebViewInteraction(object sender, CoreWebView2WebMessageReceivedEventArgs e)
        {
            DomClickModel clickData = JsonConvert.DeserializeObject <DomClickModel>(e.WebMessageAsJson);

            _dispatcher.BeginInvoke(new Action(() => { RunDomInputQuery(clickData); }));
        }