检测到无法到达的代码WP8

本文关键字:代码 WP8 检测 | 更新日期: 2023-09-27 18:10:43

如果isdownloads为True,此代码将不会继续。我如何正确地有一个消息框弹出,如果如果False和返回;?如果我取出'Return ' RingToneTask永远不会发生即使isdownloads是True。

private void ExecuteSaveSoundAsRingtone(string soundPath)
    {
        if (IsDownloaded == false)
            MessageBox.Show("Will not download until you short press atleast once");
        return;
        App.Current.RootVisual.Dispatcher.BeginInvoke(() =>
        {
            SaveRingtoneTask task = new SaveRingtoneTask();
            task.Source = new Uri("isostore:/" + this.SavePath);
            task.DisplayName = this.Title;
            task.Show();
        }
           );

检测到无法到达的代码WP8

使用作用域

private void ExecuteSaveSoundAsRingtone(string soundPath)
{
    if (IsDownloaded == false)
    {
        MessageBox.Show("Will not download until you short press atleast once");
        return;
    }
    App.Current.RootVisual.Dispatcher.BeginInvoke(() =>
    {
        SaveRingtoneTask task = new SaveRingtoneTask();
        task.Source = new Uri("isostore:/" + this.SavePath);
        task.DisplayName = this.Title;
        task.Show();
    }
       );