Пример #1
0
        private int NavigateToStringReturnContentAsNumber(string html)
        {
            if (UiSynchronizationContext == SynchronizationContext.Current)
            {
                return(0);
            }

            UiSynchronizationContext.Post(_ => RefreshWebBrowserContents(), null);
            Thread.Sleep(TimeSpan.FromMilliseconds(300));
            var initialContents = HtmlOutputContentDivInnerHtml ?? "..";

            UiSynchronizationContext.Send(_ => HtmlOutput.NavigateToString(html), null);
            Thread.Sleep(TimeSpan.FromMilliseconds(1000));
            string oldContents;
            var    newContents = "";

            do
            {
                UiSynchronizationContext.Post(_ => RefreshWebBrowserContents(), null);
                Thread.Sleep(TimeSpan.FromMilliseconds(300));

                oldContents = newContents;
                newContents = HtmlOutputContentDivInnerHtml ?? "..";
                if (newContents != initialContents)
                {
                    initialContents = "..";
                }
            } while (oldContents != newContents || newContents.Contains("..") || newContents == initialContents);

            int.TryParse(newContents, out var result);
            return(result);
        }
Пример #2
0
        private async Task NavigateToMessage(string message)
        {
            vNavigated = false;
            var markup = "<html><head></head><body><p>" + message + "</p></body></html>";

            HtmlOutput.NavigateToString(markup);
            await Task.Run(() => Wait.Until(() => vNavigated, TimeSpan.FromSeconds(5)));
        }