}//StayingAlive_Play private void callButton_Click(object sender, RoutedEventArgs e) { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager")) { PhoneCallManager.Equals("999", "Emergency Services"); } //if } //call_Click()
public static async Task Initialize() { DeviceInformationCollection devices; CallManager = await CallManager.GetSystemPhoneCallManagerAsync(); CallStore = await PhoneCallManager.RequestStoreAsync(); CallHistoryStore = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesReadWrite); devices = await DeviceInformation.FindAllAsync(ProximitySensor.GetDeviceSelector()); ProximitySensor = devices.Count > 0 ? ProximitySensor.FromId(devices.First().Id) : null; VibrationAccessStatus accessStatus = await VibrationDevice.RequestAccessAsync(); if (accessStatus == VibrationAccessStatus.Allowed) { VibrationDevice = await VibrationDevice.GetDefaultAsync(); } try { DefaultLine = await PhoneLine.FromIdAsync(await CallStore.GetDefaultLineAsync()); } catch { } Initialized = true; }
private void grid_5_Tapped(object sender, TappedRoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { PhoneCallManager.ShowPhoneCallUI("02324335155", "İzmir Bisim"); } }
private async void PhoneButton_Click(object sender, RoutedEventArgs e) { var Item = this.DefaultViewModel[Restaurant] as Restaurant; string Telephone = Item.Telephone; if (Telephone != null) { Telephone = Regex.Replace(Telephone, "[^0-9]", ""); if (Telephone.Length == 10) { PhoneCallManager.ShowPhoneCallUI(Telephone, Item.Label); } else if (Telephone.Length == 12) { Telephone = "+" + Telephone; PhoneCallManager.ShowPhoneCallUI(Telephone, Item.Label); } else { await ShowErrorAsync(); } } else { this.PhoneButton.IsEnabled = false; } }
private async void RequestCaregiverNo() { object api = settings.Values["api"]; object id = settings.Values["userid"]; if (api != null && id != null) { try { HttpClient httpClient = new HttpClient(); var response = await httpClient.GetAsync(common.getIP() + "api/elderly/caregiverno/" + api.ToString() + "/" + id.ToString()); if (response.IsSuccessStatusCode) { string content = await response.Content.ReadAsStringAsync(); List <UserModel> a = JsonConvert.DeserializeObject <List <UserModel> >(content); Random rnd = new Random(); int num = rnd.Next(a.Count); PhoneCallManager.ShowPhoneCallUI(a[num].usercontact, a[num].userfullname); } else { Debug.WriteLine("error."); } } catch { Debug.WriteLine("catch."); } } }
//Get network connection name internal static async Task <string> GetNetworkName() { try { //Check connection ConnectionProfile ConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (ConnectionProfile == null) { return("No connection"); } else { //Get Wi-Fi / Ethernet name string FirstNetwork = ConnectionProfile.GetNetworkNames().FirstOrDefault(); if (!string.IsNullOrWhiteSpace(FirstNetwork)) { return(FirstNetwork); } //Get Cellular name if (ConnectionProfile.IsWwanConnectionProfile) { PhoneCallStore phoneCallStore = await PhoneCallManager.RequestStoreAsync(); PhoneLine phoneLine = await PhoneLine.FromIdAsync(await phoneCallStore.GetDefaultLineAsync()); return(phoneLine.NetworkName); } return("Unknown"); } } catch { return("Unknown"); } }
private async void InfoScreen(string adress, string phone, string header) { try { MessageDialog dialog = new MessageDialog(adress + "\n" + phone, header); var button_OK = new UICommand("Ara"); var button_CANCEL = new UICommand("Vazgeç"); dialog.Commands.Add(button_OK); dialog.Commands.Add(button_CANCEL); IUICommand result = await dialog.ShowAsync(); if (result != null && result.Label == "Ara") { if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { PhoneCallManager.ShowPhoneCallUI(phone.Trim(), header); } } } catch (Exception) { } }
private void grid_6_Tapped(object sender, TappedRoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { PhoneCallManager.ShowPhoneCallUI("4441141", "Kocaeli Çağrı Merkezi"); } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (_LineWatcher == null) { PhoneCallStore store = await PhoneCallManager.RequestStoreAsync(); _LineWatcher = store.RequestLineWatcher(); _LineWatcher.LineAdded += _watcher_LineAdded; _LineWatcher.LineRemoved += _watcher_LineRemoved; _LineWatcher.Start(); } string str = PhoneLineTransportDevice.GetDeviceSelector(PhoneLineTransport.Bluetooth); if (_DeviceWatcher == null) { _DeviceWatcher = DeviceInformation.CreateWatcher(str); _DeviceWatcher.Added += _DeviceWatcher_Added; _DeviceWatcher.Removed += _DeviceWatcher_Removed; _DeviceWatcher.Start(); } string str1 = BluetoothDevice.GetDeviceSelector(); var watch = DeviceInformation.CreateWatcher(str1); watch.Added += _DeviceWatcher_Added; watch.Removed += _DeviceWatcher_Removed; watch.Start(); }
public void MakeCall(string phoneNumber) { if (ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager")) { PhoneCallManager.ShowPhoneCallUI(phoneNumber, phoneNumber); } }
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); } }
private void callButton_Click(object sender, RoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { PhoneCallManager.ShowPhoneCallUI(bakkal.Phone, bakkal.Name); } }
/// <summary> /// Enumerate through all phone lines and returns a list of all phone lines /// </summary> /// <returns>A dictionary of cellular phone lines and their guids.</returns> private async Task <Dictionary <Guid, PhoneLine> > GetPhoneLinesAsync() { PhoneCallStore store = await PhoneCallManager.RequestStoreAsync(); // Start the PhoneLineWatcher var watcher = store.RequestLineWatcher(); var phoneLines = new List <PhoneLine>(); var lineEnumerationCompletion = new TaskCompletionSource <bool>(); watcher.LineAdded += async(o, args) => { var line = await PhoneLine.FromIdAsync(args.LineId); phoneLines.Add(line); }; watcher.Stopped += (o, args) => lineEnumerationCompletion.TrySetResult(false); watcher.EnumerationCompleted += (o, args) => lineEnumerationCompletion.TrySetResult(true); watcher.Start(); // Wait for enumeration completion if (!await lineEnumerationCompletion.Task) { throw new Exception("Phone Line Enumeration failed"); } watcher.Stop(); Dictionary <Guid, PhoneLine> returnedLines = new Dictionary <Guid, PhoneLine>(); foreach (PhoneLine phoneLine in phoneLines) { if (phoneLine != null && phoneLine.Transport == PhoneLineTransport.Cellular) { returnedLines.Add(phoneLine.Id, phoneLine); } } return(returnedLines); }
public void Call() { if (ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager")) { PhoneCallManager.ShowPhoneCallUI(User.PhoneNumber, User.FullName); } }
private void GenerateActions() { ProfileCommands = new ObservableCollection <ProfileCommand>(); //Mise en place des champs de commande //Commande pour appeler if (!_userModel.numeroPortable.Equals("")) { Action command; //Si on peut appeler if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { command = new Action(() => { PhoneCallManager.ShowPhoneCallUI(_userModel.numeroPortable, Username); }); } //Si le device ne peut passer d'appel else { command = new Action(async() => { string errMsg = "Désolé, les appels ne sont pas disponnibles sur votre appareil"; MessageDialog dialog = new MessageDialog(errMsg); await dialog.ShowAsync(); }); } ProfileCommands.Add(new ProfileCommand("Appeler", _userModel.numeroPortable, command)); } //Commande pour naviguer vers if (!_userModel.adresse.Equals("")) { Action command = new Action(async() => { var locFinderResult = await MapLocationFinder.FindLocationsAsync(_userModel.adresse, new Geopoint(new BasicGeoposition())); if (locFinderResult.Locations[0] == null) { string errMsg = "Désolé, impossible de trouver où " + _userModel.prenom + " habite"; MessageDialog dialog = new MessageDialog(errMsg); await dialog.ShowAsync(); return; } var geoPos = locFinderResult.Locations[0].Point.Position; var driveToUri = new Uri(String.Format( "ms-drive-to:?destination.latitude={0}&destination.longitude={1}&destination.name={2}", geoPos.Latitude, geoPos.Longitude, _userModel.prenom + " " + _userModel.nom)); await Windows.System.Launcher.LaunchUriAsync(driveToUri); }); ProfileCommands.Add(new ProfileCommand("Obtenir un itinéraire", _userModel.adresse, command)); RaisePropertyChanged("ProfileCommands"); } }
private void TextBlock_Tapped(object sender, TappedRoutedEventArgs e) { TextBlock txtBlock = sender as TextBlock; string num = txtBlock.Text; string name = this.txtTitle.Text; PhoneCallManager.ShowPhoneCallUI(num, name); }
async Task <PhoneLine> GetDefaultPhoneLineAsync() { var phoneCallStore = await PhoneCallManager.RequestStoreAsync(); var lineId = await phoneCallStore.GetDefaultLineAsync(); return(await PhoneLine.FromIdAsync(lineId)); }
public void Phone(string number, string name) { //if(!CanPhone) //{ // throw new System.Exception("Sarac"); //} PhoneCallManager.ShowPhoneCallUI(number, name); }
private void list_SelectionChanged(object sender, SelectionChangedEventArgs e) { var value = (Card)list.SelectedItem; if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0)) { PhoneCallManager.ShowPhoneCallUI(value.PhoneNumber, value.Name); } }
private void CallExecute() { PhoneCallManager.ShowPhoneCallUI(Post.PhoneNumber, "@" + Post.User); _insightsService.TrackEvent("ContactCall", new Dictionary <string, string> { { "PostId", Post.Id } }); }
public static string DEBUG = "+420604540531"; /*INSERT NUMBER*/ public static async Task CallAsync() { PhoneCallStore PhoneCallStore = await PhoneCallManager.RequestStoreAsync(); Guid LineGuid = await PhoneCallStore.GetDefaultLineAsync(); PhoneLine line = await PhoneLine.FromIdAsync(LineGuid); line.Dial(DEBUG, "CALL"); }
public virtual Task ShowAsync(string phoneNumber, string displayName) { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager")) { PhoneCallManager.ShowPhoneCallUI(phoneNumber, displayName); return(Task.CompletedTask); } return(CallByUri(phoneNumber, displayName)); }
private void Dial_Click(object sender, RoutedEventArgs e) { try { PhoneCallManager.ShowPhoneCallUI(PhoneNumberTextBox.Text, "Jon Doe"); } catch (Exception ex) { ErrorMessage.Text = ex.ToString(); } }
private void ShowPhoneSettings_Click(object sender, RoutedEventArgs e) { try { PhoneCallManager.ShowPhoneCallSettingsUI(); } catch (Exception ex) { ErrorMessage.Text = ex.ToString(); } }
/// <summary> /// Method invoked when the user clicks on Richiama button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AppBarButton_Tapped_2(object sender, TappedRoutedEventArgs e) { FrameworkElement element = (FrameworkElement)sender; Message message = (Message)element.DataContext; try { PhoneCallManager.ShowPhoneCallUI(message.Sender, message.Sender); } catch (Exception ex) { ShellPage.Current.HandleExceptionNotification(ex); } }
//打电话 public static void CallFunc() { try { PhoneCallManager.ShowPhoneCallUI(18317722768.ToString(), "hippieZhou"); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public async Task <bool> RequestCallingAccess() { try { Calling = !(await PhoneCallManager.RequestStoreAsync() is null); } catch { Calling = null; } return(Calling.HasValue); }
private void listBox1_ItemClick(object sender, ItemClickEventArgs e) { string l = e.ClickedItem.ToString(); //ans.Text = l; string[] line = new string[10]; line = l.Split(','); // ans.Text = line[0]; //ans.Text = l; line[2] = line[2].Replace("\"", string.Empty); PhoneCallManager.ShowPhoneCallUI(line[0], line[2]); }
private async Task InitializateCallSystem() { CallManager = await CallManager.GetCallManagerAsync(); CallStore = await PhoneCallManager.RequestStoreAsync(); CallHistoryStore = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesReadWrite); CallHandler = new CallHandler(); CallHandler.Start(); CallManager.CallAppeared += CallManager_CallAppeared; }
public void MakePhoneCall(string number, string name = null) { if (string.IsNullOrWhiteSpace(number)) { throw new ArgumentNullException("number"); } if (CanMakePhoneCall) { PhoneCallManager.ShowPhoneCallUI(number, name ?? ""); } }