Beispiel #1
0
        private async void callButton_Click(object sender, RoutedEventArgs e)
        {
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent(
                    "Windows.ApplicationModel.Calls.PhoneLine"))
            {
                var store = await PhoneCallManager.RequestStoreAsync();

                var phoneLineId = await store.GetDefaultLineAsync();

                var phoneLine = await PhoneLine.FromIdAsync(phoneLineId);

                phoneLine.Dial(_translatedNumber, "");
            }
            else
            {
                var uriSkype = new Uri($"Skype:{Regex.Replace(_translatedNumber, @"[-\s]", "")}?call");
                //var uriSkype = new Uri($"Skype:{_translatedNumber}?call");

                // Set the option to show a warning
                var promptOptions = new Windows.System.LauncherOptions {
                    TreatAsUntrusted = false
                };

                // Launch the URI
                await Windows.System.Launcher.LaunchUriAsync(uriSkype, promptOptions);
            }
        }
Beispiel #2
0
        async Task <PhoneLine> GetDefaultPhoneLineAsync()
        {
            var phoneCallStore = await PhoneCallManager.RequestStoreAsync();

            var lineId = await phoneCallStore.GetDefaultLineAsync();

            return(await PhoneLine.FromIdAsync(lineId));
        }