Пример #1
0
        public async Task OnNavigationFinished()
        {
            if (dictStatus == DictWebBrowserStatus.Ready)
            {
                return;
            }
            switch (dictStatus)
            {
            case DictWebBrowserStatus.Automating:
                var s = Dict.AUTOMATION.Replace("{0}", Word);
                await OnlineDict.EvaluateScriptAsync(s);

                dictStatus = DictWebBrowserStatus.Ready;
                if (Dict.DICTTYPENAME == "OFFLINE-ONLINE")
                {
                    dictStatus = DictWebBrowserStatus.Navigating;
                }
                break;

            case DictWebBrowserStatus.Navigating:
                var html = await OnlineDict.GetSourceAsync();

                var str = Dict.HtmlString(html, Word);
                dictStatus = DictWebBrowserStatus.Ready;
                OnlineDict.LoadHtml(str);
                break;
            }
        }
Пример #2
0
        public async Task SearchDict()
        {
            dictStatus = DictWebBrowserStatus.Ready;
            Url        = Dict.UrlString(Word, vmSettings.AutoCorrects);
            if (Dict.DICTTYPENAME == "OFFLINE")
            {
                OnlineDict.LoadURL("about:blank");
                var html = await vmSettings.client.GetStringAsync(Url);

                var str = Dict.HtmlString(html, Word);
                OnlineDict.LoadHtml(str);
            }
            else
            {
                OnlineDict.LoadURL(Url);
                if (Dict.AUTOMATION != null)
                {
                    dictStatus = DictWebBrowserStatus.Automating;
                }
                else if (Dict.DICTTYPENAME == "OFFLINE-ONLINE")
                {
                    dictStatus = DictWebBrowserStatus.Navigating;
                }
            }
        }