示例#1
0
        private void webBrowser_LoadCompleted(object sender, NavigationEventArgs e)
        {
            // 此处填写 access token callback 地址
            if (e.Uri.ToString().Contains(""))
            {
                var splits = e.Uri.Query.Split('=');
                if (splits.Length <= 1)
                {
                    return;
                }
                ConstantPool.AccessToken = splits[1];
                MyDataContext.CreatetDatabaseIfNeeded();
                SyncCore.GetInst().InitializeSyncCore(ConstantPool.AccessToken, ConstantPool.ScreenWidth);
                btnGoHome.Visibility = Visibility.Visible;
                logout();
            }
#if DEBUG
            else if (e.Uri.ToString().Contains("https://note.youdao.com/oauth/login_mobile.html"))
            {
                const string username = ""; // 填写测试用户名
                const string password = ""; // 填写测试用户密码
                webBrowser.InvokeScript("eval", "document.getElementById('user').value = '" + username + "';document.getElementById('pass').value = '" + password + "';");
            }
#endif
        }