银光与C# - 仅当时间范围过去时才打开子窗口
希望标题有意义,但我会描述我的问题。我在 Silverlight 中使用子窗口来显示处理消息并在 UI 执行某些工作时旋转图像。一旦调用了 Completed Event,窗口就会关闭。
问题是,当 UI 执行快速任务时,子窗口打开然后在 1 秒内关闭,它看起来确实有点难看。
我想要做的是仅在处理 2 秒后才打开子窗口,然后在完成后关闭。
我添加了 xaml 的一部分,我在其中调用下面的子项。我已经搜索过,但找不到任何关于此的信息,这可能是不可能的。
void edit_Closed(对象发送者,EventArgs 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();
ETC.....
Hopefully the title makes sense but I will discribe my issue. I am using a childwindow in Silverlight to display a Processing message and rotating image when the UI is doing some work. Once a Completed Event is called, the window then closes.
Problem is that it does look a little ugly when the UI performs a quick task as the child window opens and then closes in under 1 second.
What I want to be able to do is have the child window open only if 2 seconds of processing has passed and then close on complete.
I have added a section of my xaml where I am calling the child below. I have searched but cannot find anything on this and it might not be possible.
void edit_Closed(object sender, EventArgs e)
{
EditChannelDetails edit = sender as 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();
Etc.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
启动计时器:
并检查标志:
Start a timer:
And check flag: