示例#1
0
        // Display an inderminate progress indicator
        public void activityStart(string unused)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                var t1 = Application.Current.RootVisual;
                PhoneApplicationFrame frame = t1 as PhoneApplicationFrame;

                var temp1 = frame.FindName("LayoutRoot");

                if (frame != null)
                {
                    PhoneApplicationPage page = frame.Content as PhoneApplicationPage;

                    if (page != null)
                    {
                        var temp  = page.FindName("LayoutRoot");
                        Grid grid = temp as Grid;
                        if (grid != null)
                        {
                            if (progressBar != null)
                            {
                                grid.Children.Remove(progressBar);
                            }
                            progressBar = new ProgressBar();
                            progressBar.IsIndeterminate = true;
                            progressBar.IsEnabled       = true;

                            grid.Children.Add(progressBar);
                        }
                    }
                }
            });
        }