Exemple #1
0
 void browser_IsLoadingChanged(object sender, IsLoadingChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         if (Browser.Address.ToLower().StartsWith("http://application.globalcaching.eu/tokenresult.aspx"))
         {
             try
             {
                 var task = Browser.EvaluateScriptAsync("getToken()");
                 task.Wait();
                 _token = task.Result.Result as string;
             }
             catch
             {
             }
             this.BeginInvoke(new Action(this.Close));
         }
     }
 }
        private void SpotifyEnabledBrowser_IsLoadingChanged(object sender, IsLoadingChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                string css = File.ReadAllText("themes\\" + this.themeFileName);

                css = css.Replace("\r", "").Replace("\n", "").Replace("'", "\"");

                // try and inject the theme CSS
                this.ExecuteScriptAsync(@"var css = '" + css + @"',
                        head = document.getElementsByTagName('head')[0],
                        style = document.createElement('style');

                    style.type = 'text/css';
                    if (style.styleSheet){
                      style.styleSheet.cssText = css;
                    } else {
                      style.appendChild(document.createTextNode(css));
                    }
                    head.appendChild(style);");
            }
        }