如何为wp7 phonegap启动屏幕静态

时间:2012-10-12 07:00:07

标签: c# windows-phone-7 cordova

如何在应用加载之前使启动画面静止,然后在加载应用时隐藏?

这就是wp7 phonegap中的情况。

public partial class MainPage : PhoneApplicationPage
{
    private WebBrowserHelper _browserHelper;
    // Constructor
    public MainPage()
    {    
        InitializeComponent();
        this.PGView.Loaded += GapBrowser_Loaded;

        _browserHelper = new WebBrowserHelper(PGView.Browser);
        this.PGView.Browser.ScriptNotify += Browser_ScriptNotify;
    }

    private void GapBrowser_Loaded(object sender, RoutedEventArgs e)
    {
        this.PGView.Loaded -= GapBrowser_Loaded;
        Storyboard _storyBoard = new Storyboard();
        DoubleAnimation animation = new DoubleAnimation()
        {
            From = 0,
            Duration = TimeSpan.FromSeconds(0.6),
            To = 90
        };
        Storyboard.SetTarget(animation, SplashProjector);
        Storyboard.SetTargetProperty(animation, new PropertyPath("RotationY"));
        _storyBoard.Children.Add(animation);
        _storyBoard.Begin();
        _storyBoard.Completed += Splash_Completed;
    }

    void Splash_Completed(object sender, EventArgs e)
    {
        (sender as Storyboard).Completed -= Splash_Completed;
        LayoutRoot.Children.Remove(SplashImage);
    }

    private void Browser_ScriptNotify(object sender, NotifyEventArgs e)
    {
        // if a page notifies that it should not be scrollable, disable
        // scrolling.
        if (e.Value == "noScroll")
        {
            _browserHelper.ScrollDisabled = true;
        }
    }

}

1 个答案:

答案 0 :(得分:0)

如果您只需要简单的启动画面,为什么不在应用中更改SplashScreenImage.jpg?

我不太清楚为什么WebBrowserHelper

从您的代码中,我可以看到您在加载主页后显示您的图片。因为你打电话  _storyBoard.Begin();在GapBrowser_Loaded事件句柄