zoukankan      html  css  js  c++  java
  • Silverlight Loading page 等待页面

    <UserControl x:Class="RTC_Portal.Waiting"
        xmlns
    ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x
    ="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d
    ="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc
    ="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable
    ="d"
        d:DesignHeight
    ="1024" d:DesignWidth="1280">

        
    <UserControl.Resources>
            
    <Storyboard x:Name="storyboard">
                
    <DoubleAnimation Storyboard.TargetName="WaitingImage"  Duration="0:0:0.7" To="360" Storyboard.TargetProperty="(UIElement.RenderTransform).RotateTransform.Angle" RepeatBehavior="Forever"></DoubleAnimation>
                
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="waitingText" Storyboard.TargetProperty="Opacity" RepeatBehavior="Forever">
                    
    <SplineDoubleKeyFrame KeyTime="00:00:0.0" Value="0"/>
                    
    <SplineDoubleKeyFrame KeyTime="00:00:0.5" Value="1"/>
                    
    <SplineDoubleKeyFrame KeyTime="00:00:1.0" Value="0"/>
                
    </DoubleAnimationUsingKeyFrames>
            
    </Storyboard>
        
    </UserControl.Resources>
        
        
    <Grid x:Name="LayoutRoot" Width="Auto" Height="Auto">
            
    <Grid Background="Black" Opacity="0.2"></Grid>
            
    <Canvas Width="320" Height="50">
                
    <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Fill="#19000000" Height="49" Width="316" Canvas.Left="6" Canvas.Top="3"/>
                
    <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Fill="#19000000" Height="48" Width="316" Canvas.Left="5" Canvas.Top="3"/>
                
    <Border Height="50" Width="320" Background="#FFFFFFFF" BorderBrush="#FFACACAC" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8">
                    
    <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Margin="1,1,1,1">
                        
    <Rectangle.Fill>
                            
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                
    <GradientStop Color="#FFFFFFFF"/>
                                
    <GradientStop Color="#FFE9E9E9" Offset="1"/>
                            
    </LinearGradientBrush>
                        
    </Rectangle.Fill>
                    
    </Rectangle>
                
    </Border>
            
    </Canvas>
            
    <Grid Width="320" Height="50" VerticalAlignment="Center">
                
    <Grid.ColumnDefinitions>
                    
    <ColumnDefinition Width="5*" />
                    
    <ColumnDefinition Width="10*" />
                    
    <ColumnDefinition Width="80*" />
                    
    <ColumnDefinition Width="5*" />
                
    </Grid.ColumnDefinitions>
                
    <Image Stretch="None" Source="Image/loading.png" Grid.Column="1" Opacity="0.3" />
                
    <Image x:Name="WaitingImage" Stretch="None" Source="Image/loading.png" Grid.Column="1" RenderTransformOrigin="0.5,0.5">
                    
    <Image.RenderTransform>
                        
    <RotateTransform Angle="0"></RotateTransform>
                    
    </Image.RenderTransform>
                
    </Image>
                
    <TextBlock x:Name="titleText" FontFamily="Calibri" FontSize="13" Foreground="#FF000000" HorizontalAlignment="Left" Grid.Column="3"/>
                
    <TextBlock Text="Waiting..." x:Name="waitingText"
           FontFamily
    ="Verdana" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="2"/>
            
    </Grid>
        
    </Grid>
        
    </UserControl>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    namespace RTC_Portal
    {
        
    public partial class Waiting : UserControl
        {
            
    public Waiting()
            {
                InitializeComponent();
                
    this.storyboard.Begin();
            }

            
    public string Title
            {
                
    get { return this.titleText.Text; }
                
    set { this.titleText.Text = value; }
            }
            
    public void SetLoadingText(string text)
            {
                
    this.waitingText.Text = text;
            }
            
    public void SetLoadingText()
            {
                
    this.waitingText.Text = "Being processed, please wait...";
            }
        }

    }
    xmlns:my1="clr-namespace:RTC_Portal"

    <my1:Waiting x:Name="waiting" Visibility="Collapsed" Grid.ColumnSpan="2" />
    private void ShowWaiting()
            {
                
    if (waiting != null)
                {
                    waiting.Dispatcher.BeginInvoke(() 
    =>
                    {
                        waiting.Visibility 
    = Visibility.Visible;
                        waiting.SetLoadingText();
                    });
                }
            }

    private void HideWaiting()
            {
                
    if (waiting != null)
                    waiting.Dispatcher.BeginInvoke(() 
    => waiting.Visibility = Visibility.Collapsed);
            }
  • 相关阅读:
    .NET的JSNO 序列化跟反序列化
    SQL Server 查询分析器提供的所有键盘快捷方式(转)
    SQL Server 中WITH (NOLOCK)浅析(转潇湘隐者)
    Microsoft Dynamics CRM 2011的组织服务中的RetrieveMultiple方法(转)
    C#对多个集合和数组的操作(合并,去重,判断)
    Silverlight Telerik控件学习:主题Theme切换html教程
    VMware 11安装Mac OS X 10.10
    Android 下载网络图片注意的问题
    对下载文件是否完整的判断方法
    Android实现通用的ActivityGroup(效果类似Android微博客户端主界面),强烈建议不要再使用TabActivity
  • 原文地址:https://www.cnblogs.com/xh831213/p/1846340.html
Copyright © 2011-2022 走看看