コード例 #1
0
        private void RetrieveStats(bool invalidCredentials)
        {
            //make sure the current blog has an api key associated to it.
            if (string.IsNullOrEmpty(App.MasterViewModel.CurrentBlog.ApiKey))
            {
                if (App.MasterViewModel.CurrentBlog.DotcomUsername == null || invalidCredentials)
                {
                    dotcomLoginGrid.Visibility = System.Windows.Visibility.Visible;
                    Storyboard      sB = new Storyboard();
                    DoubleAnimation doubleAnimation = new DoubleAnimation();
                    PropertyPath    pPath           = new PropertyPath("dotcomLoginGrid.Opacity"); // your button name.Opacity

                    doubleAnimation.Duration = TimeSpan.FromMilliseconds(500);
                    doubleAnimation.From     = 0;
                    doubleAnimation.To       = 1;
                    sB.Children.Add(doubleAnimation);
                    Storyboard.SetTargetProperty(doubleAnimation, pPath);
                    Storyboard.SetTarget(doubleAnimation, (dotcomLoginGrid));    // your button name
                    sB.Begin();

                    if (invalidCredentials)
                    {
                        MessageBox.Show(_localizedStrings.Messages.InvalidCredentials);
                    }

                    return;
                }
                else
                {
                    loadingStatsProgressBar.Opacity = 1.0;
                    GetApiKeyRPC rpc = new GetApiKeyRPC(App.MasterViewModel.CurrentBlog, true);
                    rpc.Completed += OnGetApiKeyRPCCompleted;
                    rpc.ExecuteAsync();
                    return;
                }
            }

            switch (StatisticType)
            {
            case eStatisticType.Views:
                RetrieveViews();
                break;

            case eStatisticType.PostViews:
                RetrievePostViews();
                break;

            case eStatisticType.Referrers:
                RetrieveReferrers();
                break;

            case eStatisticType.SearchTerms:
                RetrieveSearchTerms();
                break;

            case eStatisticType.Clicks:
                RetrieveClicks();
                break;
            }
        }
コード例 #2
0
        private void RetrieveStats(bool invalidCredentials)
        {
            //make sure the current blog has an api key associated to it.
            if (string.IsNullOrEmpty(App.MasterViewModel.CurrentBlog.ApiKey))
            {
                if (App.MasterViewModel.CurrentBlog.DotcomUsername == null || invalidCredentials)
                {
                    dotcomLoginGrid.Visibility = System.Windows.Visibility.Visible;
                    Storyboard sB = new Storyboard();
                    DoubleAnimation doubleAnimation = new DoubleAnimation();
                    PropertyPath pPath = new PropertyPath("dotcomLoginGrid.Opacity");    // your button name.Opacity

                    doubleAnimation.Duration = TimeSpan.FromMilliseconds(500);
                    doubleAnimation.From = 0;
                    doubleAnimation.To = 1;
                    sB.Children.Add(doubleAnimation);
                    Storyboard.SetTargetProperty(doubleAnimation, pPath);
                    Storyboard.SetTarget(doubleAnimation, (dotcomLoginGrid));    // your button name
                    sB.Begin();

                    if (invalidCredentials)
                    {
                        MessageBox.Show(_localizedStrings.Messages.InvalidCredentials);
                    }

                    return;
                }
                else
                {
                    loadingStatsProgressBar.Opacity = 1.0;
                    GetApiKeyRPC rpc = new GetApiKeyRPC(App.MasterViewModel.CurrentBlog, true);
                    rpc.Completed += OnGetApiKeyRPCCompleted;
                    rpc.ExecuteAsync();
                    return;
                }
            }

            switch (StatisticType)
            {
                case eStatisticType.Views:
                    RetrieveViews();
                    break;
                case eStatisticType.PostViews:
                    RetrievePostViews();
                    break;
                case eStatisticType.Referrers:
                    RetrieveReferrers();
                    break;
                case eStatisticType.SearchTerms:
                    RetrieveSearchTerms();
                    break;
                case eStatisticType.Clicks:
                    RetrieveClicks();
                    break;
            }
        }