zoukankan      html  css  js  c++  java
  • Silverlight for Windows Phone 7Popup

    在Windows Phone 7开发者我在不使用Progressbar的前提下又想告诉用户程序正在运行,显示一个进度对话框,这时我们就可以用Popup。

    前台

    <Popup x:Name="ProgressPopup" Width="300" IsOpen="False" HorizontalAlignment="Center"
                       VerticalAlignment="Top" d:LayoutOverrides="Width, HorizontalMargin" Margin="89,203,91,0">
                    <Border BorderThickness="10" BorderBrush="Black" Background="DarkGray" Padding="30,30">
                        <StackPanel>
                            <TextBlock MaxHeight="100" Foreground="White"  FontWeight="Bold"  FontSize="36" x:Name="txt" Text="1">
                                <TextBlock.Triggers>
                                    <EventTrigger RoutedEvent="TextBlock.Loaded">
                                        <BeginStoryboard> <Storyboard>
                                            <DoubleAnimation   AutoReverse="True" Duration="0:0:1"
                                         From="1.0" RepeatBehavior="Forever"  Storyboard.TargetName="txt" Storyboard.TargetProperty="Opacity"   To="0.0"/> 
                                        </Storyboard>
                                        </BeginStoryboard>                            
                                    </EventTrigger>                       
                                </TextBlock.Triggers>
                            </TextBlock>
                        </StackPanel>
                    </Border>
                </Popup>

    后台

    public partial class MainPage : PhoneApplicationPage
        {
            Storyboard _timer = new Storyboard();
          
            int i=0;
            public MainPage()
            {
                InitializeComponent();

                _timer.Duration = TimeSpan.FromMilliseconds(10);
                _timer.Completed += new EventHandler(_timer_Completed);
                _timer.Begin();
                 i = Convert.ToInt32(txt.Text);
            }

            private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
            {
                this.Dispatcher.BeginInvoke(new Action(() => ProgressPopup.IsOpen = true));
            }

            void _timer_Completed(object sender, EventArgs e)
            {
               
                if (i <= txt.MaxHeight)
                {
                    i++;
                    this.txt.Text = i.ToString();
                    _timer.Begin();

                    return;
                }

                this.Dispatcher.BeginInvoke(new Action(() => { ProgressPopup.IsOpen = false; }));
            }

        }

    http://www.cnblogs.com/salam/archive/2010/12/27/1917919.html
  • 相关阅读:
    java编写socket使用bufferedReader.readLine()问题研究
    stage3D基础五-----Working with 3D cameras(转)
    stage3D基础四----Stage3D和透视投影的使用(转)
    stage3D基础三------什么是AGAL(转)
    stage3D基础二-----顶点和片段着色器(转)
    stage3D基础一-----Stage3D如何工作(转)
    OpenGL/GLSL数据传递小记(3.x)(转)
    OpenGL/GLSL数据传递小记(2.x)(转)
    Away3D引擎学习笔记(二)CameraController相机控制的应用
    I-team 博客全文检索 Elasticsearch 实战
  • 原文地址:https://www.cnblogs.com/zziss/p/2766409.html
Copyright © 2011-2022 走看看