public FamilyTreeStoreMyHeritage()
        {
            printDecode   = false;
            printDecode   = true;
            authenticated = false;

            if (printDecode)
            {
                trace.TraceInformation("FamilyTreeStoreMyHeritage");
            }
            accessToken              = null;
            refreshToken             = null;
            expiryTime               = 0;
            authenticationToken      = null;
            authenticationWebBrowser = null;
            geniTreeSize             = null;

            serializer = new JavaScriptSerializer();

            //Authenticate();

            //FamilyTreeStoreGeni2 geni2 = new FamilyTreeStoreGeni2();
            //geni2.TestIndividualParsing();
            cache = new FamilyCache();

            //rootPersonXref = FetchRootPerson();
        }
        private void navBtnClick()
        {
            if (printDecode)
            {
                trace.TraceInformation("navBtnClick=" + DateTime.Now);
            }
            //WebBrowser wbrowser = new GeniWebBrowserClass();
            authenticationWebBrowser = new FamilyWebBrowserClass();
            //wbrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted);
            //wbrowser.webBrowser1_Navigated +=

            authenticationWebBrowser.AuthenticationEvent += wbrowser_AuthenticationEvent;
            authenticationWebBrowser.Navigate("https://www.geni.com/platform/oauth/authorize?client_id=88&response_type=token&display=desktop");

            authenticationWebBrowser.Show();
        }
        public void wbrowser_AuthenticationEvent(object sender, FamilyAuthenticationEvent e)
        {
            //MessageBox.Show(((WebBrowser)sender).Url.ToString());

            if (printDecode)
            {
                trace.TraceInformation("wbrowser_AuthenticationEvent-1:" + e.url + " " + DateTime.Now);
            }

            const string tokenHeader     = "access_token=";
            const string expiresInHeader = "expires_in=";

            string newAuthToken = GetUrlToken(e.url, tokenHeader);

            if (newAuthToken != null)
            {
                //int tokenPos = .IndexOf(tokenHeader);
                authenticationToken = newAuthToken;
                string expiryTime = GetUrlToken(e.url, expiresInHeader);
                if (printDecode)
                {
                    trace.TraceInformation("wbrowser_AuthenticationEvent-3:" + authenticationToken + " " + DateTime.Now + expiryTime);
                }

                if (authenticationWebBrowser != null)
                {
                    authenticationWebBrowser.Hide();

                    authenticationWebBrowser = null;
                }
                else if (printDecode)
                {
                    trace.TraceInformation("wbrowser_AuthenticationEvent-4-no auth window !");
                }
            }
            else if (printDecode)
            {
                trace.TraceInformation("wbrowser_AuthenticationEvent-4-no token found!");
            }

            //trace.TraceInformation("WebBrowser_DocumentCompleted-2:" + ((WebBrowser)sender).Url.ToString());
        }