windows8 后台传递下载

后台传递下载示例
这个示例演示了power-friendly,cost-aware和灵活的行为背景的传输API为Windows运行时应用程序
void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Figure out what resolution and orientation we are in and respond appropriately
            CheckResolutionAndViewState();

            // Load the ScenarioList page into the proper frame
            ScenarioList.Navigate(Type.GetType(_rootNamespace + ".ScenarioList"), this);
        }

        #region Resolution and orientation code

        void DisplayProperties_LogicalDpiChanged(object sender)
        {
            CheckResolutionAndViewState();
        }

        void CheckResolutionAndViewState()
        {
            VisualStateManager.GoToState(this, ApplicationView.Value.ToString() + DisplayProperties.ResolutionScale.ToString(), false);
        }

        void MainPage_ViewStateChanged(ApplicationView sender, ApplicationViewStateChangedEventArgs args)
        {
            CheckResolutionAndViewState();
        }

        #endregion

        private void SetFeatureName(string str)
        {
            FeatureName.Text = str;
        }

        async void Footer_Click(object sender, RoutedEventArgs e)
        {
            await Windows.System.Launcher.LaunchUriAsync(new Uri(((HyperlinkButton)sender).Tag.ToString()));
        }

        public void NotifyUser(string strMessage, NotifyType type)
        {
            switch (type)
            {
                case NotifyType.StatusMessage:
                    StatusBlock.Style = Resources["StatusStyle"as Style;
                    break;
                case NotifyType.ErrorMessage:
                    StatusBlock.Style = Resources["ErrorStyle"as Style;
                    break;
            }
            StatusBlock.Text = strMessage;
        }

        public void DoNavigation(Type pageType, Frame frame)
        {
            frame.Navigate(pageType, this);
            if (pageType.Name.Contains("Input"))
            {
                // Raise InputFrameLoaded so downstream pages know that the input frame content has been loaded.
                if (InputFrameLoaded != null)
                {
                    InputFrameLoaded(thisnew EventArgs());
                }
            }
            else
            {
                // Raise OutputFrameLoaded so downstream pages know that the output frame content has been loaded.
                if (OutputFrameLoaded != null)
                {
                    OutputFrameLoaded(thisnew EventArgs());
                }
            }

        } 

 完整示例 /Files/risk/windows8/后台传递下载sample.rar

posted @ 2012-05-11 10:14  西瓜小强  阅读(313)  评论(0编辑  收藏  举报