无法访问的代码检测到WP8

时间:2014-06-28 18:04:51

标签: c# windows-phone-8 return messagebox

如果IsDownloaded为True,则此代码将不会继续。如果False和Return,我如何正确地弹出MessageBox?如果我拿出'回归'即使IsDownloaded为True,也不会发生RingToneTask。

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();
        }
           );

1 个答案:

答案 0 :(得分:0)

使用范围

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();
    }
       );