SL - 整理 - Loading状态的实现

<controls:ChildWindow AutomationProperties.AutomationId="RA_CommonViews_PopLoading_controls_PopLoading" x:Name="ControlsPopLoading" x:Class="Microsoft.IT.Security.UI.RbacAdministration.ClientViews.CommonViews.PopLoading"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" >
    <controls:ChildWindow.Template>
        <ControlTemplate TargetType="controls:ChildWindow">
            <Grid x:Name="Root" Margin="0" Background="Transparent">
                <Grid x:Name="Overlay" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Background="{TemplateBinding OverlayBrush}" Opacity="{TemplateBinding OverlayOpacity}"/>
                <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0">
                    <TextBlock AutomationProperties.AutomationId="RA_CommonViews_PopLoading_controls_TextBlock10" FontSize="22" FontWeight="Bold" Foreground="DarkGray" Text="{TemplateBinding Title}"></TextBlock>
                    <ProgressBar Width="200" Height="20" IsIndeterminate="True" />
                </StackPanel>
            </Grid>
        </ControlTemplate>
    </controls:ChildWindow.Template>
</controls:ChildWindow>

CommonWrapper.SetBusyStatus = delegate(bool status)
            {
                lock (typeof(App))
                {
                    if (status)
                    {
                        try
                        {
                            busyWcfApiCounter++;
                            popLoadingWindow.Show();
                        }
                        catch (Exception exception)
                        {
                            busyWcfApiCounter--;
                            if (busyWcfApiCounter <= 0)
                            { busyWcfApiCounter = 0; }
                        }
                    }
                    else
                    {
                        busyWcfApiCounter--;
                        if (busyWcfApiCounter <= 0)
                        {
                            busyWcfApiCounter = 0;
                            try
                            {
                                popLoadingWindow.Close();
                            }
                            catch (Exception exception) { }
                        }
                    }
                }
            };


        /// <summary>
        /// static delegate to set this wcf wrapper's busy status
        /// </summary>
        public static Action<bool> SetBusyStatus;

        /// <summary>
        /// change this wcf wrapper's busy status to false while its present asychronus call was done
        /// </summary>
        public static Action<object, AsyncCompletedEventArgs> AsyncCallDone = delegate(object sender, AsyncCompletedEventArgs e)
        {
            if (SetBusyStatus != null)
            {
                SetBusyStatus(false);
            }
        };
估计大家经常会碰到诸如:http://www.deepleo.com/12这样的链接,没有.php,.aspx,.jsp这样的后缀,这个是大势所趋。 其实这就是REST。REST翻译成中文就是:“表述性状态转移”:Representational State Transfer,是网络服务接口的一种风格,并不是一个标准。 REST常用的四种HTTP命令,GET、DELETE、PUT和POST。 GET:是获取资源,DELETE: 是删除资源,PUT:修改资源,POST:不用说就是添加资源。 就web service而言,REST要比SOAP(SOAP是标准,不是风格)轻量得多,容易得多。最初开始接触web service的时候,所有的材料上来就是一大堆的名词,SOAP, WSDL,看得头都要大了,后来提出来的REST就容易理解得多,虽然目前SOAP在企业级的web service中还有一席之地,但是在公共的Internet上,不是REST的服务实在不好意思和人打招呼,我们经常可以看到评价某某服务是RESTful的,但是从来没有听说某某服务是SOAPful的。 REST提出了一些设计概念和准则: 1.网络上的所有事物都被抽象为资源(resource); 2.每个资源对应一个唯一的资源标识(resource identifier); 3.通过通用的连接器接口(generic connector interface)对资源进行操作; 4.对资源的各种操作不会改变资源标识; 5.所有的操作都是无状态的(stateless)。 微软对REST的支持有点晚,自.NET3.5开始,WCF也可以提供RESTful接口。当然,REST不光限于web service,网页服务也可以RESTful,微软的ASP.NET MVC框架提供了直接的REST支持。 有关.net,MVC实现REST风格的方法请参见张善友老师的博客:http://www.cnblogs.com/shanyou/category/307401.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

icewizardry

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值