}//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()
Beispiel #2
0
        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;
        }
Beispiel #3
0
 private void grid_5_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0))
     {
         PhoneCallManager.ShowPhoneCallUI("02324335155", "İzmir Bisim");
     }
 }
Beispiel #4
0
        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.");
                }
            }
        }
Beispiel #6
0
        //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");
     }
 }
Beispiel #9
0
        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();
        }
Beispiel #10
0
 public void MakeCall(string phoneNumber)
 {
     if (ApiInformation.IsTypePresent("Windows.ApplicationModel.Calls.PhoneCallManager"))
     {
         PhoneCallManager.ShowPhoneCallUI(phoneNumber, phoneNumber);
     }
 }
Beispiel #11
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);
            }
        }
 private void callButton_Click(object sender, RoutedEventArgs e)
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0))
     {
         PhoneCallManager.ShowPhoneCallUI(bakkal.Phone, bakkal.Name);
     }
 }
Beispiel #13
0
        /// <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);
     }
 }
Beispiel #15
0
        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");
            }
        }
Beispiel #16
0
        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);
        }
Beispiel #17
0
        async Task <PhoneLine> GetDefaultPhoneLineAsync()
        {
            var phoneCallStore = await PhoneCallManager.RequestStoreAsync();

            var lineId = await phoneCallStore.GetDefaultLineAsync();

            return(await PhoneLine.FromIdAsync(lineId));
        }
Beispiel #18
0
        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 }
            });
        }
Beispiel #21
0
        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");
        }
Beispiel #22
0
        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));
        }
Beispiel #23
0
 private void Dial_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PhoneCallManager.ShowPhoneCallUI(PhoneNumberTextBox.Text, "Jon Doe");
     }
     catch (Exception ex)
     {
         ErrorMessage.Text = ex.ToString();
     }
 }
Beispiel #24
0
 private void ShowPhoneSettings_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PhoneCallManager.ShowPhoneCallSettingsUI();
     }
     catch (Exception ex)
     {
         ErrorMessage.Text = ex.ToString();
     }
 }
Beispiel #25
0
        /// <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); }
        }
Beispiel #26
0
 //打电话
 public static void CallFunc()
 {
     try
     {
         PhoneCallManager.ShowPhoneCallUI(18317722768.ToString(), "hippieZhou");
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Beispiel #27
0
 public async Task <bool> RequestCallingAccess()
 {
     try
     {
         Calling = !(await PhoneCallManager.RequestStoreAsync() is null);
     }
     catch
     {
         Calling = null;
     }
     return(Calling.HasValue);
 }
Beispiel #28
0
        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]);
        }
Beispiel #29
0
        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 ?? "");
            }
        }