Esempio n. 1
0
        public static void Error()
        {
#if __ANDROID__
            Android.Media.ToneGenerator toneGenerator = new Android.Media.ToneGenerator(Android.Media.Stream.Music, 100);
            toneGenerator.StartTone(Android.Media.Tone.CdmaPip, 150);
#elif __IOS__
            AudioToolbox.SystemSound systemSound = systemSound = new AudioToolbox.SystemSound(1000);
            systemSound.PlaySystemSound();
#endif
        }
Esempio n. 2
0
        public void PlaySoundEffect(SoundEffect effect, FeedbackMode mode)
        {
            if (mode == FeedbackMode.Off ||
                effect == SoundEffect.None ||
                (mode == FeedbackMode.Default && Feedback.SoundMode != FeedbackMode.On))
            {
                return;
            }
            switch (effect)
            {
            case SoundEffect.KeyClick:
                click.PlaySystemSound();
                break;

            case SoundEffect.Return:
                modifier.PlaySystemSound();
                break;

            case SoundEffect.Delete:
                delete.PlaySystemSound();
                break;

            case SoundEffect.Info:
                notificationPlayer.Play();
                break;

            case SoundEffect.Message:
                messagePlayer.Play();
                break;

            case SoundEffect.Alert:
                alertPlayer.Play();
                break;

            case SoundEffect.Alarm:
                alarmPlayer.Play();
                break;

            case SoundEffect.Error:
                errorPlayer.Play();
                break;
            }
        }
Esempio n. 3
0
        public void PlaySoundEffect(SoundEffect effect, EffectMode mode)
        {
            if (mode == EffectMode.Off || effect == SoundEffect.None)
            {
                return;
            }
            if (mode == EffectMode.Default && Forms9Patch.Settings.SoundEffectMode != EffectMode.On)
            {
                if (Forms9Patch.Settings.SoundEffectMode == EffectMode.Default)
                {
                    // this no longer works and there doesn't appear to be a way to detect if keyclicks is on
                    //var type = CFPreferences.CurrentApplication;
                    CFPreferences.AppSynchronize("/var/mobile/Library/Preferences/com.apple.preferences.sounds");
                    if (!CFPreferences.GetAppBooleanValue("keyboard", "/var/mobile/Library/Preferences/com.apple.preferences.sounds"))
                    {
                        return;
                    }
                }
                else // Forms9Patch.Settings.SoundEffectMode == EffectMode.Off
                {
                    return;
                }
            }
            switch (effect)
            {
            case SoundEffect.KeyClick:
                click.PlaySystemSound();
                break;

            case SoundEffect.Return:
                modifier.PlaySystemSound();
                break;

            case SoundEffect.Delete:
                delete.PlaySystemSound();
                break;
            }
        }
Esempio n. 4
0
 public static void Error()
 {
     systemSound.PlaySystemSound();
 }
Esempio n. 5
0
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
        {
            if (editingStyle == UITableViewCellEditingStyle.Insert)
            {
                //user clicks the bar button item whateevr he has already favourit as in whaterver exists withint the applications delegate list if the strin already exist the editing saccessory style becomes delete

                if (this.application.localizedTextFamily.Count((string arg) => arg.ToString() == this.familyDict[indexPath.Row]) >= 1)
                {
                    UIAlertController alreadyFavourited = UIAlertController.Create("Already favourited!", "You have already favourited this phrase!", UIAlertControllerStyle.Alert);

                    UIAlertAction confirmed = UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (Action) =>
                    {
                        alreadyFavourited.Dispose();
                    });

                    alreadyFavourited.AddAction(confirmed);


                    if (this.PresentedViewController == null)
                    {
                        this.PresentViewController(alreadyFavourited, true, () =>
                        {
                            AudioToolbox.SystemSound sound = new AudioToolbox.SystemSound(4095);
                            sound.PlaySystemSound();
                        });
                    }
                    else
                    {
                        this.PresentedViewController.DismissViewController(true, () =>
                        {
                            this.PresentedViewController.Dispose();
                            this.PresentViewController(alreadyFavourited, true, () =>
                            {
                                AudioToolbox.SystemSound sound = new AudioToolbox.SystemSound(4095);
                                sound.PlaySystemSound();
                            });
                        });
                    }

                    Console.WriteLine("The object already exists inside the list");
                }

                else if (this.application.localizedTextFamily.Count((string arg) => arg.ToString() == this.familyDict[indexPath.Row]) == 0)
                {
                    this.application.localizedTextFamily.Add(this.familyDict[indexPath.Row]);
                    this.application.frenchTextFamily.Add(this.familyTranslatedDict[indexPath.Row]);
                    this.application.indexPathsRegister.Add(indexPath);
                    this.application.indexPathsInt.Add(indexPath.Row);
                    this.favouritesIndicator = new UILabel();

                    this.favouritesIndicator.Text                      = this.favouritesButton.Title;
                    this.favouritesIndicator.MinimumFontSize           = 20.0f;
                    this.favouritesIndicator.AdjustsFontSizeToFitWidth = true;
                    this.favouritesIndicator.Frame                     = new CoreGraphics.CGRect(0, 20, 40, 40);


                    NSIndexPath        index       = indexPath;
                    List <NSIndexPath> indexChosen = new List <NSIndexPath>()
                    {
                    };
                    indexChosen.Add(index);

                    List <int> indexInt = new List <int>()
                    {
                    };
                    indexInt.Add(indexPath.Row);

                    this.application.indexIntFamily.Add(indexPath.Row);

                    this.application.indexTableFamily = index;

                    this.TableView.ReloadData();
                }
            }
            else if (editingStyle == UITableViewCellEditingStyle.Delete)
            {
                if (this.application.indexIntFamily.Contains(indexPath.Row) == true)
                {
                    this.application.localizedTextFamily.RemoveAll((string obj) => obj == this.familyDict[indexPath.Row]);
                    this.application.indexIntFamily.RemoveAll((int obj) => obj == indexPath.Row);

                    this.application.favourites.RemoveAll((string obj) => obj == this.familyDict[indexPath.Row]);
                    this.application.favouritesFrench.RemoveAll((string obj) => obj == this.familyTranslatedDict[indexPath.Row]);

                    if (this.application.indexTableFamily.Row == indexPath.Row || this.application.indexTableFamily.Row != indexPath.Row)
                    {
                        this.application.cellFamily.AccessoryView        = null;
                        this.application.cellFamily.EditingAccessoryView = null;
                        this.TableView.ReloadData();
                    }

                    if (this.application.localizedTextFamily.Count == 1)
                    {
                        this.TableView.ReloadData();
                    }

                    if (this.application.cellFamily.EditingStyle == UITableViewCellEditingStyle.Insert)
                    {
                        this.application.cellFamily.AccessoryView        = null;
                        this.application.cellFamily.EditingAccessoryView = null;
                        this.TableView.ReloadData();
                    }

                    /*if (this.application.localizedText.Count == 0)
                     * {
                     *      if (this.application.cellBusiness.AccessoryView != null)
                     *      {
                     *              this.application.cellBusiness.AccessoryView = null;
                     *              this.application.cellBusiness.EditingAccessoryView = null;
                     *              this.TableView.ReloadData();
                     *      }
                     * }*/
                }
                else
                {
                    this.application.cellFamily.AccessoryView        = null;
                    this.application.cellFamily.EditingAccessoryView = null;
                    this.TableView.ReloadData();
                }
                //this.application.localizedText.RemoveAt(this.companyDict.IndexOf(this.companyDict[indexPath.Row]));
                //this.application.indexInt.RemoveAt(this.companyDict.IndexOf(this.companyDict[indexPath.Row]));
                //tableView.ReloadData();
                this.TableView.ReloadData();
            }
        }
Esempio n. 6
0
        public void Feedback(HapticEffect effect, FeedbackMode mode = FeedbackMode.Default)
        {
            if (mode == FeedbackMode.Off ||
                effect == HapticEffect.None ||
                (mode == FeedbackMode.Default && Forms9Patch.Feedback.HapticMode == FeedbackMode.Off) ||
                !UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                return;
            }
            switch (effect)
            {
            case HapticEffect.Selection:
            {
                using (var selection = new UISelectionFeedbackGenerator())
                {
                    selection.Prepare();
                    selection.SelectionChanged();
                }
            }
            break;

            case HapticEffect.LightImpact:
            {
                using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Light))
                {
                    impact.Prepare();
                    impact.ImpactOccurred();
                }
            }
            break;

            case HapticEffect.MediumImpact:
            {
                using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Medium))
                {
                    impact.Prepare();
                    impact.ImpactOccurred();
                }
            }
            break;

            case HapticEffect.HeavyImpact:
            {
                using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Heavy))
                {
                    impact.Prepare();
                    impact.ImpactOccurred();
                }
            }
            break;

            case HapticEffect.ErrorNotification:
            {
                // Initialize feedback
                using (var notification = new UINotificationFeedbackGenerator())
                {
                    notification.Prepare();
                    notification.NotificationOccurred(UINotificationFeedbackType.Error);
                }
            }
            break;

            case HapticEffect.WarningNotification:
            {
                // Initialize feedback
                using (var notification = new UINotificationFeedbackGenerator())
                {
                    notification.Prepare();
                    notification.NotificationOccurred(UINotificationFeedbackType.Warning);
                }
            }
            break;

            case HapticEffect.SuccessNotification:
            {
                // Initialize feedback
                using (var notification = new UINotificationFeedbackGenerator())
                {
                    notification.Prepare();
                    notification.NotificationOccurred(UINotificationFeedbackType.Success);
                }
            }
            break;

            case HapticEffect.Long:
                vibrate.PlaySystemSound();
                break;
            }
        }
Esempio n. 7
0
 partial void PlaySystem(UIButton sender)
 {
     // Plays the sound
     systemSound.PlaySystemSound();
 }