Exemplo n.º 1
0
 partial void StopVibration()
 {
     if (_vibrator != null)
     {
         _vibrator.Cancel();
     }
 }
Exemplo n.º 2
0
 void StopVibrating()
 {
     if (_vibrator != null)
     {
         _vibrator.Cancel();
         _vibrator = null;
     }
 }
 /// <summary>
 /// Called by the alert when it is stopped.
 /// </summary>
 protected override void OnStop()
 {
     if (vibrator != null)
     {
         vibrator.Cancel();
         vibrator = null;
     }
 }
 void handleOkMessage(object sender, DialogClickEventArgs e)
 {
     try
     {
         vibrator.Cancel();
         StopPlayingSound();
     }
     catch (Exception ex)
     {
         clsGLB.ShowMessage(ex.Message, this, MessageTitle.ERROR);
     }
 }
Exemplo n.º 5
0
 void HandleButtonClick()
 {
     ClicksNumber++;
     ClicksLeft = ClicksLimit - ClicksNumber;
     if (ClicksNumber >= ClicksLimit) // Alarm kapa
     {
         DependencyService.Get <IAudio>().Stop();
         _stopped = true;
         vibrator.Cancel();
         OnAlarmTurnedOff?.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 6
0
        public void FinishVideoAudio()
        {
            try
            {
                Methods.AudioRecorderAndPlayer.StopAudioFromAsset();
                Vibrator?.Cancel();

                Finish();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void FinishVideoAudio()
        {
            try
            {
                Methods.AudioRecorderAndPlayer.StopAudioFromAsset();
                Vibrator?.Cancel();

                Finish();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Stops the vibration of the phone.
        /// </summary>
        public void Cancel()
        {
#if __ANDROID__
            _vibrator.Cancel();
#elif __IOS__
            SystemSound.Vibrate.Close();
#elif TIZEN
            _vibrator.Stop();
#elif WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            _device.Cancel();
#elif WINDOWS_PHONE
            Microsoft.Devices.VibrateController.Default.Stop();
#endif
        }
Exemplo n.º 9
0
        void CloseButton_Click(object sender, EventArgs e)
        {
            //removes our app from the scree and from 'recent apps' section
            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                FinishAndRemoveTask();
            }
            else
            {
                Finish();
            }

            if (_settings.IsVibrateOn)
            {
                _vibrator.Cancel();
            }

            Java.Lang.JavaSystem.Exit(0);
        }
Exemplo n.º 10
0
        public void CancelVibration()
        {
            Vibrator vibrator = (Vibrator)this.context.Context.GetSystemService(global::Android.Content.Context.VibratorService);

            vibrator.Cancel();
        }
Exemplo n.º 11
0
 private void TurnOffSoundAndVibration()
 {
     _soundService?.StopAudio();
     _vibrator?.Cancel();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Gets called when the Stop alarm button is pressed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void StopAlarm(object sender, EventArgs e)
 {
     //Cancel the vibration
     vibro.Cancel();
     music.Stop();
 }
Exemplo n.º 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.e_Personal_Info);

            Vibrator vib = (Vibrator)this.ApplicationContext.GetSystemService(Context.VibratorService);

            vib.Cancel();

            var back         = FindViewById <ImageButton>(Resource.Id.btnBackFromPersonalInfo);
            var date         = FindViewById <ImageButton>(Resource.Id.btnSelectDate);
            var txtTimeHour  = FindViewById <EditText>(Resource.Id.txtHour);
            var txtTimeMin   = FindViewById <EditText>(Resource.Id.txtMinute);
            var txtfirstName = FindViewById <EditText>(Resource.Id.txtFirstName);
            var txtlastName  = FindViewById <EditText>(Resource.Id.txtLastName);
            var txtDate      = FindViewById <TextView>(Resource.Id.txtDateView);
            var btnContinue  = FindViewById <Button>(Resource.Id.btnContinueFromPersonalInfo);


            //default values (if this hasnt been filled out yet) if values have been filled out, the values should be saved
            if (sharableDay != 0 && sharableMonth != 0 && sharableYear != 0)
            {
                txtDate.Text = (sharableMonth + 1) + "/" + sharableDay + "/" + sharableYear;
            }

            if (hour == 0)
            {
                txtTimeHour.Text = "00";
            }
            else
            {
                txtTimeHour.Text = hour.ToString("00"); //format to have to two places
            }

            if (min == 0)
            {
                txtTimeMin.Text = "00";
            }
            else
            {
                txtTimeMin.Text = min.ToString("00"); //format to have to two places
            }

            if (!(String.IsNullOrEmpty(first)))
            {
                txtfirstName.Text = first;
            }

            if (!(String.IsNullOrEmpty(last)))
            {
                txtlastName.Text = last;
            }

            //when text values are changed
            txtTimeHour.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                int testHour;
                if (Int32.TryParse(txtTimeHour.Text, out testHour))
                {
                    if (testHour >= 0 && testHour < 24)
                    {
                        hour = testHour;
                    }
                    else
                    {
                        AlertDialog.Builder alertHour = new AlertDialog.Builder(this);
                        alertHour.SetTitle("Alert");
                        alertHour.SetMessage("Enter a valid hour (0 - 23)");
                        alertHour.SetNeutralButton("OK", delegate
                        {
                            alertHour.Dispose();
                        });
                        alertHour.Show();
                        txtTimeHour.Text = "00"; //sets back to original hour of 00
                        hour             = 0;
                    }
                }
            };
            txtTimeMin.AfterTextChanged += (s, e) =>
            {
                int testMin;
                if (Int32.TryParse(txtTimeMin.Text, out testMin))
                {
                    if (testMin >= 0 && testMin < 60)
                    {
                        min = testMin;
                    }
                    else
                    {
                        AlertDialog.Builder alertMin = new AlertDialog.Builder(this);
                        alertMin.SetTitle("Alert");
                        alertMin.SetMessage("Enter a valid minute (0 - 60)");
                        alertMin.SetNeutralButton("OK", delegate
                        {
                            alertMin.Dispose();
                        });
                        alertMin.Show();
                        txtTimeMin.Text = "00";
                        min             = 0;
                    }
                }
            };

            txtfirstName.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                first = txtfirstName.Text;
            };
            txtlastName.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                last = txtlastName.Text;
            };


            back.Click += delegate
            {
                StartActivity(typeof(D_Syllabus_Activity));
            };

            date.Click += delegate
            {
                ShowDialog(DATE_DIALOG);
            };

            btnContinue.Click += delegate
            {
                if (sharableDay != 0 && sharableYear != 0)
                {
                    if (String.IsNullOrEmpty(first) == false && String.IsNullOrEmpty(last) == false)
                    {
                        StartActivity(typeof(F_Student_Human_Factors));
                    }
                    else
                    {
                        AlertDialog.Builder alterName = new AlertDialog.Builder(this);
                        alterName.SetTitle("Alert");
                        alterName.SetMessage("Please enter full name");
                        alterName.SetNeutralButton("OK", delegate
                        {
                            alterName.Dispose();
                        });
                        alterName.Show();
                    }
                }
                else
                {
                    AlertDialog.Builder alertDate = new AlertDialog.Builder(this);
                    alertDate.SetTitle("Alert");
                    alertDate.SetMessage("Please enter a date");
                    alertDate.SetNeutralButton("OK", delegate
                    {
                        alertDate.Dispose();
                    });
                    alertDate.Show();
                }
            };
        }
        private void PhysicalNotification(ValueKindEnum kind)
        {
            Vibrator vibrator = (Vibrator)this.ApplicationContext.GetSystemService(Context.VibratorService);

            vibrator.Cancel();
            long[] pattern1 = { 50, 500, 50, 500, 50, 500, 50, 500 };
            long[] pattern2 = { 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500 };
            long[] pattern3 = { 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500, 50, 500 };

            switch (kind)
            {
            case ValueKindEnum.Low2:
                playerHypo3.Reset();
                playerHypo3.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hypo3));
                playerHypo3.Prepare();
                playerHypo3.Start();
                vibrator.Vibrate(pattern3, -1);
                break;

            case ValueKindEnum.Low1:
                playerHypo2.Reset();
                playerHypo2.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hypo2));
                playerHypo2.Prepare();
                playerHypo2.Start();
                vibrator.Vibrate(pattern2, -1);
                break;

            case ValueKindEnum.Low:
                playerHypo1.Reset();
                playerHypo1.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hypo1));
                playerHypo1.Prepare();
                playerHypo1.Start();
                vibrator.Vibrate(pattern1, -1);
                break;

            case ValueKindEnum.Normal:
                break;

            case ValueKindEnum.High:
                playerHyper1.Reset();
                playerHyper1.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hyper1));
                playerHyper1.Prepare();
                playerHyper1.Start();
                vibrator.Vibrate(pattern1, -1);
                break;

            case ValueKindEnum.High1:
                playerHyper2.Reset();
                playerHyper2.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hyper2));
                playerHyper2.Prepare();
                playerHyper2.Start();
                vibrator.Vibrate(pattern2, -1);
                break;

            case ValueKindEnum.High2:
                playerHyper3.Reset();
                playerHyper3.SetDataSource(this, Android.Net.Uri.Parse("android.resource://com.healthanddrive.handd/" + Resource.Raw.hyper3));
                playerHyper3.Prepare();
                playerHyper3.Start();
                vibrator.Vibrate(pattern3, -1);
                break;

            default:
                break;
            }
        }
Exemplo n.º 15
0
 public void Stop()
 {
     ringTone.Stop();
     vibrator.Cancel();
 }