Silverlight&;C#-仅当时间段过去时才打开childwindow

Silverlight&;C#-仅当时间段过去时才打开childwindow,silverlight,childwindow,Silverlight,Childwindow,希望这个标题有意义,但我会描述我的问题。我在Silverlight中使用一个childwindow来显示处理消息,并在UI执行某些工作时旋转图像。调用完成的事件后,窗口将关闭 问题是,当UI在子窗口打开然后在1秒内关闭时执行快速任务时,它看起来确实有点难看 我希望能够做到的是,只有经过2秒的处理后,才能打开子窗口,然后在完成后关闭 我在我的xaml中添加了一个部分,我在这里调用下面的孩子。我已经搜索过了,但找不到这方面的任何东西,这可能是不可能的 void edit_Closed(对象发送方,事

希望这个标题有意义,但我会描述我的问题。我在Silverlight中使用一个childwindow来显示处理消息,并在UI执行某些工作时旋转图像。调用完成的事件后,窗口将关闭

问题是,当UI在子窗口打开然后在1秒内关闭时执行快速任务时,它看起来确实有点难看

我希望能够做到的是,只有经过2秒的处理后,才能打开子窗口,然后在完成后关闭

我在我的xaml中添加了一个部分,我在这里调用下面的孩子。我已经搜索过了,但找不到这方面的任何东西,这可能是不可能的

void edit_Closed(对象发送方,事件参数e) { EditChannelDetails edit=发件人作为EditChannelDetails

        if (edit.DialogResult == true)
        {
            if (edit != null)
            {
                Channel edited = new Channel();
                edited.channelId = Int32.Parse(edit.ChannelID.Text);
                edited.name = edit.ChannelName.Text;
                edited.description = edit.ChannelDescription.Text;

                ChannelClient proxy = new ChannelClient(new BasicHttpBinding(), new EndpointAddress("http://servername"));
                proxy.UpdateChannelCompleted += new EventHandler<UpdateChannelCompletedEventArgs>(proxy_UpdateChannelCompleted);
                proxy.UpdateChannelAsync(edited);
            }
        }
        processingDialog.Show();
    }

    void proxy_UpdateChannelCompleted(object sender, UpdateChannelCompletedEventArgs e)
    {
        processingDialog.Close();
if(edit.DialogResult==true)
{
如果(编辑!=null)
{
频道编辑=新频道();
edited.channelId=Int32.Parse(edit.channelId.Text);
edited.name=edit.ChannelName.Text;
edited.description=edit.ChannelDescription.Text;
ChannelClient proxy=new ChannelClient(new BasicHttpBinding(),new EndpointAddress(“http://servername"));
proxy.UpdateChannelCompleted+=新事件处理程序(proxy\u UpdateChannelCompleted);
proxy.UpdateChannelAsync(已编辑);
}
}
processingDialog.Show();
}
无效代理\u UpdateChannelCompleted(对象发送方,UpdateChannelCompletedEventArgs e)
{
processingDialog.Close();
等等

Boolean closeFlag = false;
启动计时器:

DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(2) };

timer.Tick += (tts, tte) => {
    timer.Stop();
    closeFlag = true;
};

timer.Start();
和检查标志:

if (!closeFlag)
{
    processingDialog.Close();
}