Example #1
0
        public void AddGroup(SmsGroupObject sms)
        {
            GroupDetailElement e = new GroupDetailElement(this, sms);

            this.ListGroupSection.Add(e);
            this.ReloadData();
        }
Example #2
0
        public ContactListController(MainScreenGroup parent, GroupDetailElement smsGroup = null) : base(true, ToolbarItemOption.Refresh, false)
        {
            this.EnableSearch   = true;
            this.AutoHideSearch = true;
            this.Parent         = parent;
            this.smsGroup       = smsGroup;

            Root           = new RootElement(Settings.GetLocalizedString("Contact List", LocalizedKey));
            this.isEditing = this.smsGroup != null;
            Section groupName = new Section(Settings.GenerateHeaderFooter("Group Name", LocalizedKey),
                                            Settings.GenerateHeaderFooter("The name that will best describe your group", LocalizedKey));

            groupName.IsSearchable = false;
            nameElement            = new EntryElement(
                Settings.GetLocalizedString("Name", LocalizedKey),
                Settings.GetLocalizedString("Group Name", LocalizedKey), smsGroup != null && smsGroup.Sms != null ? smsGroup.Sms.Name : "");
            nameElement.ClearButtonMode = UITextFieldViewMode.WhileEditing;
            groupName.Add(nameElement);

            //SegmentedSection
            contactSection            = new SegmentedSection("Contacts");
            contactSection.FooterView =
                Settings.GenerateHeaderFooter("Displays only contacts that have a mobile phone set", LocalizedKey);
            contactSection.SegmentedControl.InsertSegment(
                Settings.GetLocalizedString("All", LocalizedKey),
                0, true);
            contactSection.SegmentedControl.InsertSegment(
                Settings.GetLocalizedString("None", LocalizedKey),
                1, true);
            contactSection.SegmentedControl.ValueChanged += HandleContactSectionSegmentedControlTouchUpInside;

            ThreadPool.QueueUserWorkItem((e) => {
                InvokeOnMainThread(() => {
                    Initialize();
                    this.ReloadData();
                });
            });

            Root.Add(groupName);
            Root.Add(contactSection);

            UIBarButtonItem done = new UIBarButtonItem(UIBarButtonSystemItem.Done);

            done.Clicked += HandleDoneClicked;
            this.NavigationItem.RightBarButtonItem = done;
        }
        public ContactListController(MainScreenGroup parent, GroupDetailElement smsGroup = null)
            : base(true, ToolbarItemOption.Refresh ,false)
        {
            this.EnableSearch = true;
            this.AutoHideSearch = true;
            this.Parent = parent;
            this.smsGroup = smsGroup;

            Root = new RootElement (Settings.GetLocalizedString("Contact List", LocalizedKey));
            this.isEditing = this.smsGroup != null;
            Section groupName = new Section(Settings.GenerateHeaderFooter("Group Name", LocalizedKey),
                Settings.GenerateHeaderFooter("The name that will best describe your group", LocalizedKey));
            groupName.IsSearchable = false;
            nameElement = new EntryElement(
                Settings.GetLocalizedString("Name", LocalizedKey),
                Settings.GetLocalizedString("Group Name", LocalizedKey), smsGroup != null && smsGroup.Sms != null ? smsGroup.Sms.Name : "");
            nameElement.ClearButtonMode = UITextFieldViewMode.WhileEditing;
            groupName.Add(nameElement);

            //SegmentedSection
            contactSection = new SegmentedSection("Contacts");
            contactSection.FooterView =
                Settings.GenerateHeaderFooter("Displays only contacts that have a mobile phone set", LocalizedKey);
            contactSection.SegmentedControl.InsertSegment(
                Settings.GetLocalizedString("All", LocalizedKey),
                0,true);
            contactSection.SegmentedControl.InsertSegment(
                Settings.GetLocalizedString("None", LocalizedKey),
                1,true);
            contactSection.SegmentedControl.ValueChanged += HandleContactSectionSegmentedControlTouchUpInside;

            ThreadPool.QueueUserWorkItem ((e) => {
                InvokeOnMainThread(()=>{
                    Initialize();
                    this.ReloadData();
                });
            });

            Root.Add(groupName);
            Root.Add(contactSection);

            UIBarButtonItem done = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            done.Clicked += HandleDoneClicked;
            this.NavigationItem.RightBarButtonItem = done;
        }
Example #4
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);
                }
            }
        }
Example #5
0
 public void AddGroup(SmsGroupObject sms)
 {
     GroupDetailElement e = new GroupDetailElement(this, sms);
     this.ListGroupSection.Add(e);
     this.ReloadData();
 }