Пример #1
0
        private void axWebBrowser_DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                var htmlDocument = (IHTMLDocument2)axWebBrowser.Document;
                if (htmlDocument.frames.length == 0)
                {
                    MessageBox.Show(this, @"Please open Internet Explorer and login on facebook.com. " +
                                    @"(Make sure to enable ""Keep me logged in"")",
                                    "Not logged in");
                    DialogResult = DialogResult.Abort;
                }

                if (e.uRL.ToString() != "https://everybody-edits-su9rn58o40itdbnw69plyw.fb.playerio.com/fb/everybody-edits/") return;
                var frame = (HTMLWindow2) htmlDocument.frames.item(0);
                var doc = (HTMLDocument)CrossFrameIe.GetDocumentFromWindow(frame.window);
                HTMLObjectElement flash = (HTMLObjectElement)doc.all.OfType<IHTMLObjectElement>().First();
                var es = flash.getElementsByTagName("param").OfType<HTMLParamElement>().First(p => p.name == "flashvars");
                var flashVars = es.value;
                NameValueCollection qscoll = HttpUtility.ParseQueryString(flashVars);
                AccessToken = qscoll["fb_access_token"];
                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error trying to get token. " + ex.Message);
                DialogResult = DialogResult.Abort;
            }

        }
Пример #2
0
 private void templateBrowser_DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
 {
     try
     {
         if (this.templateBrowser.Document != null)
         {
             object target = this.templateBrowser.Document.GetType().InvokeMember("body", BindingFlags.GetProperty, null, this.templateBrowser.Document, null);
             if (target != null)
             {
                 object obj3 = target.GetType().InvokeMember("style", BindingFlags.GetProperty, null, target, null);
                 if (obj3 != null)
                 {
                     AppSettingsReader reader = new AppSettingsReader();
                     object[] args = new object[] { Convert.ToString(reader.GetValue("ZoomValue", typeof(string))) };
                     obj3.GetType().InvokeMember("zoom", BindingFlags.SetProperty, null, obj3, args);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         BusinessLogic.MyMessageBox(exception.Message);
         BusinessLogic.MyMessageBox("Error in zooming! setting to default zoom.");
         if (Convert.ToUInt32(this.objZoomValue) == 1)
         {
             try
             {
                 this.templateBrowser.ExecWB(SHDocVw.OLECMDID.OLECMDID_ZOOM, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref this.objZoomValue, ref this.missing);
             }
             catch (Exception)
             {
             }
             this.objZoomValue = 0;
         }
     }
 }
Пример #3
0
    private void IE_DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
    {
        AxWebBrowser wb = (AxWebBrowser)sender;

        // Skip document complete event for embedded frames.
        if (wb.Application != e.pDisp) return;

        // Skip the initial about:blank document; this is not necessarily
        // the best thing to do, e.g. if the requested page is about:blank
        // or redirects to it, we might never exit. This could be avoided
        // by remembering whether we saw the first document complete event.
        if (e.uRL.Equals("about:blank")) return;

        mTimer.Start();
    }