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; }));
            }

        }

  • 相关阅读:
    MongoDB的安装和常用命令
    mysql安装、使用与遇见的问题汇总
    devicePixelRatio,Viewport,移动端适配
    javascript 数组以及对象的深拷贝(复制数组或复制对象)的方法
    正则表达式
    npm 常用命令
    Markdown 基本语法
    mysql忘记root密码
    mysql5.7.12/13在安装新实例时报错:InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero
    mysqld数据位于a盘,执行delete from table, 发现另外2个盘磁盘使用率接近100%,而a盘的使用率反而很低,y??
  • 原文地址:https://www.cnblogs.com/salam/p/1917919.html
Copyright © 2011-2022 走看看