Exemplo n.º 1
0
 public void LoadGroups()
 {
     InvokeOnMainThread(() => {
         foreach (var c in Contacts.GetAll())
         {
             this.AddGroup(c);
         }
     });
 }
Exemplo n.º 2
0
        public override void HandleAddButtonClicked(object sender, EventArgs e)
        {
#if LITE
            if (Contacts.GetAll().Count >= Settings.MaxGroupFreeVersion)
            {
                UIAlertView alert = new UIAlertView(Settings.GetLocalizedString("SMS Party Free", LocalizedKey),
                                                    Settings.GetLocalizedString("SMS Party Free only allows a maximum of 5 groups to be created", LocalizedKey),
                                                    null, "OK");
                alert.Show();
                alert.Dispose();
                return;
            }
#endif
            CreateButtonTapped();
        }
Exemplo n.º 3
0
        void HandleDoneClicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(nameElement.Value))
            {
                UIAlertView alert = new UIAlertView(
                    Settings.GetLocalizedString("Group Name Error", LocalizedKey),
                    Settings.GetLocalizedString("You must specify a group name", LocalizedKey), null, "OK");
                alert.Show();
                return;
            }

            // 3 cases :
            // 1. New Group = check that the group does not exist, prompt if exist
            // 2. Editing = Update everything..
            // 3. Edit group result in overriding existing group
            if (!isEditing)
            {
                if (Contacts.GetAll().Any(x => x.Name.ToLower().Equals(nameElement.Value.ToLower())))
                {
                    UIAlertView alert = new UIAlertView(
                        Settings.GetLocalizedString("Group Name Error", LocalizedKey),
                        Settings.GetLocalizedString("Can't create the group because a group with the same name exists", LocalizedKey),
                        null, "OK");
                    alert.Show();
                    return;
                }
            }
            else
            {
                if (this.smsGroup.Sms.Name.ToLower() != nameElement.Value.ToLower() && Contacts.GetAll().Any(x => x.Name.ToLower().Equals(nameElement.Value.ToLower())))
                {
                    UIAlertView alert = new UIAlertView(
                        Settings.GetLocalizedString("Group Name Error", LocalizedKey),
                        Settings.GetLocalizedString("Can't update the group because a group with the same name exists", LocalizedKey),
                        null, "OK");
                    alert.Show();
                    return;
                }
            }

            SaveGroup();
            ReturnToMainScreen();
        }