在执行前使语句等待

时间:2016-05-29 16:23:21

标签: c# wpf

我有这个代码,它有一个动画和一些其他语句(它们就像重置TextBoxs和其他UI控件)。 发生的事情是动画同时从语句开始,用户看到TextBoxs中的文本突然消失,看起来很奇怪,所以我希望这些其他语句等待一段时间(动画持续时间)执行。

//this is an Animation that takes me back to the home view
        switching = (Storyboard)this.FindResource("view_Copy1");
        switching.Begin();
        //I want these statments to wait until the animation is finished
        st1.Children.Clear();
        st2.Children.Clear();
        st3.Children.Clear();
        st4.Children.Clear();
        name.Text = lname.Text = fname.Text = mname.Text = sex.Text =
                bplace.Text = bday.Text = idcard.Text = socal.Text = region.Text = location.Text =
                telephone.Text = mobile1.Text = mobile2.Text = email1.Text = email2.Text =
                ctype.Text = cyear.Text = emergname1.Text = emergrelation1.Text = emergloc1.Text =
                emergphone1.Text = emergname2.Text = emergrelation2.Text = emergloc2.Text = emergphone2.Text = "";
        region.Items.Clear();
        New.IsEnabled = true;
        id = "";
        bt_del.Visibility = Visibility.Collapsed;

1 个答案:

答案 0 :(得分:1)

您可以使用split -l 4 old_file事件,并在完成后执行代码。

Completed