public Boolean modify(string gesture, ContactData contact)
 {
     this.remove(gesture);
     return(this.add(gesture, contact));
 }
Esempio n. 2
0
        private void performAction(string gesture)
        {
            /*long previousTS = previousTimeStamp;
             * long nowTimeStamp = getTimeMiliseconds();
             *
             * previousTimeStamp = nowTimeStamp;
             *
             * if (nowTimeStamp - previousTS < 500)
             * {
             *  return;
             * }*/



            if (GesContactsDB.getInstance().getContactData(gesture) != null)
            {
                gestureControl.stopAccelerometer();
                vibrateFeedback();


                // Microsoft.Phone.Applications.Common.AccelerometerHelper.Instance.Active = false;

                ContactData gestureData = GesContactsDB.getInstance().getContactData(gesture);

                if (gestureData == null)
                {
                    return;
                }

                if (gestureData.settings.connectSetting == ContactSettings.CallContact)
                {
                    phoneTask.DisplayName = gestureData.DisplayName;
                    phoneTask.PhoneNumber = gestureData.Number;
                    phoneTask.Show();
                }
                else if (gestureData.settings.connectSetting == ContactSettings.WriteMessage)
                {
                    smsComposeTask.To   = gestureData.DisplayName + "<" + gestureData.Number + ">"; // Mention here the phone number to whom the sms is to be sent
                    smsComposeTask.Body = "";                                                       // the string containing the sms body
                    smsComposeTask.Show();
                }
                else if (gestureData.settings.connectSetting == ContactSettings.SendDistressMessage)
                {
                    gestureData_i = gestureData;
                    //LocationInfo location = new LocationInfo();
                    this.statusBarTB.Text = "Please wait, getting GPS location data...";
                    locationTask.onLocationDataAvailableEvent += onLocationDataAvailable;
                    locationTask.start();

                    /*string latitude = locationTask.latitude;
                     * string longitude = locationTask.longitude;
                     *
                     * string location = "location:{" + latitude + "," + longitude + "}";
                     * smsComposeTask.To = gestureData.DisplayName + "<" + gestureData.Number + ">"; // Mention here the phone number to whom the sms is to be sent
                     * smsComposeTask.Body = "I need help, "+location; // the string containing the sms body
                     * smsComposeTask.Show();*/

                    //  locationTask.stopWatcher();
                }
            }
        }