コード例 #1
0
        // add a new group!
        public void SaveGroup()
        {
            if (contactSection != null && nameElement != null)
            {
                // adds to the data holder
                SmsGroupObject g = new SmsGroupObject();
                g.Name    = nameElement.Value;
                g.Persons = GetCheckedContact();

                if (isEditing)
                {
                    Contacts.Remove(this.smsGroup.Sms.Name);
                    // it will update if exists
                    Contacts.Add(g);
                    // check if the group exist, update its inner data with new group
                    foreach (var element in Parent.ListGroupSection.Elements)
                    {
                        GroupDetailElement detail = (GroupDetailElement)element;
                        if (detail.Sms.Name == this.smsGroup.Sms.Name)
                        {
                            InvokeOnMainThread(() => {
                                detail.Sms = g;
                                if (detail.smsComposerViewController != null)
                                {
                                    string message = detail.smsComposerViewController.UserMessage;
                                    detail.smsComposerViewController.Dispose();
                                    detail.smsComposerViewController             = new SmsComposerViewController(Parent, g);
                                    detail.smsComposerViewController.UserMessage = message;
                                }
                                Parent.ReloadData();
                            });
                            // Updates UI here, if needed!
                            break;
                        }
                    }
                }
                else
                {
                    Contacts.Add(g);
                    Parent.AddGroup(g);
                }
            }
        }
コード例 #2
0
 public void Delete()
 {
     Contacts.Remove(this.Sms.Name);
 }