c#應用xamarin編寫撥打德律風法式。本站提示廣大學習愛好者:(c#應用xamarin編寫撥打德律風法式)文章只能為提供參考,不一定能成為您想要的結果。以下是c#應用xamarin編寫撥打德律風法式正文
xamarin 可以很便利的編寫一個德律風撥號法式,上面的代碼是挪用android體系的撥號功效,撥號前會給出一個提醒信息。
callButton是一個用來撥號的按鈕,我們應用它的點擊事宜來停止撥號,撥號前會有一個提醒框
callButton.Click += (object sender, EventArgs e) =>
{
// On "Call" button click, try to dial phone number. sharejs.com
var callDialog = new AlertDialog.Builder(this);
callDialog.SetMessage("Call " + translatedNumber + "?");
callDialog.SetNeutralButton("Call", delegate {
// Create intent to dial phone
var callIntent = new Intent(Intent.ActionCall);
callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
StartActivity(callIntent);
});
callDialog.SetNegativeButton("Cancel", delegate { });
// Show the alert dialog to the user and wait for response.
callDialog.Show();
};
以上所述就是本文的全體內容了,願望年夜家可以或許愛好。