Ejemplo n.º 1
0
        private void AuthDoneButton_Click(object sender, EventArgs e)
        {
            // only do something if Frob is present

            if (!string.IsNullOrEmpty(Frob))
            {
                IsLoading = true;
                App.RtmClient.GetToken(Frob, (string token, User user) =>
                {
                    // create timeline
                    App.RtmClient.GetOrStartTimeline((int timeline) =>
                    {
                        Dispatcher.BeginInvoke(() =>
                        {
                            IsLoading = false;

                            // track authentication success
                            var an = new Helper.AnalyticsHelper();
                            var value = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId");
                            var id = Convert.ToBase64String(value);
                            an.Track("AuthSuccess", id);

                            if (NavigationService.CanGoBack)
                            {
                                PivotLandingPage.sReload = true;
                                NavigationService.GoBack();
                            }
                        });
                    });
                });
            }
        }
Ejemplo n.º 2
0
        private void StartAuth()
        {
            // track authentication attempt
            var an = new Helper.AnalyticsHelper();
            var value = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId");
            var id = Convert.ToBase64String(value);
            an.Track("AuthAttempt", id);

            this.IsLoading = true;

            App.RtmClient.GetFrob((string frob) =>
            {
                Frob = frob;
                string url = App.RtmClient.GetAuthenticationUrl(frob, AuthenticationPermissions.Delete);

                Dispatcher.BeginInvoke(() =>
                {
                    this.IsLoading = false;
                    webBrowser1.Navigate(new Uri(url));
                });
            });
        }